diff --git a/sdk/resourcemanager/sql/armsql/CHANGELOG.md b/sdk/resourcemanager/sql/armsql/CHANGELOG.md index 984867fb30e7..f7d53158fa03 100644 --- a/sdk/resourcemanager/sql/armsql/CHANGELOG.md +++ b/sdk/resourcemanager/sql/armsql/CHANGELOG.md @@ -1,5 +1,381 @@ # Release History +## 2.0.0-beta.1 (2023-07-28) +### Breaking Changes + +- Function `*DataMaskingPoliciesClient.CreateOrUpdate` parameter(s) have been changed from `(context.Context, string, string, string, DataMaskingPolicy, *DataMaskingPoliciesClientCreateOrUpdateOptions)` to `(context.Context, string, string, string, DataMaskingPolicyName, DataMaskingPolicy, *DataMaskingPoliciesClientCreateOrUpdateOptions)` +- Function `*DataMaskingPoliciesClient.Get` parameter(s) have been changed from `(context.Context, string, string, string, *DataMaskingPoliciesClientGetOptions)` to `(context.Context, string, string, string, DataMaskingPolicyName, *DataMaskingPoliciesClientGetOptions)` +- Function `*DataMaskingRulesClient.CreateOrUpdate` parameter(s) have been changed from `(context.Context, string, string, string, string, DataMaskingRule, *DataMaskingRulesClientCreateOrUpdateOptions)` to `(context.Context, string, string, string, DataMaskingPolicyName, string, DataMaskingRule, *DataMaskingRulesClientCreateOrUpdateOptions)` +- Function `*DataMaskingRulesClient.NewListByDatabasePager` parameter(s) have been changed from `(string, string, string, *DataMaskingRulesClientListByDatabaseOptions)` to `(string, string, string, DataMaskingPolicyName, *DataMaskingRulesClientListByDatabaseOptions)` +- Function `*ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient.CreateOrUpdate` parameter(s) have been changed from `(context.Context, string, string, string, VulnerabilityAssessmentName, string, VulnerabilityAssessmentPolicyBaselineName, DatabaseVulnerabilityAssessmentRuleBaseline, *ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClientCreateOrUpdateOptions)` to `(context.Context, string, string, string, VulnerabilityAssessmentName, string, VulnerabilityAssessmentPolicyBaselineName, DatabaseVulnerabilityAssessmentRuleBaselineAutoGenerated, *ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClientCreateOrUpdateOptions)` +- Function `*ManagedServerSecurityAlertPoliciesClient.BeginCreateOrUpdate` parameter(s) have been changed from `(context.Context, string, string, SecurityAlertPolicyName, ManagedServerSecurityAlertPolicy, *ManagedServerSecurityAlertPoliciesClientBeginCreateOrUpdateOptions)` to `(context.Context, string, string, SecurityAlertPolicyNameAutoGenerated, ManagedServerSecurityAlertPolicy, *ManagedServerSecurityAlertPoliciesClientBeginCreateOrUpdateOptions)` +- Function `*ManagedServerSecurityAlertPoliciesClient.Get` parameter(s) have been changed from `(context.Context, string, string, SecurityAlertPolicyName, *ManagedServerSecurityAlertPoliciesClientGetOptions)` to `(context.Context, string, string, SecurityAlertPolicyNameAutoGenerated, *ManagedServerSecurityAlertPoliciesClientGetOptions)` +- Function `*OutboundFirewallRulesClient.BeginCreateOrUpdate` parameter(s) have been changed from `(context.Context, string, string, string, OutboundFirewallRule, *OutboundFirewallRulesClientBeginCreateOrUpdateOptions)` to `(context.Context, string, string, string, *OutboundFirewallRulesClientBeginCreateOrUpdateOptions)` +- Function `*ServerDevOpsAuditSettingsClient.BeginCreateOrUpdate` parameter(s) have been changed from `(context.Context, string, string, string, ServerDevOpsAuditingSettings, *ServerDevOpsAuditSettingsClientBeginCreateOrUpdateOptions)` to `(context.Context, string, string, DevOpsAuditingSettingsName, ServerDevOpsAuditingSettings, *ServerDevOpsAuditSettingsClientBeginCreateOrUpdateOptions)` +- Function `*ServerDevOpsAuditSettingsClient.Get` parameter(s) have been changed from `(context.Context, string, string, string, *ServerDevOpsAuditSettingsClientGetOptions)` to `(context.Context, string, string, DevOpsAuditingSettingsName, *ServerDevOpsAuditSettingsClientGetOptions)` +- Function `*ServerSecurityAlertPoliciesClient.BeginCreateOrUpdate` parameter(s) have been changed from `(context.Context, string, string, SecurityAlertPolicyName, ServerSecurityAlertPolicy, *ServerSecurityAlertPoliciesClientBeginCreateOrUpdateOptions)` to `(context.Context, string, string, SecurityAlertPolicyNameAutoGenerated, ServerSecurityAlertPolicy, *ServerSecurityAlertPoliciesClientBeginCreateOrUpdateOptions)` +- Function `*ServerSecurityAlertPoliciesClient.Get` parameter(s) have been changed from `(context.Context, string, string, SecurityAlertPolicyName, *ServerSecurityAlertPoliciesClientGetOptions)` to `(context.Context, string, string, SecurityAlertPolicyNameAutoGenerated, *ServerSecurityAlertPoliciesClientGetOptions)` +- Type of `JobExecutionsClientListByAgentOptions.Skip` has been changed from `*int32` to `*int64` +- Type of `JobExecutionsClientListByAgentOptions.Top` has been changed from `*int32` to `*int64` +- Type of `JobExecutionsClientListByJobOptions.Skip` has been changed from `*int32` to `*int64` +- Type of `JobExecutionsClientListByJobOptions.Top` has been changed from `*int32` to `*int64` +- Type of `JobStepExecutionsClientListByJobExecutionOptions.Skip` has been changed from `*int32` to `*int64` +- Type of `JobStepExecutionsClientListByJobExecutionOptions.Top` has been changed from `*int32` to `*int64` +- Type of `JobTargetExecutionsClientListByJobExecutionOptions.Skip` has been changed from `*int32` to `*int64` +- Type of `JobTargetExecutionsClientListByJobExecutionOptions.Top` has been changed from `*int32` to `*int64` +- Type of `JobTargetExecutionsClientListByStepOptions.Skip` has been changed from `*int32` to `*int64` +- Type of `JobTargetExecutionsClientListByStepOptions.Top` has been changed from `*int32` to `*int64` +- Type of `ManagedDatabaseRestoreDetailsProperties.NumberOfFilesDetected` has been changed from `*int64` to `*int32` +- Type of `ManagedDatabaseRestoreDetailsProperties.PercentCompleted` has been changed from `*float64` to `*int32` +- Type of `ManagedDatabaseRestoreDetailsProperties.UnrestorableFiles` has been changed from `[]*string` to `[]*ManagedDatabaseRestoreDetailsUnrestorableFileProperties` +- Type of `ManagedDatabaseSecurityEventsClientListByDatabaseOptions.Skip` has been changed from `*int32` to `*int64` +- Type of `ManagedDatabaseSecurityEventsClientListByDatabaseOptions.Top` has been changed from `*int32` to `*int64` +- Type of `ManagedInstanceOperationSteps.StepsList` has been changed from `[]*UpsertManagedServerOperationStep` to `[]*UpsertManagedServerOperationStepWithEstimatesAndDuration` +- Type of `ManagedInstanceProperties.ProvisioningState` has been changed from `*ManagedInstancePropertiesProvisioningState` to `*ProvisioningState` +- Type of `ServerProperties.PublicNetworkAccess` has been changed from `*ServerNetworkAccessFlag` to `*ServerPublicNetworkAccessFlag` +- Enum `DNSRefreshConfigurationPropertiesStatus` has been removed +- Enum `ManagedInstancePropertiesProvisioningState` has been removed +- Enum `PrimaryAggregationType` has been removed +- Enum `ServiceObjectiveName` has been removed +- Enum `UnitDefinitionType` has been removed +- Enum `UnitType` has been removed +- Enum `UpsertManagedServerOperationStepStatus` has been removed +- Function `*ClientFactory.NewElasticPoolActivitiesClient` has been removed +- Function `*ClientFactory.NewElasticPoolDatabaseActivitiesClient` has been removed +- Function `*ClientFactory.NewServerCommunicationLinksClient` has been removed +- Function `*ClientFactory.NewServiceObjectivesClient` has been removed +- Function `*DatabasesClient.NewListMetricDefinitionsPager` has been removed +- Function `*DatabasesClient.NewListMetricsPager` has been removed +- Function `NewElasticPoolActivitiesClient` has been removed +- Function `*ElasticPoolActivitiesClient.NewListByElasticPoolPager` has been removed +- Function `NewElasticPoolDatabaseActivitiesClient` has been removed +- Function `*ElasticPoolDatabaseActivitiesClient.NewListByElasticPoolPager` has been removed +- Function `*ElasticPoolsClient.NewListMetricDefinitionsPager` has been removed +- Function `*ElasticPoolsClient.NewListMetricsPager` has been removed +- Function `*GeoBackupPoliciesClient.NewListByDatabasePager` has been removed +- Function `NewServerCommunicationLinksClient` has been removed +- Function `*ServerCommunicationLinksClient.BeginCreateOrUpdate` has been removed +- Function `*ServerCommunicationLinksClient.Delete` has been removed +- Function `*ServerCommunicationLinksClient.Get` has been removed +- Function `*ServerCommunicationLinksClient.NewListByServerPager` has been removed +- Function `NewServiceObjectivesClient` has been removed +- Function `*ServiceObjectivesClient.Get` has been removed +- Function `*ServiceObjectivesClient.NewListByServerPager` has been removed +- Operation `*ReplicationLinksClient.Delete` has been changed to LRO, use `*ReplicationLinksClient.BeginDelete` instead. +- Operation `*TransparentDataEncryptionsClient.CreateOrUpdate` has been changed to LRO, use `*TransparentDataEncryptionsClient.BeginCreateOrUpdate` instead. +- Operation `*VirtualClustersClient.UpdateDNSServers` has been changed to LRO, use `*VirtualClustersClient.BeginUpdateDNSServers` instead. +- Struct `DNSRefreshConfigurationProperties` has been removed +- Struct `ElasticPoolActivity` has been removed +- Struct `ElasticPoolActivityListResult` has been removed +- Struct `ElasticPoolActivityProperties` has been removed +- Struct `ElasticPoolDatabaseActivity` has been removed +- Struct `ElasticPoolDatabaseActivityListResult` has been removed +- Struct `ElasticPoolDatabaseActivityProperties` has been removed +- Struct `Metric` has been removed +- Struct `MetricAvailability` has been removed +- Struct `MetricDefinition` has been removed +- Struct `MetricDefinitionListResult` has been removed +- Struct `MetricListResult` has been removed +- Struct `MetricName` has been removed +- Struct `MetricValue` has been removed +- Struct `OperationImpact` has been removed +- Struct `ServerCommunicationLink` has been removed +- Struct `ServerCommunicationLinkListResult` has been removed +- Struct `ServerCommunicationLinkProperties` has been removed +- Struct `ServiceObjective` has been removed +- Struct `ServiceObjectiveListResult` has been removed +- Struct `ServiceObjectiveProperties` has been removed +- Struct `SloUsageMetric` has been removed +- Struct `UpdateManagedInstanceDNSServersOperation` has been removed +- Struct `UpsertManagedServerOperationStep` has been removed +- Field `DatabaseVulnerabilityAssessmentRuleBaseline` of struct `ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClientCreateOrUpdateResponse` has been removed +- Field `DatabaseVulnerabilityAssessmentRuleBaseline` of struct `ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClientGetResponse` has been removed +- Field `CurrentValue`, `DisplayName`, `Limit`, `NextResetTime`, `ResourceName`, `Unit` of struct `ServerUsage` has been removed +- Field `Family`, `MaintenanceConfigurationID` of struct `VirtualClusterProperties` has been removed + +### Features Added + +- New value `ManagedDatabaseStatusDbCopying`, `ManagedDatabaseStatusDbMoving`, `ManagedDatabaseStatusStarting`, `ManagedDatabaseStatusStopped`, `ManagedDatabaseStatusStopping` added to enum type `ManagedDatabaseStatus` +- New value `OperationModeExport`, `OperationModeImport` added to enum type `OperationMode` +- New value `ReplicationLinkTypeSTANDBY` added to enum type `ReplicationLinkType` +- New value `SecondaryTypeStandby` added to enum type `SecondaryType` +- New value `StorageCapabilityStorageAccountTypeGZRS` added to enum type `StorageCapabilityStorageAccountType` +- New enum type `AlwaysEncryptedEnclaveType` with values `AlwaysEncryptedEnclaveTypeDefault`, `AlwaysEncryptedEnclaveTypeVBS` +- New enum type `AvailabilityZoneType` with values `AvailabilityZoneTypeNoPreference`, `AvailabilityZoneTypeOne`, `AvailabilityZoneTypeThree`, `AvailabilityZoneTypeTwo` +- New enum type `BaselineName` with values `BaselineNameDefault` +- New enum type `DNSRefreshOperationStatus` with values `DNSRefreshOperationStatusFailed`, `DNSRefreshOperationStatusInProgress`, `DNSRefreshOperationStatusSucceeded` +- New enum type `DataMaskingPolicyName` with values `DataMaskingPolicyNameDefault` +- New enum type `DatabaseKeyType` with values `DatabaseKeyTypeAzureKeyVault` +- New enum type `DevOpsAuditingSettingsName` with values `DevOpsAuditingSettingsNameDefault` +- New enum type `DtcName` with values `DtcNameCurrent` +- New enum type `ExternalGovernanceStatus` with values `ExternalGovernanceStatusDisabled`, `ExternalGovernanceStatusEnabled` +- New enum type `InstanceRole` with values `InstanceRolePrimary`, `InstanceRoleSecondary` +- New enum type `ManagedLedgerDigestUploadsName` with values `ManagedLedgerDigestUploadsNameCurrent` +- New enum type `ManagedLedgerDigestUploadsState` with values `ManagedLedgerDigestUploadsStateDisabled`, `ManagedLedgerDigestUploadsStateEnabled` +- New enum type `MoveOperationMode` with values `MoveOperationModeCopy`, `MoveOperationModeMove` +- New enum type `Phase` with values `PhaseCatchup`, `PhaseCopying`, `PhaseCutoverInProgress`, `PhaseWaitingForCutover` +- New enum type `RoleChangeType` with values `RoleChangeTypeForced`, `RoleChangeTypePlanned` +- New enum type `RuleSeverity` with values `RuleSeverityHigh`, `RuleSeverityInformational`, `RuleSeverityLow`, `RuleSeverityMedium`, `RuleSeverityObsolete` +- New enum type `RuleStatus` with values `RuleStatusFinding`, `RuleStatusInternalError`, `RuleStatusNonFinding` +- New enum type `RuleType` with values `RuleTypeBaselineExpected`, `RuleTypeBinary`, `RuleTypeNegativeList`, `RuleTypePositiveList` +- New enum type `SQLVulnerabilityAssessmentName` with values `SQLVulnerabilityAssessmentNameDefault` +- New enum type `SQLVulnerabilityAssessmentState` with values `SQLVulnerabilityAssessmentStateDisabled`, `SQLVulnerabilityAssessmentStateEnabled` +- New enum type `SecondaryInstanceType` with values `SecondaryInstanceTypeGeo`, `SecondaryInstanceTypeStandby` +- New enum type `SecurityAlertPolicyNameAutoGenerated` with values `SecurityAlertPolicyNameAutoGeneratedDefault` +- New enum type `ServerConfigurationOptionName` with values `ServerConfigurationOptionNameAllowPolybaseExport` +- New enum type `ServerPublicNetworkAccessFlag` with values `ServerPublicNetworkAccessFlagDisabled`, `ServerPublicNetworkAccessFlagEnabled`, `ServerPublicNetworkAccessFlagSecuredByPerimeter` +- New enum type `StartStopScheduleName` with values `StartStopScheduleNameDefault` +- New enum type `Status` with values `StatusCanceled`, `StatusCompleted`, `StatusFailed`, `StatusInProgress`, `StatusNotStarted`, `StatusSlowedDown` +- New function `*ClientFactory.NewDatabaseEncryptionProtectorsClient() *DatabaseEncryptionProtectorsClient` +- New function `*ClientFactory.NewDatabaseSQLVulnerabilityAssessmentBaselinesClient() *DatabaseSQLVulnerabilityAssessmentBaselinesClient` +- New function `*ClientFactory.NewDatabaseSQLVulnerabilityAssessmentExecuteScanClient() *DatabaseSQLVulnerabilityAssessmentExecuteScanClient` +- New function `*ClientFactory.NewDatabaseSQLVulnerabilityAssessmentRuleBaselinesClient() *DatabaseSQLVulnerabilityAssessmentRuleBaselinesClient` +- New function `*ClientFactory.NewDatabaseSQLVulnerabilityAssessmentScanResultClient() *DatabaseSQLVulnerabilityAssessmentScanResultClient` +- New function `*ClientFactory.NewDatabaseSQLVulnerabilityAssessmentScansClient() *DatabaseSQLVulnerabilityAssessmentScansClient` +- New function `*ClientFactory.NewDatabaseSQLVulnerabilityAssessmentsSettingsClient() *DatabaseSQLVulnerabilityAssessmentsSettingsClient` +- New function `*ClientFactory.NewManagedDatabaseAdvancedThreatProtectionSettingsClient() *ManagedDatabaseAdvancedThreatProtectionSettingsClient` +- New function `*ClientFactory.NewManagedDatabaseMoveOperationsClient() *ManagedDatabaseMoveOperationsClient` +- New function `*ClientFactory.NewManagedInstanceAdvancedThreatProtectionSettingsClient() *ManagedInstanceAdvancedThreatProtectionSettingsClient` +- New function `*ClientFactory.NewManagedInstanceDtcsClient() *ManagedInstanceDtcsClient` +- New function `*ClientFactory.NewManagedLedgerDigestUploadsClient() *ManagedLedgerDigestUploadsClient` +- New function `*ClientFactory.NewManagedServerDNSAliasesClient() *ManagedServerDNSAliasesClient` +- New function `*ClientFactory.NewNetworkSecurityPerimeterConfigurationsClient() *NetworkSecurityPerimeterConfigurationsClient` +- New function `*ClientFactory.NewServerConfigurationOptionsClient() *ServerConfigurationOptionsClient` +- New function `*ClientFactory.NewStartStopManagedInstanceSchedulesClient() *StartStopManagedInstanceSchedulesClient` +- New function `*ClientFactory.NewSynapseLinkWorkspacesClient() *SynapseLinkWorkspacesClient` +- New function `*ClientFactory.NewVulnerabilityAssessmentBaselineClient() *VulnerabilityAssessmentBaselineClient` +- New function `*ClientFactory.NewVulnerabilityAssessmentBaselinesClient() *VulnerabilityAssessmentBaselinesClient` +- New function `*ClientFactory.NewVulnerabilityAssessmentExecuteScanClient() *VulnerabilityAssessmentExecuteScanClient` +- New function `*ClientFactory.NewVulnerabilityAssessmentRuleBaselineClient() *VulnerabilityAssessmentRuleBaselineClient` +- New function `*ClientFactory.NewVulnerabilityAssessmentRuleBaselinesClient() *VulnerabilityAssessmentRuleBaselinesClient` +- New function `*ClientFactory.NewVulnerabilityAssessmentScanResultClient() *VulnerabilityAssessmentScanResultClient` +- New function `*ClientFactory.NewVulnerabilityAssessmentScansClient() *VulnerabilityAssessmentScansClient` +- New function `*ClientFactory.NewVulnerabilityAssessmentsClient() *VulnerabilityAssessmentsClient` +- New function `*ClientFactory.NewVulnerabilityAssessmentsSettingsClient() *VulnerabilityAssessmentsSettingsClient` +- New function `NewDatabaseEncryptionProtectorsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*DatabaseEncryptionProtectorsClient, error)` +- New function `*DatabaseEncryptionProtectorsClient.BeginRevalidate(context.Context, string, string, string, EncryptionProtectorName, *DatabaseEncryptionProtectorsClientBeginRevalidateOptions) (*runtime.Poller[DatabaseEncryptionProtectorsClientRevalidateResponse], error)` +- New function `*DatabaseEncryptionProtectorsClient.BeginRevert(context.Context, string, string, string, EncryptionProtectorName, *DatabaseEncryptionProtectorsClientBeginRevertOptions) (*runtime.Poller[DatabaseEncryptionProtectorsClientRevertResponse], error)` +- New function `NewDatabaseSQLVulnerabilityAssessmentBaselinesClient(string, azcore.TokenCredential, *arm.ClientOptions) (*DatabaseSQLVulnerabilityAssessmentBaselinesClient, error)` +- New function `*DatabaseSQLVulnerabilityAssessmentBaselinesClient.CreateOrUpdate(context.Context, string, string, string, VulnerabilityAssessmentName, BaselineName, DatabaseSQLVulnerabilityAssessmentRuleBaselineListInput, *DatabaseSQLVulnerabilityAssessmentBaselinesClientCreateOrUpdateOptions) (DatabaseSQLVulnerabilityAssessmentBaselinesClientCreateOrUpdateResponse, error)` +- New function `*DatabaseSQLVulnerabilityAssessmentBaselinesClient.Get(context.Context, string, string, string, VulnerabilityAssessmentName, BaselineName, *DatabaseSQLVulnerabilityAssessmentBaselinesClientGetOptions) (DatabaseSQLVulnerabilityAssessmentBaselinesClientGetResponse, error)` +- New function `*DatabaseSQLVulnerabilityAssessmentBaselinesClient.NewListBySQLVulnerabilityAssessmentPager(string, string, string, VulnerabilityAssessmentName, *DatabaseSQLVulnerabilityAssessmentBaselinesClientListBySQLVulnerabilityAssessmentOptions) *runtime.Pager[DatabaseSQLVulnerabilityAssessmentBaselinesClientListBySQLVulnerabilityAssessmentResponse]` +- New function `NewDatabaseSQLVulnerabilityAssessmentExecuteScanClient(string, azcore.TokenCredential, *arm.ClientOptions) (*DatabaseSQLVulnerabilityAssessmentExecuteScanClient, error)` +- New function `*DatabaseSQLVulnerabilityAssessmentExecuteScanClient.BeginExecute(context.Context, string, string, string, VulnerabilityAssessmentName, *DatabaseSQLVulnerabilityAssessmentExecuteScanClientBeginExecuteOptions) (*runtime.Poller[DatabaseSQLVulnerabilityAssessmentExecuteScanClientExecuteResponse], error)` +- New function `NewDatabaseSQLVulnerabilityAssessmentRuleBaselinesClient(string, azcore.TokenCredential, *arm.ClientOptions) (*DatabaseSQLVulnerabilityAssessmentRuleBaselinesClient, error)` +- New function `*DatabaseSQLVulnerabilityAssessmentRuleBaselinesClient.CreateOrUpdate(context.Context, string, string, string, VulnerabilityAssessmentName, BaselineName, string, DatabaseSQLVulnerabilityAssessmentRuleBaselineInput, *DatabaseSQLVulnerabilityAssessmentRuleBaselinesClientCreateOrUpdateOptions) (DatabaseSQLVulnerabilityAssessmentRuleBaselinesClientCreateOrUpdateResponse, error)` +- New function `*DatabaseSQLVulnerabilityAssessmentRuleBaselinesClient.Delete(context.Context, string, string, string, VulnerabilityAssessmentName, BaselineName, string, *DatabaseSQLVulnerabilityAssessmentRuleBaselinesClientDeleteOptions) (DatabaseSQLVulnerabilityAssessmentRuleBaselinesClientDeleteResponse, error)` +- New function `*DatabaseSQLVulnerabilityAssessmentRuleBaselinesClient.Get(context.Context, string, string, string, VulnerabilityAssessmentName, BaselineName, string, *DatabaseSQLVulnerabilityAssessmentRuleBaselinesClientGetOptions) (DatabaseSQLVulnerabilityAssessmentRuleBaselinesClientGetResponse, error)` +- New function `*DatabaseSQLVulnerabilityAssessmentRuleBaselinesClient.NewListByBaselinePager(string, string, string, VulnerabilityAssessmentName, BaselineName, *DatabaseSQLVulnerabilityAssessmentRuleBaselinesClientListByBaselineOptions) *runtime.Pager[DatabaseSQLVulnerabilityAssessmentRuleBaselinesClientListByBaselineResponse]` +- New function `NewDatabaseSQLVulnerabilityAssessmentScanResultClient(string, azcore.TokenCredential, *arm.ClientOptions) (*DatabaseSQLVulnerabilityAssessmentScanResultClient, error)` +- New function `*DatabaseSQLVulnerabilityAssessmentScanResultClient.Get(context.Context, string, string, string, SQLVulnerabilityAssessmentName, string, string, *DatabaseSQLVulnerabilityAssessmentScanResultClientGetOptions) (DatabaseSQLVulnerabilityAssessmentScanResultClientGetResponse, error)` +- New function `*DatabaseSQLVulnerabilityAssessmentScanResultClient.NewListByScanPager(string, string, string, SQLVulnerabilityAssessmentName, string, *DatabaseSQLVulnerabilityAssessmentScanResultClientListByScanOptions) *runtime.Pager[DatabaseSQLVulnerabilityAssessmentScanResultClientListByScanResponse]` +- New function `NewDatabaseSQLVulnerabilityAssessmentScansClient(string, azcore.TokenCredential, *arm.ClientOptions) (*DatabaseSQLVulnerabilityAssessmentScansClient, error)` +- New function `*DatabaseSQLVulnerabilityAssessmentScansClient.Get(context.Context, string, string, string, VulnerabilityAssessmentName, string, *DatabaseSQLVulnerabilityAssessmentScansClientGetOptions) (DatabaseSQLVulnerabilityAssessmentScansClientGetResponse, error)` +- New function `*DatabaseSQLVulnerabilityAssessmentScansClient.NewListBySQLVulnerabilityAssessmentsPager(string, string, string, VulnerabilityAssessmentName, *DatabaseSQLVulnerabilityAssessmentScansClientListBySQLVulnerabilityAssessmentsOptions) *runtime.Pager[DatabaseSQLVulnerabilityAssessmentScansClientListBySQLVulnerabilityAssessmentsResponse]` +- New function `NewDatabaseSQLVulnerabilityAssessmentsSettingsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*DatabaseSQLVulnerabilityAssessmentsSettingsClient, error)` +- New function `*DatabaseSQLVulnerabilityAssessmentsSettingsClient.Get(context.Context, string, string, string, SQLVulnerabilityAssessmentName, *DatabaseSQLVulnerabilityAssessmentsSettingsClientGetOptions) (DatabaseSQLVulnerabilityAssessmentsSettingsClientGetResponse, error)` +- New function `*DatabaseSQLVulnerabilityAssessmentsSettingsClient.NewListByDatabasePager(string, string, string, *DatabaseSQLVulnerabilityAssessmentsSettingsClientListByDatabaseOptions) *runtime.Pager[DatabaseSQLVulnerabilityAssessmentsSettingsClientListByDatabaseResponse]` +- New function `*DistributedAvailabilityGroupsClient.BeginSetRole(context.Context, string, string, string, DistributedAvailabilityGroupSetRole, *DistributedAvailabilityGroupsClientBeginSetRoleOptions) (*runtime.Poller[DistributedAvailabilityGroupsClientSetRoleResponse], error)` +- New function `*FailoverGroupsClient.BeginTryPlannedBeforeForcedFailover(context.Context, string, string, string, *FailoverGroupsClientBeginTryPlannedBeforeForcedFailoverOptions) (*runtime.Poller[FailoverGroupsClientTryPlannedBeforeForcedFailoverResponse], error)` +- New function `*GeoBackupPoliciesClient.NewListPager(string, string, string, *GeoBackupPoliciesClientListOptions) *runtime.Pager[GeoBackupPoliciesClientListResponse]` +- New function `NewManagedDatabaseAdvancedThreatProtectionSettingsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*ManagedDatabaseAdvancedThreatProtectionSettingsClient, error)` +- New function `*ManagedDatabaseAdvancedThreatProtectionSettingsClient.CreateOrUpdate(context.Context, string, string, string, AdvancedThreatProtectionName, ManagedDatabaseAdvancedThreatProtection, *ManagedDatabaseAdvancedThreatProtectionSettingsClientCreateOrUpdateOptions) (ManagedDatabaseAdvancedThreatProtectionSettingsClientCreateOrUpdateResponse, error)` +- New function `*ManagedDatabaseAdvancedThreatProtectionSettingsClient.Get(context.Context, string, string, string, AdvancedThreatProtectionName, *ManagedDatabaseAdvancedThreatProtectionSettingsClientGetOptions) (ManagedDatabaseAdvancedThreatProtectionSettingsClientGetResponse, error)` +- New function `*ManagedDatabaseAdvancedThreatProtectionSettingsClient.NewListByDatabasePager(string, string, string, *ManagedDatabaseAdvancedThreatProtectionSettingsClientListByDatabaseOptions) *runtime.Pager[ManagedDatabaseAdvancedThreatProtectionSettingsClientListByDatabaseResponse]` +- New function `NewManagedDatabaseMoveOperationsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*ManagedDatabaseMoveOperationsClient, error)` +- New function `*ManagedDatabaseMoveOperationsClient.Get(context.Context, string, string, string, *ManagedDatabaseMoveOperationsClientGetOptions) (ManagedDatabaseMoveOperationsClientGetResponse, error)` +- New function `*ManagedDatabaseMoveOperationsClient.NewListByLocationPager(string, string, *ManagedDatabaseMoveOperationsClientListByLocationOptions) *runtime.Pager[ManagedDatabaseMoveOperationsClientListByLocationResponse]` +- New function `*ManagedDatabaseSensitivityLabelsClient.NewListByDatabasePager(string, string, string, *ManagedDatabaseSensitivityLabelsClientListByDatabaseOptions) *runtime.Pager[ManagedDatabaseSensitivityLabelsClientListByDatabaseResponse]` +- New function `*ManagedDatabasesClient.BeginCancelMove(context.Context, string, string, string, ManagedDatabaseMoveDefinition, *ManagedDatabasesClientBeginCancelMoveOptions) (*runtime.Poller[ManagedDatabasesClientCancelMoveResponse], error)` +- New function `*ManagedDatabasesClient.BeginCompleteMove(context.Context, string, string, string, ManagedDatabaseMoveDefinition, *ManagedDatabasesClientBeginCompleteMoveOptions) (*runtime.Poller[ManagedDatabasesClientCompleteMoveResponse], error)` +- New function `*ManagedDatabasesClient.BeginStartMove(context.Context, string, string, string, ManagedDatabaseStartMoveDefinition, *ManagedDatabasesClientBeginStartMoveOptions) (*runtime.Poller[ManagedDatabasesClientStartMoveResponse], error)` +- New function `NewManagedInstanceAdvancedThreatProtectionSettingsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*ManagedInstanceAdvancedThreatProtectionSettingsClient, error)` +- New function `*ManagedInstanceAdvancedThreatProtectionSettingsClient.BeginCreateOrUpdate(context.Context, string, string, AdvancedThreatProtectionName, ManagedInstanceAdvancedThreatProtection, *ManagedInstanceAdvancedThreatProtectionSettingsClientBeginCreateOrUpdateOptions) (*runtime.Poller[ManagedInstanceAdvancedThreatProtectionSettingsClientCreateOrUpdateResponse], error)` +- New function `*ManagedInstanceAdvancedThreatProtectionSettingsClient.Get(context.Context, string, string, AdvancedThreatProtectionName, *ManagedInstanceAdvancedThreatProtectionSettingsClientGetOptions) (ManagedInstanceAdvancedThreatProtectionSettingsClientGetResponse, error)` +- New function `*ManagedInstanceAdvancedThreatProtectionSettingsClient.NewListByInstancePager(string, string, *ManagedInstanceAdvancedThreatProtectionSettingsClientListByInstanceOptions) *runtime.Pager[ManagedInstanceAdvancedThreatProtectionSettingsClientListByInstanceResponse]` +- New function `NewManagedInstanceDtcsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*ManagedInstanceDtcsClient, error)` +- New function `*ManagedInstanceDtcsClient.BeginCreateOrUpdate(context.Context, string, string, DtcName, ManagedInstanceDtc, *ManagedInstanceDtcsClientBeginCreateOrUpdateOptions) (*runtime.Poller[ManagedInstanceDtcsClientCreateOrUpdateResponse], error)` +- New function `*ManagedInstanceDtcsClient.Get(context.Context, string, string, DtcName, *ManagedInstanceDtcsClientGetOptions) (ManagedInstanceDtcsClientGetResponse, error)` +- New function `*ManagedInstanceDtcsClient.NewListByManagedInstancePager(string, string, *ManagedInstanceDtcsClientListByManagedInstanceOptions) *runtime.Pager[ManagedInstanceDtcsClientListByManagedInstanceResponse]` +- New function `*ManagedInstanceLongTermRetentionPoliciesClient.BeginDelete(context.Context, string, string, string, ManagedInstanceLongTermRetentionPolicyName, *ManagedInstanceLongTermRetentionPoliciesClientBeginDeleteOptions) (*runtime.Poller[ManagedInstanceLongTermRetentionPoliciesClientDeleteResponse], error)` +- New function `*ManagedInstancesClient.NewListOutboundNetworkDependenciesByManagedInstancePager(string, string, *ManagedInstancesClientListOutboundNetworkDependenciesByManagedInstanceOptions) *runtime.Pager[ManagedInstancesClientListOutboundNetworkDependenciesByManagedInstanceResponse]` +- New function `*ManagedInstancesClient.BeginStart(context.Context, string, string, *ManagedInstancesClientBeginStartOptions) (*runtime.Poller[ManagedInstancesClientStartResponse], error)` +- New function `*ManagedInstancesClient.BeginStop(context.Context, string, string, *ManagedInstancesClientBeginStopOptions) (*runtime.Poller[ManagedInstancesClientStopResponse], error)` +- New function `NewManagedLedgerDigestUploadsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*ManagedLedgerDigestUploadsClient, error)` +- New function `*ManagedLedgerDigestUploadsClient.BeginCreateOrUpdate(context.Context, string, string, string, ManagedLedgerDigestUploadsName, ManagedLedgerDigestUploads, *ManagedLedgerDigestUploadsClientBeginCreateOrUpdateOptions) (*runtime.Poller[ManagedLedgerDigestUploadsClientCreateOrUpdateResponse], error)` +- New function `*ManagedLedgerDigestUploadsClient.BeginDisable(context.Context, string, string, string, ManagedLedgerDigestUploadsName, *ManagedLedgerDigestUploadsClientBeginDisableOptions) (*runtime.Poller[ManagedLedgerDigestUploadsClientDisableResponse], error)` +- New function `*ManagedLedgerDigestUploadsClient.Get(context.Context, string, string, string, ManagedLedgerDigestUploadsName, *ManagedLedgerDigestUploadsClientGetOptions) (ManagedLedgerDigestUploadsClientGetResponse, error)` +- New function `*ManagedLedgerDigestUploadsClient.NewListByDatabasePager(string, string, string, *ManagedLedgerDigestUploadsClientListByDatabaseOptions) *runtime.Pager[ManagedLedgerDigestUploadsClientListByDatabaseResponse]` +- New function `NewManagedServerDNSAliasesClient(string, azcore.TokenCredential, *arm.ClientOptions) (*ManagedServerDNSAliasesClient, error)` +- New function `*ManagedServerDNSAliasesClient.BeginAcquire(context.Context, string, string, string, ManagedServerDNSAliasAcquisition, *ManagedServerDNSAliasesClientBeginAcquireOptions) (*runtime.Poller[ManagedServerDNSAliasesClientAcquireResponse], error)` +- New function `*ManagedServerDNSAliasesClient.BeginCreateOrUpdate(context.Context, string, string, string, ManagedServerDNSAliasCreation, *ManagedServerDNSAliasesClientBeginCreateOrUpdateOptions) (*runtime.Poller[ManagedServerDNSAliasesClientCreateOrUpdateResponse], error)` +- New function `*ManagedServerDNSAliasesClient.BeginDelete(context.Context, string, string, string, *ManagedServerDNSAliasesClientBeginDeleteOptions) (*runtime.Poller[ManagedServerDNSAliasesClientDeleteResponse], error)` +- New function `*ManagedServerDNSAliasesClient.Get(context.Context, string, string, string, *ManagedServerDNSAliasesClientGetOptions) (ManagedServerDNSAliasesClientGetResponse, error)` +- New function `*ManagedServerDNSAliasesClient.NewListByManagedInstancePager(string, string, *ManagedServerDNSAliasesClientListByManagedInstanceOptions) *runtime.Pager[ManagedServerDNSAliasesClientListByManagedInstanceResponse]` +- New function `*SensitivityLabelsClient.NewListByDatabasePager(string, string, string, *SensitivityLabelsClientListByDatabaseOptions) *runtime.Pager[SensitivityLabelsClientListByDatabaseResponse]` +- New function `NewServerConfigurationOptionsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*ServerConfigurationOptionsClient, error)` +- New function `*ServerConfigurationOptionsClient.BeginCreateOrUpdate(context.Context, string, string, ServerConfigurationOptionName, ServerConfigurationOption, *ServerConfigurationOptionsClientBeginCreateOrUpdateOptions) (*runtime.Poller[ServerConfigurationOptionsClientCreateOrUpdateResponse], error)` +- New function `*ServerConfigurationOptionsClient.Get(context.Context, string, string, ServerConfigurationOptionName, *ServerConfigurationOptionsClientGetOptions) (ServerConfigurationOptionsClientGetResponse, error)` +- New function `*ServerConfigurationOptionsClient.NewListByManagedInstancePager(string, string, *ServerConfigurationOptionsClientListByManagedInstanceOptions) *runtime.Pager[ServerConfigurationOptionsClientListByManagedInstanceResponse]` +- New function `*ServersClient.BeginRefreshStatus(context.Context, string, string, *ServersClientBeginRefreshStatusOptions) (*runtime.Poller[ServersClientRefreshStatusResponse], error)` +- New function `NewStartStopManagedInstanceSchedulesClient(string, azcore.TokenCredential, *arm.ClientOptions) (*StartStopManagedInstanceSchedulesClient, error)` +- New function `*StartStopManagedInstanceSchedulesClient.CreateOrUpdate(context.Context, string, string, StartStopScheduleName, StartStopManagedInstanceSchedule, *StartStopManagedInstanceSchedulesClientCreateOrUpdateOptions) (StartStopManagedInstanceSchedulesClientCreateOrUpdateResponse, error)` +- New function `*StartStopManagedInstanceSchedulesClient.Delete(context.Context, string, string, StartStopScheduleName, *StartStopManagedInstanceSchedulesClientDeleteOptions) (StartStopManagedInstanceSchedulesClientDeleteResponse, error)` +- New function `*StartStopManagedInstanceSchedulesClient.Get(context.Context, string, string, StartStopScheduleName, *StartStopManagedInstanceSchedulesClientGetOptions) (StartStopManagedInstanceSchedulesClientGetResponse, error)` +- New function `*StartStopManagedInstanceSchedulesClient.NewListByInstancePager(string, string, *StartStopManagedInstanceSchedulesClientListByInstanceOptions) *runtime.Pager[StartStopManagedInstanceSchedulesClientListByInstanceResponse]` +- New function `NewSynapseLinkWorkspacesClient(string, azcore.TokenCredential, *arm.ClientOptions) (*SynapseLinkWorkspacesClient, error)` +- New function `*SynapseLinkWorkspacesClient.NewListByDatabasePager(string, string, string, *SynapseLinkWorkspacesClientListByDatabaseOptions) *runtime.Pager[SynapseLinkWorkspacesClientListByDatabaseResponse]` +- New function `NewVulnerabilityAssessmentBaselineClient(string, azcore.TokenCredential, *arm.ClientOptions) (*VulnerabilityAssessmentBaselineClient, error)` +- New function `*VulnerabilityAssessmentBaselineClient.Get(context.Context, string, string, VulnerabilityAssessmentName, BaselineName, *VulnerabilityAssessmentBaselineClientGetOptions) (VulnerabilityAssessmentBaselineClientGetResponse, error)` +- New function `*VulnerabilityAssessmentBaselineClient.NewListBySQLVulnerabilityAssessmentPager(string, string, VulnerabilityAssessmentName, *VulnerabilityAssessmentBaselineClientListBySQLVulnerabilityAssessmentOptions) *runtime.Pager[VulnerabilityAssessmentBaselineClientListBySQLVulnerabilityAssessmentResponse]` +- New function `NewVulnerabilityAssessmentBaselinesClient(string, azcore.TokenCredential, *arm.ClientOptions) (*VulnerabilityAssessmentBaselinesClient, error)` +- New function `*VulnerabilityAssessmentBaselinesClient.CreateOrUpdate(context.Context, string, string, VulnerabilityAssessmentName, BaselineName, DatabaseSQLVulnerabilityAssessmentRuleBaselineListInput, *VulnerabilityAssessmentBaselinesClientCreateOrUpdateOptions) (VulnerabilityAssessmentBaselinesClientCreateOrUpdateResponse, error)` +- New function `NewVulnerabilityAssessmentExecuteScanClient(string, azcore.TokenCredential, *arm.ClientOptions) (*VulnerabilityAssessmentExecuteScanClient, error)` +- New function `*VulnerabilityAssessmentExecuteScanClient.BeginExecute(context.Context, string, string, VulnerabilityAssessmentName, *VulnerabilityAssessmentExecuteScanClientBeginExecuteOptions) (*runtime.Poller[VulnerabilityAssessmentExecuteScanClientExecuteResponse], error)` +- New function `NewVulnerabilityAssessmentRuleBaselineClient(string, azcore.TokenCredential, *arm.ClientOptions) (*VulnerabilityAssessmentRuleBaselineClient, error)` +- New function `*VulnerabilityAssessmentRuleBaselineClient.CreateOrUpdate(context.Context, string, string, VulnerabilityAssessmentName, BaselineName, string, DatabaseSQLVulnerabilityAssessmentRuleBaselineInput, *VulnerabilityAssessmentRuleBaselineClientCreateOrUpdateOptions) (VulnerabilityAssessmentRuleBaselineClientCreateOrUpdateResponse, error)` +- New function `*VulnerabilityAssessmentRuleBaselineClient.Get(context.Context, string, string, VulnerabilityAssessmentName, BaselineName, string, *VulnerabilityAssessmentRuleBaselineClientGetOptions) (VulnerabilityAssessmentRuleBaselineClientGetResponse, error)` +- New function `*VulnerabilityAssessmentRuleBaselineClient.NewListByBaselinePager(string, string, VulnerabilityAssessmentName, BaselineName, *VulnerabilityAssessmentRuleBaselineClientListByBaselineOptions) *runtime.Pager[VulnerabilityAssessmentRuleBaselineClientListByBaselineResponse]` +- New function `NewVulnerabilityAssessmentRuleBaselinesClient(string, azcore.TokenCredential, *arm.ClientOptions) (*VulnerabilityAssessmentRuleBaselinesClient, error)` +- New function `*VulnerabilityAssessmentRuleBaselinesClient.Delete(context.Context, string, string, VulnerabilityAssessmentName, BaselineName, string, *VulnerabilityAssessmentRuleBaselinesClientDeleteOptions) (VulnerabilityAssessmentRuleBaselinesClientDeleteResponse, error)` +- New function `NewVulnerabilityAssessmentScanResultClient(string, azcore.TokenCredential, *arm.ClientOptions) (*VulnerabilityAssessmentScanResultClient, error)` +- New function `*VulnerabilityAssessmentScanResultClient.Get(context.Context, string, string, SQLVulnerabilityAssessmentName, string, string, *VulnerabilityAssessmentScanResultClientGetOptions) (VulnerabilityAssessmentScanResultClientGetResponse, error)` +- New function `*VulnerabilityAssessmentScanResultClient.NewListByScanPager(string, string, SQLVulnerabilityAssessmentName, string, *VulnerabilityAssessmentScanResultClientListByScanOptions) *runtime.Pager[VulnerabilityAssessmentScanResultClientListByScanResponse]` +- New function `NewVulnerabilityAssessmentScansClient(string, azcore.TokenCredential, *arm.ClientOptions) (*VulnerabilityAssessmentScansClient, error)` +- New function `*VulnerabilityAssessmentScansClient.Get(context.Context, string, string, VulnerabilityAssessmentName, string, *VulnerabilityAssessmentScansClientGetOptions) (VulnerabilityAssessmentScansClientGetResponse, error)` +- New function `*VulnerabilityAssessmentScansClient.NewListBySQLVulnerabilityAssessmentsPager(string, string, VulnerabilityAssessmentName, *VulnerabilityAssessmentScansClientListBySQLVulnerabilityAssessmentsOptions) *runtime.Pager[VulnerabilityAssessmentScansClientListBySQLVulnerabilityAssessmentsResponse]` +- New function `NewVulnerabilityAssessmentsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*VulnerabilityAssessmentsClient, error)` +- New function `*VulnerabilityAssessmentsClient.Delete(context.Context, string, string, VulnerabilityAssessmentName, *VulnerabilityAssessmentsClientDeleteOptions) (VulnerabilityAssessmentsClientDeleteResponse, error)` +- New function `NewVulnerabilityAssessmentsSettingsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*VulnerabilityAssessmentsSettingsClient, error)` +- New function `*VulnerabilityAssessmentsSettingsClient.CreateOrUpdate(context.Context, string, string, VulnerabilityAssessmentName, VulnerabilityAssessment, *VulnerabilityAssessmentsSettingsClientCreateOrUpdateOptions) (VulnerabilityAssessmentsSettingsClientCreateOrUpdateResponse, error)` +- New function `*VulnerabilityAssessmentsSettingsClient.Get(context.Context, string, string, SQLVulnerabilityAssessmentName, *VulnerabilityAssessmentsSettingsClientGetOptions) (VulnerabilityAssessmentsSettingsClientGetResponse, error)` +- New function `*VulnerabilityAssessmentsSettingsClient.NewListByServerPager(string, string, *VulnerabilityAssessmentsSettingsClientListByServerOptions) *runtime.Pager[VulnerabilityAssessmentsSettingsClientListByServerResponse]` +- New function `NewNetworkSecurityPerimeterConfigurationsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*NetworkSecurityPerimeterConfigurationsClient, error)` +- New function `*NetworkSecurityPerimeterConfigurationsClient.Get(context.Context, string, string, string, *NetworkSecurityPerimeterConfigurationsClientGetOptions) (NetworkSecurityPerimeterConfigurationsClientGetResponse, error)` +- New function `*NetworkSecurityPerimeterConfigurationsClient.NewListByServerPager(string, string, *NetworkSecurityPerimeterConfigurationsClientListByServerOptions) *runtime.Pager[NetworkSecurityPerimeterConfigurationsClientListByServerResponse]` +- New function `*NetworkSecurityPerimeterConfigurationsClient.BeginReconcile(context.Context, string, string, string, *NetworkSecurityPerimeterConfigurationsClientBeginReconcileOptions) (*runtime.Poller[NetworkSecurityPerimeterConfigurationsClientReconcileResponse], error)` +- New struct `Baseline` +- New struct `BaselineAdjustedResult` +- New struct `BenchmarkReference` +- New struct `DatabaseKey` +- New struct `DatabaseSQLVulnerabilityAssessmentBaselineSet` +- New struct `DatabaseSQLVulnerabilityAssessmentBaselineSetListResult` +- New struct `DatabaseSQLVulnerabilityAssessmentBaselineSetProperties` +- New struct `DatabaseSQLVulnerabilityAssessmentRuleBaseline` +- New struct `DatabaseSQLVulnerabilityAssessmentRuleBaselineInput` +- New struct `DatabaseSQLVulnerabilityAssessmentRuleBaselineInputProperties` +- New struct `DatabaseSQLVulnerabilityAssessmentRuleBaselineListInput` +- New struct `DatabaseSQLVulnerabilityAssessmentRuleBaselineListInputProperties` +- New struct `DatabaseSQLVulnerabilityAssessmentRuleBaselineListResult` +- New struct `DatabaseSQLVulnerabilityAssessmentRuleBaselineProperties` +- New struct `DatabaseVulnerabilityAssessmentRuleBaselineAutoGenerated` +- New struct `DatabaseVulnerabilityAssessmentRuleBaselinePropertiesAutoGenerated` +- New struct `DistributedAvailabilityGroupSetRole` +- New struct `EndpointDependency` +- New struct `EndpointDetail` +- New struct `ManagedDatabaseAdvancedThreatProtection` +- New struct `ManagedDatabaseAdvancedThreatProtectionListResult` +- New struct `ManagedDatabaseMoveDefinition` +- New struct `ManagedDatabaseMoveOperationListResult` +- New struct `ManagedDatabaseMoveOperationResult` +- New struct `ManagedDatabaseMoveOperationResultProperties` +- New struct `ManagedDatabaseRestoreDetailsBackupSetProperties` +- New struct `ManagedDatabaseRestoreDetailsUnrestorableFileProperties` +- New struct `ManagedDatabaseStartMoveDefinition` +- New struct `ManagedInstanceAdvancedThreatProtection` +- New struct `ManagedInstanceAdvancedThreatProtectionListResult` +- New struct `ManagedInstanceDtc` +- New struct `ManagedInstanceDtcListResult` +- New struct `ManagedInstanceDtcProperties` +- New struct `ManagedInstanceDtcSecuritySettings` +- New struct `ManagedInstanceDtcTransactionManagerCommunicationSettings` +- New struct `ManagedLedgerDigestUploads` +- New struct `ManagedLedgerDigestUploadsListResult` +- New struct `ManagedLedgerDigestUploadsProperties` +- New struct `ManagedServerDNSAlias` +- New struct `ManagedServerDNSAliasAcquisition` +- New struct `ManagedServerDNSAliasCreation` +- New struct `ManagedServerDNSAliasListResult` +- New struct `ManagedServerDNSAliasProperties` +- New struct `NSPConfigAccessRule` +- New struct `NSPConfigAccessRuleProperties` +- New struct `NSPConfigAssociation` +- New struct `NSPConfigNetworkSecurityPerimeterRule` +- New struct `NSPConfigPerimeter` +- New struct `NSPConfigProfile` +- New struct `NSPProvisioningIssue` +- New struct `NSPProvisioningIssueProperties` +- New struct `NetworkSecurityPerimeterConfiguration` +- New struct `NetworkSecurityPerimeterConfigurationListResult` +- New struct `NetworkSecurityPerimeterConfigurationProperties` +- New struct `OutboundEnvironmentEndpoint` +- New struct `OutboundEnvironmentEndpointCollection` +- New struct `PhaseDetails` +- New struct `QueryCheck` +- New struct `RefreshExternalGovernanceStatusOperationResult` +- New struct `RefreshExternalGovernanceStatusOperationResultProperties` +- New struct `Remediation` +- New struct `ScheduleItem` +- New struct `ServerConfigurationOption` +- New struct `ServerConfigurationOptionListResult` +- New struct `ServerConfigurationOptionProperties` +- New struct `ServerUsageProperties` +- New struct `StartStopManagedInstanceSchedule` +- New struct `StartStopManagedInstanceScheduleListResult` +- New struct `StartStopManagedInstanceScheduleProperties` +- New struct `SynapseLinkWorkspace` +- New struct `SynapseLinkWorkspaceInfoProperties` +- New struct `SynapseLinkWorkspaceListResult` +- New struct `SynapseLinkWorkspaceProperties` +- New struct `UpdateVirtualClusterDNSServersOperation` +- New struct `UpsertManagedServerOperationStepWithEstimatesAndDuration` +- New struct `VaRule` +- New struct `VirtualClusterDNSServersProperties` +- New struct `VulnerabilityAssessment` +- New struct `VulnerabilityAssessmentListResult` +- New struct `VulnerabilityAssessmentPolicyProperties` +- New struct `VulnerabilityAssessmentScanForSQLError` +- New struct `VulnerabilityAssessmentScanListResult` +- New struct `VulnerabilityAssessmentScanRecordForSQL` +- New struct `VulnerabilityAssessmentScanRecordForSQLListResult` +- New struct `VulnerabilityAssessmentScanRecordForSQLProperties` +- New struct `VulnerabilityAssessmentScanResultProperties` +- New struct `VulnerabilityAssessmentScanResults` +- New field `NextLink` in struct `DataMaskingRuleListResult` +- New field `AdministratorLogin`, `AdministratorLoginPassword`, `AuthenticationType`, `DatabaseEdition`, `MaxSizeBytes`, `NetworkIsolation`, `ServiceObjectiveName` in struct `DatabaseExtensionsProperties` +- New field `OperationPhaseDetails` in struct `DatabaseOperationProperties` +- New field `AvailabilityZone`, `EncryptionProtector`, `Keys`, `ManualCutover`, `PerformCutover`, `PreferredEnclaveType` in struct `DatabaseProperties` +- New field `EncryptionProtector`, `Keys`, `ManualCutover`, `PerformCutover`, `PreferredEnclaveType` in struct `DatabaseUpdateProperties` +- New field `Expand`, `Filter` in struct `DatabasesClientGetOptions` +- New field `InstanceRole` in struct `DistributedAvailabilityGroupProperties` +- New field `ZonePinning` in struct `EditionCapability` +- New field `ZonePinning` in struct `ElasticPoolEditionCapability` +- New field `AvailabilityZone`, `MinCapacity`, `PreferredEnclaveType` in struct `ElasticPoolProperties` +- New field `AvailabilityZone`, `MinCapacity`, `PreferredEnclaveType` in struct `ElasticPoolUpdateProperties` +- New field `NextLink` in struct `GeoBackupPolicyListResult` +- New field `BlobURI`, `PrivateEndpointConnections`, `QueuedTime` in struct `ImportExportExtensionsOperationResultProperties` +- New field `SecondaryType` in struct `InstanceFailoverGroupProperties` +- New field `CrossSubscriptionRestorableDroppedDatabaseID`, `CrossSubscriptionSourceDatabaseID`, `CrossSubscriptionTargetManagedInstanceID`, `IsLedgerOn`, `StorageContainerIdentity` in struct `ManagedDatabaseProperties` +- New field `CurrentBackupType`, `CurrentRestorePlanSizeMB`, `CurrentRestoredSizeMB`, `DiffBackupSets`, `FullBackupSets`, `LogBackupSets`, `NumberOfFilesQueued`, `NumberOfFilesRestored`, `NumberOfFilesRestoring`, `NumberOfFilesSkipped`, `NumberOfFilesUnrestorable`, `Type` in struct `ManagedDatabaseRestoreDetailsProperties` +- New anonymous field `DatabaseVulnerabilityAssessmentRuleBaselineAutoGenerated` in struct `ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClientCreateOrUpdateResponse` +- New anonymous field `DatabaseVulnerabilityAssessmentRuleBaselineAutoGenerated` in struct `ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClientGetResponse` +- New field `RequiredZoneNames` in struct `ManagedInstancePrivateLinkProperties` +- New field `VirtualClusterID` in struct `ManagedInstanceProperties` +- New field `GroupIDs` in struct `PrivateEndpointConnectionProperties` +- New field `NextLink` in struct `RecoverableDatabaseListResult` +- New field `Keys` in struct `RecoverableDatabaseProperties` +- New field `Expand`, `Filter` in struct `RecoverableDatabasesClientGetOptions` +- New field `PartnerDatabaseID` in struct `ReplicationLinkProperties` +- New field `Keys` in struct `RestorableDroppedDatabaseProperties` +- New field `Expand`, `Filter` in struct `RestorableDroppedDatabasesClientGetOptions` +- New field `IsManagedIdentityInUse` in struct `ServerDevOpsAuditSettingsProperties` +- New field `ExternalGovernanceStatus` in struct `ServerProperties` +- New field `ID`, `Properties`, `Type` in struct `ServerUsage` +- New field `NextLink` in struct `ServerUsageListResult` +- New field `ZonePinning` in struct `ServiceObjectiveCapability` +- New field `Version` in struct `VirtualClusterProperties` + + ## 1.1.0 (2023-03-27) ### Features Added diff --git a/sdk/resourcemanager/sql/armsql/agent_client.go b/sdk/resourcemanager/sql/armsql/agent_client.go index 4f0f56a35193..70d351287792 100644 --- a/sdk/resourcemanager/sql/armsql/agent_client.go +++ b/sdk/resourcemanager/sql/armsql/agent_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armsql @@ -47,24 +46,27 @@ func NewAgentClient(subscriptionID string, credential azcore.TokenCredential, op // CreateOrUpdate - Puts new sql agent configuration to instance. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - managedInstanceName - The name of the managed instance. // - options - AgentClientCreateOrUpdateOptions contains the optional parameters for the AgentClient.CreateOrUpdate method. func (client *AgentClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, managedInstanceName string, parameters AgentConfiguration, options *AgentClientCreateOrUpdateOptions) (AgentClientCreateOrUpdateResponse, error) { + var err error req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, managedInstanceName, parameters, options) if err != nil { return AgentClientCreateOrUpdateResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return AgentClientCreateOrUpdateResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return AgentClientCreateOrUpdateResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return AgentClientCreateOrUpdateResponse{}, err } - return client.createOrUpdateHandleResponse(resp) + resp, err := client.createOrUpdateHandleResponse(httpResp) + return resp, err } // createOrUpdateCreateRequest creates the CreateOrUpdate request. @@ -87,10 +89,13 @@ func (client *AgentClient) createOrUpdateCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // createOrUpdateHandleResponse handles the CreateOrUpdate response. @@ -105,24 +110,27 @@ func (client *AgentClient) createOrUpdateHandleResponse(resp *http.Response) (Ag // Get - Gets current instance sql agent configuration. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - managedInstanceName - The name of the managed instance. // - options - AgentClientGetOptions contains the optional parameters for the AgentClient.Get method. func (client *AgentClient) Get(ctx context.Context, resourceGroupName string, managedInstanceName string, options *AgentClientGetOptions) (AgentClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, managedInstanceName, options) if err != nil { return AgentClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return AgentClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return AgentClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return AgentClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -145,7 +153,7 @@ func (client *AgentClient) getCreateRequest(ctx context.Context, resourceGroupNa return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/sql/armsql/agent_client_example_test.go b/sdk/resourcemanager/sql/armsql/agent_client_example_test.go deleted file mode 100644 index bc4941ab8d17..000000000000 --- a/sdk/resourcemanager/sql/armsql/agent_client_example_test.go +++ /dev/null @@ -1,79 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsql_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sql/armsql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SqlAgentConfigurationGet.json -func ExampleAgentClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAgentClient().Get(ctx, "sqlcrudtest-7398", "sqlcrudtest-4645", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.AgentConfiguration = armsql.AgentConfiguration{ - // Name: to.Ptr("current"), - // Type: to.Ptr("Microsoft.Sql/managedInstances/sqlAgent"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/sqlcrudtest-7398/providers/Microsoft.Sql/managedInstances/sqlcrudtest-4645/sqlAgent/current"), - // Properties: &armsql.AgentConfigurationProperties{ - // State: to.Ptr(armsql.SQLAgentConfigurationPropertiesStateEnabled), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SqlAgentConfigurationPut.json -func ExampleAgentClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAgentClient().CreateOrUpdate(ctx, "sqlcrudtest-7398", "sqlcrudtest-4645", armsql.AgentConfiguration{ - Properties: &armsql.AgentConfigurationProperties{ - State: to.Ptr(armsql.SQLAgentConfigurationPropertiesStateEnabled), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.AgentConfiguration = armsql.AgentConfiguration{ - // Name: to.Ptr("current"), - // Type: to.Ptr("Microsoft.Sql/managedInstances/sqlAgent"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/sqlcrudtest-7398/providers/Microsoft.Sql/managedInstances/sqlcrudtest-4645/sqlAgent/current"), - // Properties: &armsql.AgentConfigurationProperties{ - // State: to.Ptr(armsql.SQLAgentConfigurationPropertiesStateEnabled), - // }, - // } -} diff --git a/sdk/resourcemanager/sql/armsql/autorest.md b/sdk/resourcemanager/sql/armsql/autorest.md index 73938f709d0c..b475ff644ea1 100644 --- a/sdk/resourcemanager/sql/armsql/autorest.md +++ b/sdk/resourcemanager/sql/armsql/autorest.md @@ -5,8 +5,8 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/readme.go.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/sql/resource-manager/readme.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/sql/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 1.1.0 +module-version: 2.0.0-beta.1 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/sql/armsql/backupshorttermretentionpolicies_client.go b/sdk/resourcemanager/sql/armsql/backupshorttermretentionpolicies_client.go index 0f0865c9dbc5..8e1196a96409 100644 --- a/sdk/resourcemanager/sql/armsql/backupshorttermretentionpolicies_client.go +++ b/sdk/resourcemanager/sql/armsql/backupshorttermretentionpolicies_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armsql @@ -47,7 +46,7 @@ func NewBackupShortTermRetentionPoliciesClient(subscriptionID string, credential // BeginCreateOrUpdate - Updates a database's short term retention policy. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-02-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -62,7 +61,8 @@ func (client *BackupShortTermRetentionPoliciesClient) BeginCreateOrUpdate(ctx co if err != nil { return nil, err } - return runtime.NewPoller[BackupShortTermRetentionPoliciesClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[BackupShortTermRetentionPoliciesClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[BackupShortTermRetentionPoliciesClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -71,20 +71,22 @@ func (client *BackupShortTermRetentionPoliciesClient) BeginCreateOrUpdate(ctx co // CreateOrUpdate - Updates a database's short term retention policy. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-02-01-preview +// Generated from API version 2022-11-01-preview func (client *BackupShortTermRetentionPoliciesClient) createOrUpdate(ctx context.Context, resourceGroupName string, serverName string, databaseName string, policyName ShortTermRetentionPolicyName, parameters BackupShortTermRetentionPolicy, options *BackupShortTermRetentionPoliciesClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, serverName, databaseName, policyName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createOrUpdateCreateRequest creates the CreateOrUpdate request. @@ -115,16 +117,19 @@ func (client *BackupShortTermRetentionPoliciesClient) createOrUpdateCreateReques return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-02-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // Get - Gets a database's short term retention policy. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-02-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -133,18 +138,21 @@ func (client *BackupShortTermRetentionPoliciesClient) createOrUpdateCreateReques // - options - BackupShortTermRetentionPoliciesClientGetOptions contains the optional parameters for the BackupShortTermRetentionPoliciesClient.Get // method. func (client *BackupShortTermRetentionPoliciesClient) Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string, policyName ShortTermRetentionPolicyName, options *BackupShortTermRetentionPoliciesClientGetOptions) (BackupShortTermRetentionPoliciesClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, serverName, databaseName, policyName, options) if err != nil { return BackupShortTermRetentionPoliciesClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return BackupShortTermRetentionPoliciesClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return BackupShortTermRetentionPoliciesClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return BackupShortTermRetentionPoliciesClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -175,7 +183,7 @@ func (client *BackupShortTermRetentionPoliciesClient) getCreateRequest(ctx conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-02-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -192,7 +200,7 @@ func (client *BackupShortTermRetentionPoliciesClient) getHandleResponse(resp *ht // NewListByDatabasePager - Gets a database's short term retention policy. // -// Generated from API version 2021-02-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -251,7 +259,7 @@ func (client *BackupShortTermRetentionPoliciesClient) listByDatabaseCreateReques return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-02-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -269,7 +277,7 @@ func (client *BackupShortTermRetentionPoliciesClient) listByDatabaseHandleRespon // BeginUpdate - Updates a database's short term retention policy. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-02-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -284,7 +292,8 @@ func (client *BackupShortTermRetentionPoliciesClient) BeginUpdate(ctx context.Co if err != nil { return nil, err } - return runtime.NewPoller[BackupShortTermRetentionPoliciesClientUpdateResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[BackupShortTermRetentionPoliciesClientUpdateResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[BackupShortTermRetentionPoliciesClientUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -293,20 +302,22 @@ func (client *BackupShortTermRetentionPoliciesClient) BeginUpdate(ctx context.Co // Update - Updates a database's short term retention policy. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-02-01-preview +// Generated from API version 2022-11-01-preview func (client *BackupShortTermRetentionPoliciesClient) update(ctx context.Context, resourceGroupName string, serverName string, databaseName string, policyName ShortTermRetentionPolicyName, parameters BackupShortTermRetentionPolicy, options *BackupShortTermRetentionPoliciesClientBeginUpdateOptions) (*http.Response, error) { + var err error req, err := client.updateCreateRequest(ctx, resourceGroupName, serverName, databaseName, policyName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // updateCreateRequest creates the Update request. @@ -337,8 +348,11 @@ func (client *BackupShortTermRetentionPoliciesClient) updateCreateRequest(ctx co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-02-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } diff --git a/sdk/resourcemanager/sql/armsql/backupshorttermretentionpolicies_client_example_test.go b/sdk/resourcemanager/sql/armsql/backupshorttermretentionpolicies_client_example_test.go deleted file mode 100644 index d7add7cc4dd2..000000000000 --- a/sdk/resourcemanager/sql/armsql/backupshorttermretentionpolicies_client_example_test.go +++ /dev/null @@ -1,123 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsql_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sql/armsql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/GetShortTermRetentionPolicy.json -func ExampleBackupShortTermRetentionPoliciesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewBackupShortTermRetentionPoliciesClient().Get(ctx, "Default-SQL-SouthEastAsia", "testsvr", "testdb", armsql.ShortTermRetentionPolicyNameDefault, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.BackupShortTermRetentionPolicy = armsql.BackupShortTermRetentionPolicy{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.Sql/servers/databases/backupShortTermRetentionPolicies"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/servers/testsvr/databases/testdb/backupShortTermRetentionPolicies/default"), - // Properties: &armsql.BackupShortTermRetentionPolicyProperties{ - // DiffBackupIntervalInHours: to.Ptr(armsql.DiffBackupIntervalInHours(24)), - // RetentionDays: to.Ptr[int32](7), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/UpdateShortTermRetentionPolicy.json -func ExampleBackupShortTermRetentionPoliciesClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewBackupShortTermRetentionPoliciesClient().BeginCreateOrUpdate(ctx, "resourceGroup", "testsvr", "testdb", armsql.ShortTermRetentionPolicyNameDefault, armsql.BackupShortTermRetentionPolicy{ - Properties: &armsql.BackupShortTermRetentionPolicyProperties{ - DiffBackupIntervalInHours: to.Ptr(armsql.DiffBackupIntervalInHours(24)), - RetentionDays: to.Ptr[int32](7), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.BackupShortTermRetentionPolicy = armsql.BackupShortTermRetentionPolicy{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.Sql/servers/databases/backupShortTermRetentionPolicies"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/providers/Microsoft.Sql/resourceGroups/resourceGroup/servers/testsvr/databases/testdb/backupShortTermRetentionPolicies/default"), - // Properties: &armsql.BackupShortTermRetentionPolicyProperties{ - // DiffBackupIntervalInHours: to.Ptr(armsql.DiffBackupIntervalInHours(24)), - // RetentionDays: to.Ptr[int32](7), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/ListShortTermRetentionPoliciesByDatabase.json -func ExampleBackupShortTermRetentionPoliciesClient_NewListByDatabasePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewBackupShortTermRetentionPoliciesClient().NewListByDatabasePager("Default-SQL-SouthEastAsia", "testsvr", "testdb", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.BackupShortTermRetentionPolicyListResult = armsql.BackupShortTermRetentionPolicyListResult{ - // Value: []*armsql.BackupShortTermRetentionPolicy{ - // { - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.Sql/servers/databases/backupShortTermRetentionPolicies"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/servers/testsvr/databases/testdb/backupShortTermRetentionPolicies/default"), - // Properties: &armsql.BackupShortTermRetentionPolicyProperties{ - // DiffBackupIntervalInHours: to.Ptr(armsql.DiffBackupIntervalInHours(24)), - // RetentionDays: to.Ptr[int32](7), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/sql/armsql/capabilities_client.go b/sdk/resourcemanager/sql/armsql/capabilities_client.go index 1ef506ef92e8..ec7b7e411580 100644 --- a/sdk/resourcemanager/sql/armsql/capabilities_client.go +++ b/sdk/resourcemanager/sql/armsql/capabilities_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armsql @@ -47,23 +46,26 @@ func NewCapabilitiesClient(subscriptionID string, credential azcore.TokenCredent // ListByLocation - Gets the subscription capabilities available for the specified location. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - locationName - The location name whose capabilities are retrieved. // - options - CapabilitiesClientListByLocationOptions contains the optional parameters for the CapabilitiesClient.ListByLocation // method. func (client *CapabilitiesClient) ListByLocation(ctx context.Context, locationName string, options *CapabilitiesClientListByLocationOptions) (CapabilitiesClientListByLocationResponse, error) { + var err error req, err := client.listByLocationCreateRequest(ctx, locationName, options) if err != nil { return CapabilitiesClientListByLocationResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return CapabilitiesClientListByLocationResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return CapabilitiesClientListByLocationResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return CapabilitiesClientListByLocationResponse{}, err } - return client.listByLocationHandleResponse(resp) + resp, err := client.listByLocationHandleResponse(httpResp) + return resp, err } // listByLocationCreateRequest creates the ListByLocation request. @@ -85,7 +87,7 @@ func (client *CapabilitiesClient) listByLocationCreateRequest(ctx context.Contex if options != nil && options.Include != nil { reqQP.Set("include", string(*options.Include)) } - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/sql/armsql/capabilities_client_example_test.go b/sdk/resourcemanager/sql/armsql/capabilities_client_example_test.go deleted file mode 100644 index c8e1c03d7e11..000000000000 --- a/sdk/resourcemanager/sql/armsql/capabilities_client_example_test.go +++ /dev/null @@ -1,3048 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsql_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sql/armsql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/LocationCapabilityListByLocation.json -func ExampleCapabilitiesClient_ListByLocation() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewCapabilitiesClient().ListByLocation(ctx, "eastus", &armsql.CapabilitiesClientListByLocationOptions{Include: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.LocationCapabilities = armsql.LocationCapabilities{ - // Name: to.Ptr("East US"), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // SupportedManagedInstanceVersions: []*armsql.ManagedInstanceVersionCapability{ - // { - // Name: to.Ptr("12.0"), - // Status: to.Ptr(armsql.CapabilityStatusDefault), - // SupportedEditions: []*armsql.ManagedInstanceEditionCapability{ - // { - // Name: to.Ptr("GeneralPurpose"), - // Status: to.Ptr(armsql.CapabilityStatusDefault), - // SupportedFamilies: []*armsql.ManagedInstanceFamilyCapability{ - // { - // Name: to.Ptr("Gen4"), - // SKU: to.Ptr("GP_Gen4"), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // SupportedLicenseTypes: []*armsql.LicenseTypeCapability{ - // { - // Name: to.Ptr("LicenseIncluded"), - // Status: to.Ptr(armsql.CapabilityStatusDefault), - // }, - // { - // Name: to.Ptr("BasePrice"), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // }}, - // SupportedVcoresValues: []*armsql.ManagedInstanceVcoresCapability{ - // { - // Name: to.Ptr("8"), - // IncludedMaxSize: &armsql.MaxSizeCapability{ - // Limit: to.Ptr[int32](262144), - // Unit: to.Ptr(armsql.MaxSizeUnitMegabytes), - // }, - // InstancePoolSupported: to.Ptr(true), - // StandaloneSupported: to.Ptr(true), - // Status: to.Ptr(armsql.CapabilityStatusDefault), - // SupportedMaintenanceConfigurations: []*armsql.ManagedInstanceMaintenanceConfigurationCapability{ - // { - // Name: to.Ptr("SQL_Default"), - // Status: to.Ptr(armsql.CapabilityStatusDefault), - // }, - // { - // Name: to.Ptr("SQL_EastUS_MI_1"), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // }, - // { - // Name: to.Ptr("SQL_EastUS_MI_2"), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // }}, - // SupportedStorageSizes: []*armsql.MaxSizeRangeCapability{ - // { - // MaxValue: &armsql.MaxSizeCapability{ - // Limit: to.Ptr[int32](8), - // Unit: to.Ptr(armsql.MaxSizeUnitTerabytes), - // }, - // MinValue: &armsql.MaxSizeCapability{ - // Limit: to.Ptr[int32](32), - // Unit: to.Ptr(armsql.MaxSizeUnitGigabytes), - // }, - // ScaleSize: &armsql.MaxSizeCapability{ - // Limit: to.Ptr[int32](32), - // Unit: to.Ptr(armsql.MaxSizeUnitGigabytes), - // }, - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // }}, - // Value: to.Ptr[int32](8), - // }, - // { - // Name: to.Ptr("16"), - // IncludedMaxSize: &armsql.MaxSizeCapability{ - // Limit: to.Ptr[int32](262144), - // Unit: to.Ptr(armsql.MaxSizeUnitMegabytes), - // }, - // InstancePoolSupported: to.Ptr(true), - // StandaloneSupported: to.Ptr(true), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // SupportedMaintenanceConfigurations: []*armsql.ManagedInstanceMaintenanceConfigurationCapability{ - // { - // Name: to.Ptr("SQL_Default"), - // Status: to.Ptr(armsql.CapabilityStatusDefault), - // }, - // { - // Name: to.Ptr("SQL_EastUS_MI_1"), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // }, - // { - // Name: to.Ptr("SQL_EastUS_MI_2"), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // }}, - // SupportedStorageSizes: []*armsql.MaxSizeRangeCapability{ - // { - // MaxValue: &armsql.MaxSizeCapability{ - // Limit: to.Ptr[int32](8), - // Unit: to.Ptr(armsql.MaxSizeUnitTerabytes), - // }, - // MinValue: &armsql.MaxSizeCapability{ - // Limit: to.Ptr[int32](32), - // Unit: to.Ptr(armsql.MaxSizeUnitGigabytes), - // }, - // ScaleSize: &armsql.MaxSizeCapability{ - // Limit: to.Ptr[int32](32), - // Unit: to.Ptr(armsql.MaxSizeUnitGigabytes), - // }, - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // }}, - // Value: to.Ptr[int32](16), - // }, - // { - // Name: to.Ptr("24"), - // IncludedMaxSize: &armsql.MaxSizeCapability{ - // Limit: to.Ptr[int32](262144), - // Unit: to.Ptr(armsql.MaxSizeUnitMegabytes), - // }, - // InstancePoolSupported: to.Ptr(true), - // StandaloneSupported: to.Ptr(true), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // SupportedMaintenanceConfigurations: []*armsql.ManagedInstanceMaintenanceConfigurationCapability{ - // { - // Name: to.Ptr("SQL_Default"), - // Status: to.Ptr(armsql.CapabilityStatusDefault), - // }, - // { - // Name: to.Ptr("SQL_EastUS_MI_1"), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // }, - // { - // Name: to.Ptr("SQL_EastUS_MI_2"), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // }}, - // SupportedStorageSizes: []*armsql.MaxSizeRangeCapability{ - // { - // MaxValue: &armsql.MaxSizeCapability{ - // Limit: to.Ptr[int32](8), - // Unit: to.Ptr(armsql.MaxSizeUnitTerabytes), - // }, - // MinValue: &armsql.MaxSizeCapability{ - // Limit: to.Ptr[int32](32), - // Unit: to.Ptr(armsql.MaxSizeUnitGigabytes), - // }, - // ScaleSize: &armsql.MaxSizeCapability{ - // Limit: to.Ptr[int32](32), - // Unit: to.Ptr(armsql.MaxSizeUnitGigabytes), - // }, - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // }}, - // Value: to.Ptr[int32](24), - // }}, - // }, - // { - // Name: to.Ptr("Gen5"), - // SKU: to.Ptr("GP_Gen5"), - // Status: to.Ptr(armsql.CapabilityStatusDefault), - // SupportedLicenseTypes: []*armsql.LicenseTypeCapability{ - // { - // Name: to.Ptr("LicenseIncluded"), - // Status: to.Ptr(armsql.CapabilityStatusDefault), - // }, - // { - // Name: to.Ptr("BasePrice"), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // }}, - // SupportedVcoresValues: []*armsql.ManagedInstanceVcoresCapability{ - // { - // Name: to.Ptr("8"), - // IncludedMaxSize: &armsql.MaxSizeCapability{ - // Limit: to.Ptr[int32](262144), - // Unit: to.Ptr(armsql.MaxSizeUnitMegabytes), - // }, - // InstancePoolSupported: to.Ptr(true), - // StandaloneSupported: to.Ptr(true), - // Status: to.Ptr(armsql.CapabilityStatusDefault), - // SupportedMaintenanceConfigurations: []*armsql.ManagedInstanceMaintenanceConfigurationCapability{ - // { - // Name: to.Ptr("SQL_Default"), - // Status: to.Ptr(armsql.CapabilityStatusDefault), - // }, - // { - // Name: to.Ptr("SQL_EastUS_MI_1"), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // }, - // { - // Name: to.Ptr("SQL_EastUS_MI_2"), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // }}, - // SupportedStorageSizes: []*armsql.MaxSizeRangeCapability{ - // { - // MaxValue: &armsql.MaxSizeCapability{ - // Limit: to.Ptr[int32](8), - // Unit: to.Ptr(armsql.MaxSizeUnitTerabytes), - // }, - // MinValue: &armsql.MaxSizeCapability{ - // Limit: to.Ptr[int32](32), - // Unit: to.Ptr(armsql.MaxSizeUnitGigabytes), - // }, - // ScaleSize: &armsql.MaxSizeCapability{ - // Limit: to.Ptr[int32](32), - // Unit: to.Ptr(armsql.MaxSizeUnitGigabytes), - // }, - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // }}, - // Value: to.Ptr[int32](8), - // }, - // { - // Name: to.Ptr("16"), - // IncludedMaxSize: &armsql.MaxSizeCapability{ - // Limit: to.Ptr[int32](262144), - // Unit: to.Ptr(armsql.MaxSizeUnitMegabytes), - // }, - // InstancePoolSupported: to.Ptr(true), - // StandaloneSupported: to.Ptr(true), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // SupportedMaintenanceConfigurations: []*armsql.ManagedInstanceMaintenanceConfigurationCapability{ - // { - // Name: to.Ptr("SQL_Default"), - // Status: to.Ptr(armsql.CapabilityStatusDefault), - // }, - // { - // Name: to.Ptr("SQL_EastUS_MI_1"), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // }, - // { - // Name: to.Ptr("SQL_EastUS_MI_2"), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // }}, - // SupportedStorageSizes: []*armsql.MaxSizeRangeCapability{ - // { - // MaxValue: &armsql.MaxSizeCapability{ - // Limit: to.Ptr[int32](8), - // Unit: to.Ptr(armsql.MaxSizeUnitTerabytes), - // }, - // MinValue: &armsql.MaxSizeCapability{ - // Limit: to.Ptr[int32](32), - // Unit: to.Ptr(armsql.MaxSizeUnitGigabytes), - // }, - // ScaleSize: &armsql.MaxSizeCapability{ - // Limit: to.Ptr[int32](32), - // Unit: to.Ptr(armsql.MaxSizeUnitGigabytes), - // }, - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // }}, - // Value: to.Ptr[int32](16), - // }, - // { - // Name: to.Ptr("24"), - // IncludedMaxSize: &armsql.MaxSizeCapability{ - // Limit: to.Ptr[int32](262144), - // Unit: to.Ptr(armsql.MaxSizeUnitMegabytes), - // }, - // InstancePoolSupported: to.Ptr(true), - // StandaloneSupported: to.Ptr(true), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // SupportedMaintenanceConfigurations: []*armsql.ManagedInstanceMaintenanceConfigurationCapability{ - // { - // Name: to.Ptr("SQL_Default"), - // Status: to.Ptr(armsql.CapabilityStatusDefault), - // }, - // { - // Name: to.Ptr("SQL_EastUS_MI_1"), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // }, - // { - // Name: to.Ptr("SQL_EastUS_MI_2"), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // }}, - // SupportedStorageSizes: []*armsql.MaxSizeRangeCapability{ - // { - // MaxValue: &armsql.MaxSizeCapability{ - // Limit: to.Ptr[int32](8), - // Unit: to.Ptr(armsql.MaxSizeUnitTerabytes), - // }, - // MinValue: &armsql.MaxSizeCapability{ - // Limit: to.Ptr[int32](32), - // Unit: to.Ptr(armsql.MaxSizeUnitGigabytes), - // }, - // ScaleSize: &armsql.MaxSizeCapability{ - // Limit: to.Ptr[int32](32), - // Unit: to.Ptr(armsql.MaxSizeUnitGigabytes), - // }, - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // }}, - // Value: to.Ptr[int32](24), - // }}, - // }}, - // SupportedStorageCapabilities: []*armsql.StorageCapability{ - // { - // Status: to.Ptr(armsql.CapabilityStatusDefault), - // StorageAccountType: to.Ptr(armsql.StorageCapabilityStorageAccountTypeGRS), - // }, - // { - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // StorageAccountType: to.Ptr(armsql.StorageCapabilityStorageAccountTypeLRS), - // }, - // { - // Reason: to.Ptr("ZRS is available in multi-az regions"), - // Status: to.Ptr(armsql.CapabilityStatusVisible), - // StorageAccountType: to.Ptr(armsql.StorageCapabilityStorageAccountTypeZRS), - // }}, - // }, - // { - // Name: to.Ptr("Hyperscale"), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // SupportedFamilies: []*armsql.ManagedInstanceFamilyCapability{ - // { - // Name: to.Ptr("Gen4"), - // SKU: to.Ptr("HS_Gen4"), - // Status: to.Ptr(armsql.CapabilityStatusDefault), - // SupportedLicenseTypes: []*armsql.LicenseTypeCapability{ - // { - // Name: to.Ptr("LicenseIncluded"), - // Status: to.Ptr(armsql.CapabilityStatusDefault), - // }, - // { - // Name: to.Ptr("BasePrice"), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // }}, - // SupportedVcoresValues: []*armsql.ManagedInstanceVcoresCapability{ - // { - // Name: to.Ptr("4"), - // InstancePoolSupported: to.Ptr(true), - // StandaloneSupported: to.Ptr(true), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // SupportedMaintenanceConfigurations: []*armsql.ManagedInstanceMaintenanceConfigurationCapability{ - // { - // Name: to.Ptr("SQL_Default"), - // Status: to.Ptr(armsql.CapabilityStatusDefault), - // }}, - // Value: to.Ptr[int32](4), - // }, - // { - // Name: to.Ptr("8"), - // InstancePoolSupported: to.Ptr(true), - // StandaloneSupported: to.Ptr(true), - // Status: to.Ptr(armsql.CapabilityStatusDefault), - // SupportedMaintenanceConfigurations: []*armsql.ManagedInstanceMaintenanceConfigurationCapability{ - // { - // Name: to.Ptr("SQL_Default"), - // Status: to.Ptr(armsql.CapabilityStatusDefault), - // }}, - // Value: to.Ptr[int32](8), - // }, - // { - // Name: to.Ptr("16"), - // InstancePoolSupported: to.Ptr(true), - // StandaloneSupported: to.Ptr(true), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // SupportedMaintenanceConfigurations: []*armsql.ManagedInstanceMaintenanceConfigurationCapability{ - // { - // Name: to.Ptr("SQL_Default"), - // Status: to.Ptr(armsql.CapabilityStatusDefault), - // }}, - // Value: to.Ptr[int32](16), - // }, - // { - // Name: to.Ptr("24"), - // InstancePoolSupported: to.Ptr(true), - // StandaloneSupported: to.Ptr(true), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // SupportedMaintenanceConfigurations: []*armsql.ManagedInstanceMaintenanceConfigurationCapability{ - // { - // Name: to.Ptr("SQL_Default"), - // Status: to.Ptr(armsql.CapabilityStatusDefault), - // }}, - // Value: to.Ptr[int32](24), - // }}, - // }, - // { - // Name: to.Ptr("Gen5"), - // SKU: to.Ptr("HS_Gen5"), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // SupportedLicenseTypes: []*armsql.LicenseTypeCapability{ - // { - // Name: to.Ptr("LicenseIncluded"), - // Status: to.Ptr(armsql.CapabilityStatusDefault), - // }, - // { - // Name: to.Ptr("BasePrice"), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // }}, - // SupportedVcoresValues: []*armsql.ManagedInstanceVcoresCapability{ - // { - // Name: to.Ptr("4"), - // InstancePoolSupported: to.Ptr(true), - // StandaloneSupported: to.Ptr(true), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // SupportedMaintenanceConfigurations: []*armsql.ManagedInstanceMaintenanceConfigurationCapability{ - // { - // Name: to.Ptr("SQL_Default"), - // Status: to.Ptr(armsql.CapabilityStatusDefault), - // }}, - // Value: to.Ptr[int32](4), - // }, - // { - // Name: to.Ptr("8"), - // InstancePoolSupported: to.Ptr(true), - // StandaloneSupported: to.Ptr(true), - // Status: to.Ptr(armsql.CapabilityStatusDefault), - // SupportedMaintenanceConfigurations: []*armsql.ManagedInstanceMaintenanceConfigurationCapability{ - // { - // Name: to.Ptr("SQL_Default"), - // Status: to.Ptr(armsql.CapabilityStatusDefault), - // }}, - // Value: to.Ptr[int32](8), - // }, - // { - // Name: to.Ptr("16"), - // InstancePoolSupported: to.Ptr(true), - // StandaloneSupported: to.Ptr(true), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // SupportedMaintenanceConfigurations: []*armsql.ManagedInstanceMaintenanceConfigurationCapability{ - // { - // Name: to.Ptr("SQL_Default"), - // Status: to.Ptr(armsql.CapabilityStatusDefault), - // }}, - // Value: to.Ptr[int32](16), - // }, - // { - // Name: to.Ptr("24"), - // InstancePoolSupported: to.Ptr(true), - // StandaloneSupported: to.Ptr(true), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // SupportedMaintenanceConfigurations: []*armsql.ManagedInstanceMaintenanceConfigurationCapability{ - // { - // Name: to.Ptr("SQL_Default"), - // Status: to.Ptr(armsql.CapabilityStatusDefault), - // }}, - // Value: to.Ptr[int32](24), - // }, - // { - // Name: to.Ptr("32"), - // InstancePoolSupported: to.Ptr(true), - // StandaloneSupported: to.Ptr(true), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // SupportedMaintenanceConfigurations: []*armsql.ManagedInstanceMaintenanceConfigurationCapability{ - // { - // Name: to.Ptr("SQL_Default"), - // Status: to.Ptr(armsql.CapabilityStatusDefault), - // }}, - // Value: to.Ptr[int32](32), - // }, - // { - // Name: to.Ptr("40"), - // InstancePoolSupported: to.Ptr(true), - // StandaloneSupported: to.Ptr(true), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // SupportedMaintenanceConfigurations: []*armsql.ManagedInstanceMaintenanceConfigurationCapability{ - // { - // Name: to.Ptr("SQL_Default"), - // Status: to.Ptr(armsql.CapabilityStatusDefault), - // }}, - // Value: to.Ptr[int32](40), - // }, - // { - // Name: to.Ptr("48"), - // InstancePoolSupported: to.Ptr(true), - // StandaloneSupported: to.Ptr(true), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // SupportedMaintenanceConfigurations: []*armsql.ManagedInstanceMaintenanceConfigurationCapability{ - // { - // Name: to.Ptr("SQL_Default"), - // Status: to.Ptr(armsql.CapabilityStatusDefault), - // }}, - // Value: to.Ptr[int32](48), - // }, - // { - // Name: to.Ptr("64"), - // InstancePoolSupported: to.Ptr(true), - // StandaloneSupported: to.Ptr(true), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // SupportedMaintenanceConfigurations: []*armsql.ManagedInstanceMaintenanceConfigurationCapability{ - // { - // Name: to.Ptr("SQL_Default"), - // Status: to.Ptr(armsql.CapabilityStatusDefault), - // }}, - // Value: to.Ptr[int32](64), - // }, - // { - // Name: to.Ptr("80"), - // InstancePoolSupported: to.Ptr(true), - // StandaloneSupported: to.Ptr(true), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // SupportedMaintenanceConfigurations: []*armsql.ManagedInstanceMaintenanceConfigurationCapability{ - // { - // Name: to.Ptr("SQL_Default"), - // Status: to.Ptr(armsql.CapabilityStatusDefault), - // }}, - // Value: to.Ptr[int32](80), - // }}, - // }}, - // SupportedStorageCapabilities: []*armsql.StorageCapability{ - // { - // Status: to.Ptr(armsql.CapabilityStatusDefault), - // StorageAccountType: to.Ptr(armsql.StorageCapabilityStorageAccountTypeGRS), - // }, - // { - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // StorageAccountType: to.Ptr(armsql.StorageCapabilityStorageAccountTypeLRS), - // }, - // { - // Reason: to.Ptr("ZRS is available in multi-az regions"), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // StorageAccountType: to.Ptr(armsql.StorageCapabilityStorageAccountTypeZRS), - // }}, - // }}, - // SupportedInstancePoolEditions: []*armsql.InstancePoolEditionCapability{ - // { - // Name: to.Ptr("GeneralPurpose"), - // Status: to.Ptr(armsql.CapabilityStatusDefault), - // SupportedFamilies: []*armsql.InstancePoolFamilyCapability{ - // { - // Name: to.Ptr("Gen5"), - // Status: to.Ptr(armsql.CapabilityStatusDefault), - // SupportedLicenseTypes: []*armsql.LicenseTypeCapability{ - // { - // Name: to.Ptr("LicenseIncluded"), - // Status: to.Ptr(armsql.CapabilityStatusDefault), - // }, - // { - // Name: to.Ptr("BasePrice"), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // }}, - // SupportedVcoresValues: []*armsql.InstancePoolVcoresCapability{ - // { - // Name: to.Ptr("GP_Gen5_8"), - // Status: to.Ptr(armsql.CapabilityStatusDefault), - // StorageLimit: &armsql.MaxSizeCapability{ - // Limit: to.Ptr[int32](8388608), - // Unit: to.Ptr(armsql.MaxSizeUnitMegabytes), - // }, - // Value: to.Ptr[int32](8), - // }, - // { - // Name: to.Ptr("GP_Gen5_16"), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // StorageLimit: &armsql.MaxSizeCapability{ - // Limit: to.Ptr[int32](8388608), - // Unit: to.Ptr(armsql.MaxSizeUnitMegabytes), - // }, - // Value: to.Ptr[int32](16), - // }, - // { - // Name: to.Ptr("GP_Gen5_24"), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // StorageLimit: &armsql.MaxSizeCapability{ - // Limit: to.Ptr[int32](8388608), - // Unit: to.Ptr(armsql.MaxSizeUnitMegabytes), - // }, - // Value: to.Ptr[int32](24), - // }, - // { - // Name: to.Ptr("GP_Gen5_32"), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // StorageLimit: &armsql.MaxSizeCapability{ - // Limit: to.Ptr[int32](8388608), - // Unit: to.Ptr(armsql.MaxSizeUnitMegabytes), - // }, - // Value: to.Ptr[int32](32), - // }, - // { - // Name: to.Ptr("GP_Gen5_40"), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // StorageLimit: &armsql.MaxSizeCapability{ - // Limit: to.Ptr[int32](8388608), - // Unit: to.Ptr(armsql.MaxSizeUnitMegabytes), - // }, - // Value: to.Ptr[int32](40), - // }, - // { - // Name: to.Ptr("GP_Gen5_64"), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // StorageLimit: &armsql.MaxSizeCapability{ - // Limit: to.Ptr[int32](8388608), - // Unit: to.Ptr(armsql.MaxSizeUnitMegabytes), - // }, - // Value: to.Ptr[int32](64), - // }, - // { - // Name: to.Ptr("GP_Gen5_80"), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // StorageLimit: &armsql.MaxSizeCapability{ - // Limit: to.Ptr[int32](8388608), - // Unit: to.Ptr(armsql.MaxSizeUnitMegabytes), - // }, - // Value: to.Ptr[int32](80), - // }}, - // }}, - // }}, - // }}, - // SupportedServerVersions: []*armsql.ServerVersionCapability{ - // { - // Name: to.Ptr("12.0"), - // Status: to.Ptr(armsql.CapabilityStatusDefault), - // SupportedEditions: []*armsql.EditionCapability{ - // { - // Name: to.Ptr("Hyperscale"), - // ReadScale: &armsql.ReadScaleCapability{ - // MaxNumberOfReplicas: to.Ptr[int32](4), - // }, - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // SupportedServiceLevelObjectives: []*armsql.ServiceObjectiveCapability{ - // { - // Name: to.Ptr("HS_Gen4_1"), - // ComputeModel: to.Ptr("Provisioned"), - // ID: to.Ptr("9380cd0e-b025-4e9d-829c-c1918c1614bb"), - // PerformanceLevel: &armsql.PerformanceLevelCapability{ - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // Value: to.Ptr[float64](1), - // }, - // SKU: &armsql.SKU{ - // Name: to.Ptr("HS_Gen4"), - // Capacity: to.Ptr[int32](1), - // Family: to.Ptr("Gen4"), - // Tier: to.Ptr("Hyperscale"), - // }, - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // SupportedLicenseTypes: []*armsql.LicenseTypeCapability{ - // { - // Name: to.Ptr("LicenseIncluded"), - // Status: to.Ptr(armsql.CapabilityStatusDefault), - // }, - // { - // Name: to.Ptr("BasePrice"), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // }}, - // SupportedMaintenanceConfigurations: []*armsql.MaintenanceConfigurationCapability{ - // { - // Name: to.Ptr("SQL_Default"), - // Status: to.Ptr(armsql.CapabilityStatusDefault), - // ZoneRedundant: to.Ptr(false), - // }}, - // ZoneRedundant: to.Ptr(false), - // }, - // { - // Name: to.Ptr("HS_Gen4_2"), - // ComputeModel: to.Ptr("Provisioned"), - // ID: to.Ptr("34497c3f-24b9-4cee-968d-6e5e854670fe"), - // PerformanceLevel: &armsql.PerformanceLevelCapability{ - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // Value: to.Ptr[float64](2), - // }, - // SKU: &armsql.SKU{ - // Name: to.Ptr("HS_Gen4"), - // Capacity: to.Ptr[int32](2), - // Family: to.Ptr("Gen4"), - // Tier: to.Ptr("Hyperscale"), - // }, - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // SupportedLicenseTypes: []*armsql.LicenseTypeCapability{ - // { - // Name: to.Ptr("LicenseIncluded"), - // Status: to.Ptr(armsql.CapabilityStatusDefault), - // }, - // { - // Name: to.Ptr("BasePrice"), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // }}, - // SupportedMaintenanceConfigurations: []*armsql.MaintenanceConfigurationCapability{ - // { - // Name: to.Ptr("SQL_Default"), - // Status: to.Ptr(armsql.CapabilityStatusDefault), - // ZoneRedundant: to.Ptr(false), - // }}, - // ZoneRedundant: to.Ptr(false), - // }, - // { - // Name: to.Ptr("HS_Gen5_2"), - // ComputeModel: to.Ptr("Provisioned"), - // ID: to.Ptr("a420d2b2-ca32-4152-b1c6-dd8d4d9fd734"), - // PerformanceLevel: &armsql.PerformanceLevelCapability{ - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // Value: to.Ptr[float64](2), - // }, - // SKU: &armsql.SKU{ - // Name: to.Ptr("HS_Gen5"), - // Capacity: to.Ptr[int32](2), - // Family: to.Ptr("Gen5"), - // Tier: to.Ptr("Hyperscale"), - // }, - // Status: to.Ptr(armsql.CapabilityStatusDefault), - // SupportedLicenseTypes: []*armsql.LicenseTypeCapability{ - // { - // Name: to.Ptr("LicenseIncluded"), - // Status: to.Ptr(armsql.CapabilityStatusDefault), - // }, - // { - // Name: to.Ptr("BasePrice"), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // }}, - // SupportedMaintenanceConfigurations: []*armsql.MaintenanceConfigurationCapability{ - // { - // Name: to.Ptr("SQL_Default"), - // Status: to.Ptr(armsql.CapabilityStatusDefault), - // ZoneRedundant: to.Ptr(false), - // }}, - // ZoneRedundant: to.Ptr(false), - // }, - // { - // Name: to.Ptr("HS_Gen4_3"), - // ComputeModel: to.Ptr("Provisioned"), - // ID: to.Ptr("5de845d2-2055-428c-b507-94131358cdd7"), - // PerformanceLevel: &armsql.PerformanceLevelCapability{ - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // Value: to.Ptr[float64](3), - // }, - // SKU: &armsql.SKU{ - // Name: to.Ptr("HS_Gen4"), - // Capacity: to.Ptr[int32](3), - // Family: to.Ptr("Gen4"), - // Tier: to.Ptr("Hyperscale"), - // }, - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // SupportedLicenseTypes: []*armsql.LicenseTypeCapability{ - // { - // Name: to.Ptr("LicenseIncluded"), - // Status: to.Ptr(armsql.CapabilityStatusDefault), - // }, - // { - // Name: to.Ptr("BasePrice"), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // }}, - // SupportedMaintenanceConfigurations: []*armsql.MaintenanceConfigurationCapability{ - // { - // Name: to.Ptr("SQL_Default"), - // Status: to.Ptr(armsql.CapabilityStatusDefault), - // ZoneRedundant: to.Ptr(false), - // }}, - // ZoneRedundant: to.Ptr(false), - // }, - // { - // Name: to.Ptr("HS_Gen4_4"), - // ComputeModel: to.Ptr("Provisioned"), - // ID: to.Ptr("d060b874-21f3-47b0-a9bd-a1a737cfcc6e"), - // PerformanceLevel: &armsql.PerformanceLevelCapability{ - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // Value: to.Ptr[float64](4), - // }, - // SKU: &armsql.SKU{ - // Name: to.Ptr("HS_Gen4"), - // Capacity: to.Ptr[int32](4), - // Family: to.Ptr("Gen4"), - // Tier: to.Ptr("Hyperscale"), - // }, - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // SupportedLicenseTypes: []*armsql.LicenseTypeCapability{ - // { - // Name: to.Ptr("LicenseIncluded"), - // Status: to.Ptr(armsql.CapabilityStatusDefault), - // }, - // { - // Name: to.Ptr("BasePrice"), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // }}, - // SupportedMaintenanceConfigurations: []*armsql.MaintenanceConfigurationCapability{ - // { - // Name: to.Ptr("SQL_Default"), - // Status: to.Ptr(armsql.CapabilityStatusDefault), - // ZoneRedundant: to.Ptr(false), - // }}, - // ZoneRedundant: to.Ptr(false), - // }, - // { - // Name: to.Ptr("HS_Gen5_4"), - // ComputeModel: to.Ptr("Provisioned"), - // ID: to.Ptr("60dba88b-2dfa-4123-be57-bd0dbfd92a72"), - // PerformanceLevel: &armsql.PerformanceLevelCapability{ - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // Value: to.Ptr[float64](4), - // }, - // SKU: &armsql.SKU{ - // Name: to.Ptr("HS_Gen5"), - // Capacity: to.Ptr[int32](4), - // Family: to.Ptr("Gen5"), - // Tier: to.Ptr("Hyperscale"), - // }, - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // SupportedLicenseTypes: []*armsql.LicenseTypeCapability{ - // { - // Name: to.Ptr("LicenseIncluded"), - // Status: to.Ptr(armsql.CapabilityStatusDefault), - // }, - // { - // Name: to.Ptr("BasePrice"), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // }}, - // SupportedMaintenanceConfigurations: []*armsql.MaintenanceConfigurationCapability{ - // { - // Name: to.Ptr("SQL_Default"), - // Status: to.Ptr(armsql.CapabilityStatusDefault), - // ZoneRedundant: to.Ptr(false), - // }}, - // ZoneRedundant: to.Ptr(false), - // }, - // { - // Name: to.Ptr("HS_Gen4_5"), - // ComputeModel: to.Ptr("Provisioned"), - // ID: to.Ptr("925a0916-15fb-4764-aa76-533d97f2d782"), - // PerformanceLevel: &armsql.PerformanceLevelCapability{ - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // Value: to.Ptr[float64](5), - // }, - // SKU: &armsql.SKU{ - // Name: to.Ptr("HS_Gen4"), - // Capacity: to.Ptr[int32](5), - // Family: to.Ptr("Gen4"), - // Tier: to.Ptr("Hyperscale"), - // }, - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // SupportedLicenseTypes: []*armsql.LicenseTypeCapability{ - // { - // Name: to.Ptr("LicenseIncluded"), - // Status: to.Ptr(armsql.CapabilityStatusDefault), - // }, - // { - // Name: to.Ptr("BasePrice"), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // }}, - // SupportedMaintenanceConfigurations: []*armsql.MaintenanceConfigurationCapability{ - // { - // Name: to.Ptr("SQL_Default"), - // Status: to.Ptr(armsql.CapabilityStatusDefault), - // ZoneRedundant: to.Ptr(false), - // }}, - // ZoneRedundant: to.Ptr(false), - // }, - // { - // Name: to.Ptr("HS_Gen4_6"), - // ComputeModel: to.Ptr("Provisioned"), - // ID: to.Ptr("d7aa11c2-e4c7-442a-962e-308b371f5ec1"), - // PerformanceLevel: &armsql.PerformanceLevelCapability{ - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // Value: to.Ptr[float64](6), - // }, - // SKU: &armsql.SKU{ - // Name: to.Ptr("HS_Gen4"), - // Capacity: to.Ptr[int32](6), - // Family: to.Ptr("Gen4"), - // Tier: to.Ptr("Hyperscale"), - // }, - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // SupportedLicenseTypes: []*armsql.LicenseTypeCapability{ - // { - // Name: to.Ptr("LicenseIncluded"), - // Status: to.Ptr(armsql.CapabilityStatusDefault), - // }, - // { - // Name: to.Ptr("BasePrice"), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // }}, - // SupportedMaintenanceConfigurations: []*armsql.MaintenanceConfigurationCapability{ - // { - // Name: to.Ptr("SQL_Default"), - // Status: to.Ptr(armsql.CapabilityStatusDefault), - // ZoneRedundant: to.Ptr(false), - // }}, - // ZoneRedundant: to.Ptr(false), - // }, - // { - // Name: to.Ptr("HS_Gen5_6"), - // ComputeModel: to.Ptr("Provisioned"), - // ID: to.Ptr("b9c594ec-a3fe-4bfe-808d-a595410d0a07"), - // PerformanceLevel: &armsql.PerformanceLevelCapability{ - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // Value: to.Ptr[float64](6), - // }, - // SKU: &armsql.SKU{ - // Name: to.Ptr("HS_Gen5"), - // Capacity: to.Ptr[int32](6), - // Family: to.Ptr("Gen5"), - // Tier: to.Ptr("Hyperscale"), - // }, - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // SupportedLicenseTypes: []*armsql.LicenseTypeCapability{ - // { - // Name: to.Ptr("LicenseIncluded"), - // Status: to.Ptr(armsql.CapabilityStatusDefault), - // }, - // { - // Name: to.Ptr("BasePrice"), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // }}, - // SupportedMaintenanceConfigurations: []*armsql.MaintenanceConfigurationCapability{ - // { - // Name: to.Ptr("SQL_Default"), - // Status: to.Ptr(armsql.CapabilityStatusDefault), - // ZoneRedundant: to.Ptr(false), - // }}, - // ZoneRedundant: to.Ptr(false), - // }, - // { - // Name: to.Ptr("HS_Gen4_7"), - // ComputeModel: to.Ptr("Provisioned"), - // ID: to.Ptr("d77eef57-6c00-4003-b140-822509b8736a"), - // PerformanceLevel: &armsql.PerformanceLevelCapability{ - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // Value: to.Ptr[float64](7), - // }, - // SKU: &armsql.SKU{ - // Name: to.Ptr("HS_Gen4"), - // Capacity: to.Ptr[int32](7), - // Family: to.Ptr("Gen4"), - // Tier: to.Ptr("Hyperscale"), - // }, - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // SupportedLicenseTypes: []*armsql.LicenseTypeCapability{ - // { - // Name: to.Ptr("LicenseIncluded"), - // Status: to.Ptr(armsql.CapabilityStatusDefault), - // }, - // { - // Name: to.Ptr("BasePrice"), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // }}, - // SupportedMaintenanceConfigurations: []*armsql.MaintenanceConfigurationCapability{ - // { - // Name: to.Ptr("SQL_Default"), - // Status: to.Ptr(armsql.CapabilityStatusDefault), - // ZoneRedundant: to.Ptr(false), - // }}, - // ZoneRedundant: to.Ptr(false), - // }, - // { - // Name: to.Ptr("HS_Gen4_8"), - // ComputeModel: to.Ptr("Provisioned"), - // ID: to.Ptr("694bf389-7cb2-4461-8fa2-0b06d8438315"), - // PerformanceLevel: &armsql.PerformanceLevelCapability{ - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // Value: to.Ptr[float64](8), - // }, - // SKU: &armsql.SKU{ - // Name: to.Ptr("HS_Gen4"), - // Capacity: to.Ptr[int32](8), - // Family: to.Ptr("Gen4"), - // Tier: to.Ptr("Hyperscale"), - // }, - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // SupportedLicenseTypes: []*armsql.LicenseTypeCapability{ - // { - // Name: to.Ptr("LicenseIncluded"), - // Status: to.Ptr(armsql.CapabilityStatusDefault), - // }, - // { - // Name: to.Ptr("BasePrice"), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // }}, - // SupportedMaintenanceConfigurations: []*armsql.MaintenanceConfigurationCapability{ - // { - // Name: to.Ptr("SQL_Default"), - // Status: to.Ptr(armsql.CapabilityStatusDefault), - // ZoneRedundant: to.Ptr(false), - // }}, - // ZoneRedundant: to.Ptr(false), - // }, - // { - // Name: to.Ptr("HS_Gen5_8"), - // ComputeModel: to.Ptr("Provisioned"), - // ID: to.Ptr("efdfac5f-3f8e-4500-95b1-684c07349860"), - // PerformanceLevel: &armsql.PerformanceLevelCapability{ - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // Value: to.Ptr[float64](8), - // }, - // SKU: &armsql.SKU{ - // Name: to.Ptr("HS_Gen5"), - // Capacity: to.Ptr[int32](8), - // Family: to.Ptr("Gen5"), - // Tier: to.Ptr("Hyperscale"), - // }, - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // SupportedLicenseTypes: []*armsql.LicenseTypeCapability{ - // { - // Name: to.Ptr("LicenseIncluded"), - // Status: to.Ptr(armsql.CapabilityStatusDefault), - // }, - // { - // Name: to.Ptr("BasePrice"), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // }}, - // SupportedMaintenanceConfigurations: []*armsql.MaintenanceConfigurationCapability{ - // { - // Name: to.Ptr("SQL_Default"), - // Status: to.Ptr(armsql.CapabilityStatusDefault), - // ZoneRedundant: to.Ptr(false), - // }}, - // ZoneRedundant: to.Ptr(false), - // }, - // { - // Name: to.Ptr("HS_Gen4_9"), - // ComputeModel: to.Ptr("Provisioned"), - // ID: to.Ptr("554ea52a-9ecc-4d87-bbc7-1e257705da3f"), - // PerformanceLevel: &armsql.PerformanceLevelCapability{ - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // Value: to.Ptr[float64](9), - // }, - // SKU: &armsql.SKU{ - // Name: to.Ptr("HS_Gen4"), - // Capacity: to.Ptr[int32](9), - // Family: to.Ptr("Gen4"), - // Tier: to.Ptr("Hyperscale"), - // }, - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // SupportedLicenseTypes: []*armsql.LicenseTypeCapability{ - // { - // Name: to.Ptr("LicenseIncluded"), - // Status: to.Ptr(armsql.CapabilityStatusDefault), - // }, - // { - // Name: to.Ptr("BasePrice"), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // }}, - // SupportedMaintenanceConfigurations: []*armsql.MaintenanceConfigurationCapability{ - // { - // Name: to.Ptr("SQL_Default"), - // Status: to.Ptr(armsql.CapabilityStatusDefault), - // ZoneRedundant: to.Ptr(false), - // }}, - // ZoneRedundant: to.Ptr(false), - // }, - // { - // Name: to.Ptr("HS_Gen4_10"), - // ComputeModel: to.Ptr("Provisioned"), - // ID: to.Ptr("576f3f38-b950-4eaa-b74e-33d831193441"), - // PerformanceLevel: &armsql.PerformanceLevelCapability{ - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // Value: to.Ptr[float64](10), - // }, - // SKU: &armsql.SKU{ - // Name: to.Ptr("HS_Gen4"), - // Capacity: to.Ptr[int32](10), - // Family: to.Ptr("Gen4"), - // Tier: to.Ptr("Hyperscale"), - // }, - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // SupportedLicenseTypes: []*armsql.LicenseTypeCapability{ - // { - // Name: to.Ptr("LicenseIncluded"), - // Status: to.Ptr(armsql.CapabilityStatusDefault), - // }, - // { - // Name: to.Ptr("BasePrice"), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // }}, - // SupportedMaintenanceConfigurations: []*armsql.MaintenanceConfigurationCapability{ - // { - // Name: to.Ptr("SQL_Default"), - // Status: to.Ptr(armsql.CapabilityStatusDefault), - // ZoneRedundant: to.Ptr(false), - // }}, - // ZoneRedundant: to.Ptr(false), - // }, - // { - // Name: to.Ptr("HS_Gen5_10"), - // ComputeModel: to.Ptr("Provisioned"), - // ID: to.Ptr("69697c3a-1946-4eb8-a5a4-a269168dde27"), - // PerformanceLevel: &armsql.PerformanceLevelCapability{ - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // Value: to.Ptr[float64](10), - // }, - // SKU: &armsql.SKU{ - // Name: to.Ptr("HS_Gen5"), - // Capacity: to.Ptr[int32](10), - // Family: to.Ptr("Gen5"), - // Tier: to.Ptr("Hyperscale"), - // }, - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // SupportedLicenseTypes: []*armsql.LicenseTypeCapability{ - // { - // Name: to.Ptr("LicenseIncluded"), - // Status: to.Ptr(armsql.CapabilityStatusDefault), - // }, - // { - // Name: to.Ptr("BasePrice"), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // }}, - // SupportedMaintenanceConfigurations: []*armsql.MaintenanceConfigurationCapability{ - // { - // Name: to.Ptr("SQL_Default"), - // Status: to.Ptr(armsql.CapabilityStatusDefault), - // ZoneRedundant: to.Ptr(false), - // }}, - // ZoneRedundant: to.Ptr(false), - // }, - // { - // Name: to.Ptr("HS_Gen5_12"), - // ComputeModel: to.Ptr("Provisioned"), - // ID: to.Ptr("1bee9dc8-68b4-44df-b870-8ab0e4d71e94"), - // PerformanceLevel: &armsql.PerformanceLevelCapability{ - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // Value: to.Ptr[float64](12), - // }, - // SKU: &armsql.SKU{ - // Name: to.Ptr("HS_Gen5"), - // Capacity: to.Ptr[int32](12), - // Family: to.Ptr("Gen5"), - // Tier: to.Ptr("Hyperscale"), - // }, - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // SupportedLicenseTypes: []*armsql.LicenseTypeCapability{ - // { - // Name: to.Ptr("LicenseIncluded"), - // Status: to.Ptr(armsql.CapabilityStatusDefault), - // }, - // { - // Name: to.Ptr("BasePrice"), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // }}, - // SupportedMaintenanceConfigurations: []*armsql.MaintenanceConfigurationCapability{ - // { - // Name: to.Ptr("SQL_Default"), - // Status: to.Ptr(armsql.CapabilityStatusDefault), - // ZoneRedundant: to.Ptr(false), - // }}, - // ZoneRedundant: to.Ptr(false), - // }, - // { - // Name: to.Ptr("HS_Gen5_14"), - // ComputeModel: to.Ptr("Provisioned"), - // ID: to.Ptr("07a8341d-c0b2-4000-bc7a-5b4dae2ad210"), - // PerformanceLevel: &armsql.PerformanceLevelCapability{ - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // Value: to.Ptr[float64](14), - // }, - // SKU: &armsql.SKU{ - // Name: to.Ptr("HS_Gen5"), - // Capacity: to.Ptr[int32](14), - // Family: to.Ptr("Gen5"), - // Tier: to.Ptr("Hyperscale"), - // }, - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // SupportedLicenseTypes: []*armsql.LicenseTypeCapability{ - // { - // Name: to.Ptr("LicenseIncluded"), - // Status: to.Ptr(armsql.CapabilityStatusDefault), - // }, - // { - // Name: to.Ptr("BasePrice"), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // }}, - // SupportedMaintenanceConfigurations: []*armsql.MaintenanceConfigurationCapability{ - // { - // Name: to.Ptr("SQL_Default"), - // Status: to.Ptr(armsql.CapabilityStatusDefault), - // ZoneRedundant: to.Ptr(false), - // }}, - // ZoneRedundant: to.Ptr(false), - // }, - // { - // Name: to.Ptr("HS_Gen4_16"), - // ComputeModel: to.Ptr("Provisioned"), - // ID: to.Ptr("7fc1f700-a45d-499e-901f-2a00645c54db"), - // PerformanceLevel: &armsql.PerformanceLevelCapability{ - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // Value: to.Ptr[float64](16), - // }, - // SKU: &armsql.SKU{ - // Name: to.Ptr("HS_Gen4"), - // Capacity: to.Ptr[int32](16), - // Family: to.Ptr("Gen4"), - // Tier: to.Ptr("Hyperscale"), - // }, - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // SupportedLicenseTypes: []*armsql.LicenseTypeCapability{ - // { - // Name: to.Ptr("LicenseIncluded"), - // Status: to.Ptr(armsql.CapabilityStatusDefault), - // }, - // { - // Name: to.Ptr("BasePrice"), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // }}, - // SupportedMaintenanceConfigurations: []*armsql.MaintenanceConfigurationCapability{ - // { - // Name: to.Ptr("SQL_Default"), - // Status: to.Ptr(armsql.CapabilityStatusDefault), - // ZoneRedundant: to.Ptr(false), - // }}, - // ZoneRedundant: to.Ptr(false), - // }, - // { - // Name: to.Ptr("HS_Gen5_16"), - // ComputeModel: to.Ptr("Provisioned"), - // ID: to.Ptr("6b56f70b-52e5-44ba-8cd5-4f63d224b206"), - // PerformanceLevel: &armsql.PerformanceLevelCapability{ - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // Value: to.Ptr[float64](16), - // }, - // SKU: &armsql.SKU{ - // Name: to.Ptr("HS_Gen5"), - // Capacity: to.Ptr[int32](16), - // Family: to.Ptr("Gen5"), - // Tier: to.Ptr("Hyperscale"), - // }, - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // SupportedLicenseTypes: []*armsql.LicenseTypeCapability{ - // { - // Name: to.Ptr("LicenseIncluded"), - // Status: to.Ptr(armsql.CapabilityStatusDefault), - // }, - // { - // Name: to.Ptr("BasePrice"), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // }}, - // SupportedMaintenanceConfigurations: []*armsql.MaintenanceConfigurationCapability{ - // { - // Name: to.Ptr("SQL_Default"), - // Status: to.Ptr(armsql.CapabilityStatusDefault), - // ZoneRedundant: to.Ptr(false), - // }}, - // ZoneRedundant: to.Ptr(false), - // }, - // { - // Name: to.Ptr("HS_Gen5_18"), - // ComputeModel: to.Ptr("Provisioned"), - // ID: to.Ptr("ba0029f2-3ff4-4ef6-9e65-e8f77b5dd1e2"), - // PerformanceLevel: &armsql.PerformanceLevelCapability{ - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // Value: to.Ptr[float64](18), - // }, - // SKU: &armsql.SKU{ - // Name: to.Ptr("HS_Gen5"), - // Capacity: to.Ptr[int32](18), - // Family: to.Ptr("Gen5"), - // Tier: to.Ptr("Hyperscale"), - // }, - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // SupportedLicenseTypes: []*armsql.LicenseTypeCapability{ - // { - // Name: to.Ptr("LicenseIncluded"), - // Status: to.Ptr(armsql.CapabilityStatusDefault), - // }, - // { - // Name: to.Ptr("BasePrice"), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // }}, - // SupportedMaintenanceConfigurations: []*armsql.MaintenanceConfigurationCapability{ - // { - // Name: to.Ptr("SQL_Default"), - // Status: to.Ptr(armsql.CapabilityStatusDefault), - // ZoneRedundant: to.Ptr(false), - // }}, - // ZoneRedundant: to.Ptr(false), - // }, - // { - // Name: to.Ptr("HS_Gen5_20"), - // ComputeModel: to.Ptr("Provisioned"), - // ID: to.Ptr("f1b2a082-f622-4fb8-bbef-e74deac3ec89"), - // PerformanceLevel: &armsql.PerformanceLevelCapability{ - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // Value: to.Ptr[float64](20), - // }, - // SKU: &armsql.SKU{ - // Name: to.Ptr("HS_Gen5"), - // Capacity: to.Ptr[int32](20), - // Family: to.Ptr("Gen5"), - // Tier: to.Ptr("Hyperscale"), - // }, - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // SupportedLicenseTypes: []*armsql.LicenseTypeCapability{ - // { - // Name: to.Ptr("LicenseIncluded"), - // Status: to.Ptr(armsql.CapabilityStatusDefault), - // }, - // { - // Name: to.Ptr("BasePrice"), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // }}, - // SupportedMaintenanceConfigurations: []*armsql.MaintenanceConfigurationCapability{ - // { - // Name: to.Ptr("SQL_Default"), - // Status: to.Ptr(armsql.CapabilityStatusDefault), - // ZoneRedundant: to.Ptr(false), - // }}, - // ZoneRedundant: to.Ptr(false), - // }, - // { - // Name: to.Ptr("HS_Gen4_24"), - // ComputeModel: to.Ptr("Provisioned"), - // ID: to.Ptr("f016d419-a031-4b93-ab62-7f3d2a789376"), - // PerformanceLevel: &armsql.PerformanceLevelCapability{ - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // Value: to.Ptr[float64](24), - // }, - // SKU: &armsql.SKU{ - // Name: to.Ptr("HS_Gen4"), - // Capacity: to.Ptr[int32](24), - // Family: to.Ptr("Gen4"), - // Tier: to.Ptr("Hyperscale"), - // }, - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // SupportedLicenseTypes: []*armsql.LicenseTypeCapability{ - // { - // Name: to.Ptr("LicenseIncluded"), - // Status: to.Ptr(armsql.CapabilityStatusDefault), - // }, - // { - // Name: to.Ptr("BasePrice"), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // }}, - // SupportedMaintenanceConfigurations: []*armsql.MaintenanceConfigurationCapability{ - // { - // Name: to.Ptr("SQL_Default"), - // Status: to.Ptr(armsql.CapabilityStatusDefault), - // ZoneRedundant: to.Ptr(false), - // }}, - // ZoneRedundant: to.Ptr(false), - // }, - // { - // Name: to.Ptr("HS_Gen5_24"), - // ComputeModel: to.Ptr("Provisioned"), - // ID: to.Ptr("222bc0ee-e195-4bbc-be05-3b849c3a8195"), - // PerformanceLevel: &armsql.PerformanceLevelCapability{ - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // Value: to.Ptr[float64](24), - // }, - // SKU: &armsql.SKU{ - // Name: to.Ptr("HS_Gen5"), - // Capacity: to.Ptr[int32](24), - // Family: to.Ptr("Gen5"), - // Tier: to.Ptr("Hyperscale"), - // }, - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // SupportedLicenseTypes: []*armsql.LicenseTypeCapability{ - // { - // Name: to.Ptr("LicenseIncluded"), - // Status: to.Ptr(armsql.CapabilityStatusDefault), - // }, - // { - // Name: to.Ptr("BasePrice"), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // }}, - // SupportedMaintenanceConfigurations: []*armsql.MaintenanceConfigurationCapability{ - // { - // Name: to.Ptr("SQL_Default"), - // Status: to.Ptr(armsql.CapabilityStatusDefault), - // ZoneRedundant: to.Ptr(false), - // }}, - // ZoneRedundant: to.Ptr(false), - // }, - // { - // Name: to.Ptr("HS_Gen5_32"), - // ComputeModel: to.Ptr("Provisioned"), - // ID: to.Ptr("05366cca-cc70-486e-a697-bb3fab877f75"), - // PerformanceLevel: &armsql.PerformanceLevelCapability{ - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // Value: to.Ptr[float64](32), - // }, - // SKU: &armsql.SKU{ - // Name: to.Ptr("HS_Gen5"), - // Capacity: to.Ptr[int32](32), - // Family: to.Ptr("Gen5"), - // Tier: to.Ptr("Hyperscale"), - // }, - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // SupportedLicenseTypes: []*armsql.LicenseTypeCapability{ - // { - // Name: to.Ptr("LicenseIncluded"), - // Status: to.Ptr(armsql.CapabilityStatusDefault), - // }, - // { - // Name: to.Ptr("BasePrice"), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // }}, - // SupportedMaintenanceConfigurations: []*armsql.MaintenanceConfigurationCapability{ - // { - // Name: to.Ptr("SQL_Default"), - // Status: to.Ptr(armsql.CapabilityStatusDefault), - // ZoneRedundant: to.Ptr(false), - // }}, - // ZoneRedundant: to.Ptr(false), - // }, - // { - // Name: to.Ptr("HS_Gen5_40"), - // ComputeModel: to.Ptr("Provisioned"), - // ID: to.Ptr("32542ef7-124d-4e66-8b41-9c6c0ab963c2"), - // PerformanceLevel: &armsql.PerformanceLevelCapability{ - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // Value: to.Ptr[float64](40), - // }, - // SKU: &armsql.SKU{ - // Name: to.Ptr("HS_Gen5"), - // Capacity: to.Ptr[int32](40), - // Family: to.Ptr("Gen5"), - // Tier: to.Ptr("Hyperscale"), - // }, - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // SupportedLicenseTypes: []*armsql.LicenseTypeCapability{ - // { - // Name: to.Ptr("LicenseIncluded"), - // Status: to.Ptr(armsql.CapabilityStatusDefault), - // }, - // { - // Name: to.Ptr("BasePrice"), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // }}, - // SupportedMaintenanceConfigurations: []*armsql.MaintenanceConfigurationCapability{ - // { - // Name: to.Ptr("SQL_Default"), - // Status: to.Ptr(armsql.CapabilityStatusDefault), - // ZoneRedundant: to.Ptr(false), - // }}, - // ZoneRedundant: to.Ptr(false), - // }, - // { - // Name: to.Ptr("HS_Gen5_80"), - // ComputeModel: to.Ptr("Provisioned"), - // ID: to.Ptr("6509db45-febe-44dd-a079-35f11d477984"), - // PerformanceLevel: &armsql.PerformanceLevelCapability{ - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // Value: to.Ptr[float64](80), - // }, - // SKU: &armsql.SKU{ - // Name: to.Ptr("HS_Gen5"), - // Capacity: to.Ptr[int32](80), - // Family: to.Ptr("Gen5"), - // Tier: to.Ptr("Hyperscale"), - // }, - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // SupportedLicenseTypes: []*armsql.LicenseTypeCapability{ - // { - // Name: to.Ptr("LicenseIncluded"), - // Status: to.Ptr(armsql.CapabilityStatusDefault), - // }, - // { - // Name: to.Ptr("BasePrice"), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // }}, - // SupportedMaintenanceConfigurations: []*armsql.MaintenanceConfigurationCapability{ - // { - // Name: to.Ptr("SQL_Default"), - // Status: to.Ptr(armsql.CapabilityStatusDefault), - // ZoneRedundant: to.Ptr(false), - // }}, - // ZoneRedundant: to.Ptr(false), - // }}, - // SupportedStorageCapabilities: []*armsql.StorageCapability{ - // { - // Status: to.Ptr(armsql.CapabilityStatusDefault), - // StorageAccountType: to.Ptr(armsql.StorageCapabilityStorageAccountTypeGRS), - // }, - // { - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // StorageAccountType: to.Ptr(armsql.StorageCapabilityStorageAccountTypeLRS), - // }, - // { - // Reason: to.Ptr("ZRS is available in multi-az regions"), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // StorageAccountType: to.Ptr(armsql.StorageCapabilityStorageAccountTypeZRS), - // }}, - // ZoneRedundant: to.Ptr(false), - // }}, - // SupportedElasticPoolEditions: []*armsql.ElasticPoolEditionCapability{ - // { - // Name: to.Ptr("BusinessCritical"), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // SupportedElasticPoolPerformanceLevels: []*armsql.ElasticPoolPerformanceLevelCapability{ - // { - // MaxDatabaseCount: to.Ptr[int32](100), - // PerformanceLevel: &armsql.PerformanceLevelCapability{ - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // Value: to.Ptr[float64](3), - // }, - // SKU: &armsql.SKU{ - // Name: to.Ptr("BC_Gen4"), - // Capacity: to.Ptr[int32](3), - // Family: to.Ptr("Gen4"), - // Tier: to.Ptr("BusinessCritical"), - // }, - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // SupportedLicenseTypes: []*armsql.LicenseTypeCapability{ - // { - // Name: to.Ptr("LicenseIncluded"), - // Status: to.Ptr(armsql.CapabilityStatusDefault), - // }, - // { - // Name: to.Ptr("BasePrice"), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // }}, - // SupportedMaintenanceConfigurations: []*armsql.MaintenanceConfigurationCapability{ - // { - // Name: to.Ptr("SQL_Default"), - // Status: to.Ptr(armsql.CapabilityStatusDefault), - // ZoneRedundant: to.Ptr(false), - // }, - // { - // Name: to.Ptr("SQL_EastUS_DB_1"), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // ZoneRedundant: to.Ptr(false), - // }, - // { - // Name: to.Ptr("SQL_EastUS_DB_2"), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // ZoneRedundant: to.Ptr(false), - // }}, - // SupportedMaxSizes: []*armsql.MaxSizeRangeCapability{ - // { - // LogSize: &armsql.LogSizeCapability{ - // Limit: to.Ptr[int32](30), - // Unit: to.Ptr(armsql.LogSizeUnitPercent), - // }, - // MaxValue: &armsql.MaxSizeCapability{ - // Limit: to.Ptr[int32](31744), - // Unit: to.Ptr(armsql.MaxSizeUnitMegabytes), - // }, - // MinValue: &armsql.MaxSizeCapability{ - // Limit: to.Ptr[int32](1024), - // Unit: to.Ptr(armsql.MaxSizeUnitMegabytes), - // }, - // ScaleSize: &armsql.MaxSizeCapability{ - // Limit: to.Ptr[int32](1024), - // Unit: to.Ptr(armsql.MaxSizeUnitMegabytes), - // }, - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // }, - // { - // LogSize: &armsql.LogSizeCapability{ - // Limit: to.Ptr[int32](30), - // Unit: to.Ptr(armsql.LogSizeUnitPercent), - // }, - // MaxValue: &armsql.MaxSizeCapability{ - // Limit: to.Ptr[int32](32768), - // Unit: to.Ptr(armsql.MaxSizeUnitMegabytes), - // }, - // MinValue: &armsql.MaxSizeCapability{ - // Limit: to.Ptr[int32](32768), - // Unit: to.Ptr(armsql.MaxSizeUnitMegabytes), - // }, - // ScaleSize: &armsql.MaxSizeCapability{ - // Limit: to.Ptr[int32](0), - // Unit: to.Ptr(armsql.MaxSizeUnitMegabytes), - // }, - // Status: to.Ptr(armsql.CapabilityStatusDefault), - // }, - // { - // LogSize: &armsql.LogSizeCapability{ - // Limit: to.Ptr[int32](30), - // Unit: to.Ptr(armsql.LogSizeUnitPercent), - // }, - // MaxValue: &armsql.MaxSizeCapability{ - // Limit: to.Ptr[int32](1048576), - // Unit: to.Ptr(armsql.MaxSizeUnitMegabytes), - // }, - // MinValue: &armsql.MaxSizeCapability{ - // Limit: to.Ptr[int32](33792), - // Unit: to.Ptr(armsql.MaxSizeUnitMegabytes), - // }, - // ScaleSize: &armsql.MaxSizeCapability{ - // Limit: to.Ptr[int32](1024), - // Unit: to.Ptr(armsql.MaxSizeUnitMegabytes), - // }, - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // }}, - // SupportedPerDatabaseMaxPerformanceLevels: []*armsql.ElasticPoolPerDatabaseMaxPerformanceLevelCapability{ - // { - // Limit: to.Ptr[float64](0.25), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // SupportedPerDatabaseMinPerformanceLevels: []*armsql.ElasticPoolPerDatabaseMinPerformanceLevelCapability{ - // { - // Limit: to.Ptr[float64](0), - // Status: to.Ptr(armsql.CapabilityStatusDefault), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](0.25), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }}, - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](0.5), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // SupportedPerDatabaseMinPerformanceLevels: []*armsql.ElasticPoolPerDatabaseMinPerformanceLevelCapability{ - // { - // Limit: to.Ptr[float64](0), - // Status: to.Ptr(armsql.CapabilityStatusDefault), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](0.25), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](0.5), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }}, - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](1), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // SupportedPerDatabaseMinPerformanceLevels: []*armsql.ElasticPoolPerDatabaseMinPerformanceLevelCapability{ - // { - // Limit: to.Ptr[float64](0), - // Status: to.Ptr(armsql.CapabilityStatusDefault), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](0.25), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](0.5), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](1), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }}, - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](2), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // SupportedPerDatabaseMinPerformanceLevels: []*armsql.ElasticPoolPerDatabaseMinPerformanceLevelCapability{ - // { - // Limit: to.Ptr[float64](0), - // Status: to.Ptr(armsql.CapabilityStatusDefault), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](0.25), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](0.5), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](1), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](2), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }}, - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](3), - // Status: to.Ptr(armsql.CapabilityStatusDefault), - // SupportedPerDatabaseMinPerformanceLevels: []*armsql.ElasticPoolPerDatabaseMinPerformanceLevelCapability{ - // { - // Limit: to.Ptr[float64](0), - // Status: to.Ptr(armsql.CapabilityStatusDefault), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](0.25), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](0.5), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](1), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](2), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](3), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }}, - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }}, - // SupportedPerDatabaseMaxSizes: []*armsql.MaxSizeRangeCapability{ - // { - // MaxValue: &armsql.MaxSizeCapability{ - // Limit: to.Ptr[int32](31744), - // Unit: to.Ptr(armsql.MaxSizeUnitMegabytes), - // }, - // MinValue: &armsql.MaxSizeCapability{ - // Limit: to.Ptr[int32](1024), - // Unit: to.Ptr(armsql.MaxSizeUnitMegabytes), - // }, - // ScaleSize: &armsql.MaxSizeCapability{ - // Limit: to.Ptr[int32](1024), - // Unit: to.Ptr(armsql.MaxSizeUnitMegabytes), - // }, - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // }, - // { - // MaxValue: &armsql.MaxSizeCapability{ - // Limit: to.Ptr[int32](32768), - // Unit: to.Ptr(armsql.MaxSizeUnitMegabytes), - // }, - // MinValue: &armsql.MaxSizeCapability{ - // Limit: to.Ptr[int32](32768), - // Unit: to.Ptr(armsql.MaxSizeUnitMegabytes), - // }, - // ScaleSize: &armsql.MaxSizeCapability{ - // Limit: to.Ptr[int32](0), - // Unit: to.Ptr(armsql.MaxSizeUnitMegabytes), - // }, - // Status: to.Ptr(armsql.CapabilityStatusDefault), - // }, - // { - // MaxValue: &armsql.MaxSizeCapability{ - // Limit: to.Ptr[int32](1048576), - // Unit: to.Ptr(armsql.MaxSizeUnitMegabytes), - // }, - // MinValue: &armsql.MaxSizeCapability{ - // Limit: to.Ptr[int32](33792), - // Unit: to.Ptr(armsql.MaxSizeUnitMegabytes), - // }, - // ScaleSize: &armsql.MaxSizeCapability{ - // Limit: to.Ptr[int32](1024), - // Unit: to.Ptr(armsql.MaxSizeUnitMegabytes), - // }, - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // }}, - // ZoneRedundant: to.Ptr(false), - // }, - // { - // MaxDatabaseCount: to.Ptr[int32](100), - // PerformanceLevel: &armsql.PerformanceLevelCapability{ - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // Value: to.Ptr[float64](12), - // }, - // SKU: &armsql.SKU{ - // Name: to.Ptr("BC_Gen5"), - // Capacity: to.Ptr[int32](12), - // Family: to.Ptr("Gen5"), - // Tier: to.Ptr("BusinessCritical"), - // }, - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // SupportedLicenseTypes: []*armsql.LicenseTypeCapability{ - // { - // Name: to.Ptr("LicenseIncluded"), - // Status: to.Ptr(armsql.CapabilityStatusDefault), - // }, - // { - // Name: to.Ptr("BasePrice"), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // }}, - // SupportedMaintenanceConfigurations: []*armsql.MaintenanceConfigurationCapability{ - // { - // Name: to.Ptr("SQL_Default"), - // Status: to.Ptr(armsql.CapabilityStatusDefault), - // ZoneRedundant: to.Ptr(false), - // }, - // { - // Name: to.Ptr("SQL_EastUS_DB_1"), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // ZoneRedundant: to.Ptr(false), - // }, - // { - // Name: to.Ptr("SQL_EastUS_DB_2"), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // ZoneRedundant: to.Ptr(false), - // }}, - // SupportedMaxSizes: []*armsql.MaxSizeRangeCapability{ - // { - // LogSize: &armsql.LogSizeCapability{ - // Limit: to.Ptr[int32](30), - // Unit: to.Ptr(armsql.LogSizeUnitPercent), - // }, - // MaxValue: &armsql.MaxSizeCapability{ - // Limit: to.Ptr[int32](31744), - // Unit: to.Ptr(armsql.MaxSizeUnitMegabytes), - // }, - // MinValue: &armsql.MaxSizeCapability{ - // Limit: to.Ptr[int32](1024), - // Unit: to.Ptr(armsql.MaxSizeUnitMegabytes), - // }, - // ScaleSize: &armsql.MaxSizeCapability{ - // Limit: to.Ptr[int32](1024), - // Unit: to.Ptr(armsql.MaxSizeUnitMegabytes), - // }, - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // }, - // { - // LogSize: &armsql.LogSizeCapability{ - // Limit: to.Ptr[int32](30), - // Unit: to.Ptr(armsql.LogSizeUnitPercent), - // }, - // MaxValue: &armsql.MaxSizeCapability{ - // Limit: to.Ptr[int32](32768), - // Unit: to.Ptr(armsql.MaxSizeUnitMegabytes), - // }, - // MinValue: &armsql.MaxSizeCapability{ - // Limit: to.Ptr[int32](32768), - // Unit: to.Ptr(armsql.MaxSizeUnitMegabytes), - // }, - // ScaleSize: &armsql.MaxSizeCapability{ - // Limit: to.Ptr[int32](0), - // Unit: to.Ptr(armsql.MaxSizeUnitMegabytes), - // }, - // Status: to.Ptr(armsql.CapabilityStatusDefault), - // }, - // { - // LogSize: &armsql.LogSizeCapability{ - // Limit: to.Ptr[int32](30), - // Unit: to.Ptr(armsql.LogSizeUnitPercent), - // }, - // MaxValue: &armsql.MaxSizeCapability{ - // Limit: to.Ptr[int32](3144704), - // Unit: to.Ptr(armsql.MaxSizeUnitMegabytes), - // }, - // MinValue: &armsql.MaxSizeCapability{ - // Limit: to.Ptr[int32](33792), - // Unit: to.Ptr(armsql.MaxSizeUnitMegabytes), - // }, - // ScaleSize: &armsql.MaxSizeCapability{ - // Limit: to.Ptr[int32](1024), - // Unit: to.Ptr(armsql.MaxSizeUnitMegabytes), - // }, - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // }, - // { - // LogSize: &armsql.LogSizeCapability{ - // Limit: to.Ptr[int32](1048576), - // Unit: to.Ptr(armsql.LogSizeUnitMegabytes), - // }, - // MaxValue: &armsql.MaxSizeCapability{ - // Limit: to.Ptr[int32](3145728), - // Unit: to.Ptr(armsql.MaxSizeUnitMegabytes), - // }, - // MinValue: &armsql.MaxSizeCapability{ - // Limit: to.Ptr[int32](3145728), - // Unit: to.Ptr(armsql.MaxSizeUnitMegabytes), - // }, - // ScaleSize: &armsql.MaxSizeCapability{ - // Limit: to.Ptr[int32](0), - // Unit: to.Ptr(armsql.MaxSizeUnitMegabytes), - // }, - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // }}, - // SupportedPerDatabaseMaxPerformanceLevels: []*armsql.ElasticPoolPerDatabaseMaxPerformanceLevelCapability{ - // { - // Limit: to.Ptr[float64](0.25), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // SupportedPerDatabaseMinPerformanceLevels: []*armsql.ElasticPoolPerDatabaseMinPerformanceLevelCapability{ - // { - // Limit: to.Ptr[float64](0), - // Status: to.Ptr(armsql.CapabilityStatusDefault), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](0.25), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }}, - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](0.5), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // SupportedPerDatabaseMinPerformanceLevels: []*armsql.ElasticPoolPerDatabaseMinPerformanceLevelCapability{ - // { - // Limit: to.Ptr[float64](0), - // Status: to.Ptr(armsql.CapabilityStatusDefault), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](0.25), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](0.5), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }}, - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](1), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // SupportedPerDatabaseMinPerformanceLevels: []*armsql.ElasticPoolPerDatabaseMinPerformanceLevelCapability{ - // { - // Limit: to.Ptr[float64](0), - // Status: to.Ptr(armsql.CapabilityStatusDefault), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](0.25), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](0.5), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](1), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }}, - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](2), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // SupportedPerDatabaseMinPerformanceLevels: []*armsql.ElasticPoolPerDatabaseMinPerformanceLevelCapability{ - // { - // Limit: to.Ptr[float64](0), - // Status: to.Ptr(armsql.CapabilityStatusDefault), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](0.25), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](0.5), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](1), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](2), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }}, - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](4), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // SupportedPerDatabaseMinPerformanceLevels: []*armsql.ElasticPoolPerDatabaseMinPerformanceLevelCapability{ - // { - // Limit: to.Ptr[float64](0), - // Status: to.Ptr(armsql.CapabilityStatusDefault), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](0.25), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](0.5), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](1), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](2), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](4), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }}, - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](6), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // SupportedPerDatabaseMinPerformanceLevels: []*armsql.ElasticPoolPerDatabaseMinPerformanceLevelCapability{ - // { - // Limit: to.Ptr[float64](0), - // Status: to.Ptr(armsql.CapabilityStatusDefault), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](0.25), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](0.5), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](1), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](2), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](4), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](6), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }}, - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](8), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // SupportedPerDatabaseMinPerformanceLevels: []*armsql.ElasticPoolPerDatabaseMinPerformanceLevelCapability{ - // { - // Limit: to.Ptr[float64](0), - // Status: to.Ptr(armsql.CapabilityStatusDefault), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](0.25), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](0.5), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](1), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](2), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](4), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](6), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](8), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }}, - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](10), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // SupportedPerDatabaseMinPerformanceLevels: []*armsql.ElasticPoolPerDatabaseMinPerformanceLevelCapability{ - // { - // Limit: to.Ptr[float64](0), - // Status: to.Ptr(armsql.CapabilityStatusDefault), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](0.25), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](0.5), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](1), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](2), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](4), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](6), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](8), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](10), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }}, - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](12), - // Status: to.Ptr(armsql.CapabilityStatusDefault), - // SupportedPerDatabaseMinPerformanceLevels: []*armsql.ElasticPoolPerDatabaseMinPerformanceLevelCapability{ - // { - // Limit: to.Ptr[float64](0), - // Status: to.Ptr(armsql.CapabilityStatusDefault), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](0.25), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](0.5), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](1), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](2), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](4), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](6), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](8), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](10), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](12), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }}, - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }}, - // SupportedPerDatabaseMaxSizes: []*armsql.MaxSizeRangeCapability{ - // { - // MaxValue: &armsql.MaxSizeCapability{ - // Limit: to.Ptr[int32](31744), - // Unit: to.Ptr(armsql.MaxSizeUnitMegabytes), - // }, - // MinValue: &armsql.MaxSizeCapability{ - // Limit: to.Ptr[int32](1024), - // Unit: to.Ptr(armsql.MaxSizeUnitMegabytes), - // }, - // ScaleSize: &armsql.MaxSizeCapability{ - // Limit: to.Ptr[int32](1024), - // Unit: to.Ptr(armsql.MaxSizeUnitMegabytes), - // }, - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // }, - // { - // MaxValue: &armsql.MaxSizeCapability{ - // Limit: to.Ptr[int32](32768), - // Unit: to.Ptr(armsql.MaxSizeUnitMegabytes), - // }, - // MinValue: &armsql.MaxSizeCapability{ - // Limit: to.Ptr[int32](32768), - // Unit: to.Ptr(armsql.MaxSizeUnitMegabytes), - // }, - // ScaleSize: &armsql.MaxSizeCapability{ - // Limit: to.Ptr[int32](0), - // Unit: to.Ptr(armsql.MaxSizeUnitMegabytes), - // }, - // Status: to.Ptr(armsql.CapabilityStatusDefault), - // }, - // { - // MaxValue: &armsql.MaxSizeCapability{ - // Limit: to.Ptr[int32](3144704), - // Unit: to.Ptr(armsql.MaxSizeUnitMegabytes), - // }, - // MinValue: &armsql.MaxSizeCapability{ - // Limit: to.Ptr[int32](33792), - // Unit: to.Ptr(armsql.MaxSizeUnitMegabytes), - // }, - // ScaleSize: &armsql.MaxSizeCapability{ - // Limit: to.Ptr[int32](1024), - // Unit: to.Ptr(armsql.MaxSizeUnitMegabytes), - // }, - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // }, - // { - // MaxValue: &armsql.MaxSizeCapability{ - // Limit: to.Ptr[int32](3145728), - // Unit: to.Ptr(armsql.MaxSizeUnitMegabytes), - // }, - // MinValue: &armsql.MaxSizeCapability{ - // Limit: to.Ptr[int32](3145728), - // Unit: to.Ptr(armsql.MaxSizeUnitMegabytes), - // }, - // ScaleSize: &armsql.MaxSizeCapability{ - // Limit: to.Ptr[int32](0), - // Unit: to.Ptr(armsql.MaxSizeUnitMegabytes), - // }, - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // }}, - // ZoneRedundant: to.Ptr(true), - // }, - // { - // MaxDatabaseCount: to.Ptr[int32](100), - // PerformanceLevel: &armsql.PerformanceLevelCapability{ - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // Value: to.Ptr[float64](128), - // }, - // SKU: &armsql.SKU{ - // Name: to.Ptr("BC_M"), - // Capacity: to.Ptr[int32](128), - // Family: to.Ptr("M"), - // Tier: to.Ptr("BusinessCritical"), - // }, - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // SupportedLicenseTypes: []*armsql.LicenseTypeCapability{ - // { - // Name: to.Ptr("LicenseIncluded"), - // Status: to.Ptr(armsql.CapabilityStatusDefault), - // }, - // { - // Name: to.Ptr("BasePrice"), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // }}, - // SupportedMaintenanceConfigurations: []*armsql.MaintenanceConfigurationCapability{ - // { - // Name: to.Ptr("SQL_Default"), - // Status: to.Ptr(armsql.CapabilityStatusDefault), - // ZoneRedundant: to.Ptr(false), - // }, - // { - // Name: to.Ptr("SQL_EastUS_DB_1"), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // ZoneRedundant: to.Ptr(false), - // }, - // { - // Name: to.Ptr("SQL_EastUS_DB_2"), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // ZoneRedundant: to.Ptr(false), - // }}, - // SupportedMaxSizes: []*armsql.MaxSizeRangeCapability{ - // { - // LogSize: &armsql.LogSizeCapability{ - // Limit: to.Ptr[int32](30), - // Unit: to.Ptr(armsql.LogSizeUnitPercent), - // }, - // MaxValue: &armsql.MaxSizeCapability{ - // Limit: to.Ptr[int32](31744), - // Unit: to.Ptr(armsql.MaxSizeUnitMegabytes), - // }, - // MinValue: &armsql.MaxSizeCapability{ - // Limit: to.Ptr[int32](1024), - // Unit: to.Ptr(armsql.MaxSizeUnitMegabytes), - // }, - // ScaleSize: &armsql.MaxSizeCapability{ - // Limit: to.Ptr[int32](1024), - // Unit: to.Ptr(armsql.MaxSizeUnitMegabytes), - // }, - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // }, - // { - // LogSize: &armsql.LogSizeCapability{ - // Limit: to.Ptr[int32](30), - // Unit: to.Ptr(armsql.LogSizeUnitPercent), - // }, - // MaxValue: &armsql.MaxSizeCapability{ - // Limit: to.Ptr[int32](32768), - // Unit: to.Ptr(armsql.MaxSizeUnitMegabytes), - // }, - // MinValue: &armsql.MaxSizeCapability{ - // Limit: to.Ptr[int32](32768), - // Unit: to.Ptr(armsql.MaxSizeUnitMegabytes), - // }, - // ScaleSize: &armsql.MaxSizeCapability{ - // Limit: to.Ptr[int32](0), - // Unit: to.Ptr(armsql.MaxSizeUnitMegabytes), - // }, - // Status: to.Ptr(armsql.CapabilityStatusDefault), - // }, - // { - // LogSize: &armsql.LogSizeCapability{ - // Limit: to.Ptr[int32](30), - // Unit: to.Ptr(armsql.LogSizeUnitPercent), - // }, - // MaxValue: &armsql.MaxSizeCapability{ - // Limit: to.Ptr[int32](3144704), - // Unit: to.Ptr(armsql.MaxSizeUnitMegabytes), - // }, - // MinValue: &armsql.MaxSizeCapability{ - // Limit: to.Ptr[int32](33792), - // Unit: to.Ptr(armsql.MaxSizeUnitMegabytes), - // }, - // ScaleSize: &armsql.MaxSizeCapability{ - // Limit: to.Ptr[int32](1024), - // Unit: to.Ptr(armsql.MaxSizeUnitMegabytes), - // }, - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // }, - // { - // LogSize: &armsql.LogSizeCapability{ - // Limit: to.Ptr[int32](1048576), - // Unit: to.Ptr(armsql.LogSizeUnitMegabytes), - // }, - // MaxValue: &armsql.MaxSizeCapability{ - // Limit: to.Ptr[int32](4194304), - // Unit: to.Ptr(armsql.MaxSizeUnitMegabytes), - // }, - // MinValue: &armsql.MaxSizeCapability{ - // Limit: to.Ptr[int32](3145728), - // Unit: to.Ptr(armsql.MaxSizeUnitMegabytes), - // }, - // ScaleSize: &armsql.MaxSizeCapability{ - // Limit: to.Ptr[int32](1024), - // Unit: to.Ptr(armsql.MaxSizeUnitMegabytes), - // }, - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // }}, - // SupportedPerDatabaseMaxPerformanceLevels: []*armsql.ElasticPoolPerDatabaseMaxPerformanceLevelCapability{ - // { - // Limit: to.Ptr[float64](8), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // SupportedPerDatabaseMinPerformanceLevels: []*armsql.ElasticPoolPerDatabaseMinPerformanceLevelCapability{ - // { - // Limit: to.Ptr[float64](0), - // Status: to.Ptr(armsql.CapabilityStatusDefault), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](8), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }}, - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](10), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // SupportedPerDatabaseMinPerformanceLevels: []*armsql.ElasticPoolPerDatabaseMinPerformanceLevelCapability{ - // { - // Limit: to.Ptr[float64](0), - // Status: to.Ptr(armsql.CapabilityStatusDefault), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](8), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](10), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }}, - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](12), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // SupportedPerDatabaseMinPerformanceLevels: []*armsql.ElasticPoolPerDatabaseMinPerformanceLevelCapability{ - // { - // Limit: to.Ptr[float64](0), - // Status: to.Ptr(armsql.CapabilityStatusDefault), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](8), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](10), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](12), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }}, - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](14), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // SupportedPerDatabaseMinPerformanceLevels: []*armsql.ElasticPoolPerDatabaseMinPerformanceLevelCapability{ - // { - // Limit: to.Ptr[float64](0), - // Status: to.Ptr(armsql.CapabilityStatusDefault), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](8), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](10), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](12), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](14), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }}, - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](16), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // SupportedPerDatabaseMinPerformanceLevels: []*armsql.ElasticPoolPerDatabaseMinPerformanceLevelCapability{ - // { - // Limit: to.Ptr[float64](0), - // Status: to.Ptr(armsql.CapabilityStatusDefault), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](8), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](10), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](12), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](14), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](16), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }}, - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](18), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // SupportedPerDatabaseMinPerformanceLevels: []*armsql.ElasticPoolPerDatabaseMinPerformanceLevelCapability{ - // { - // Limit: to.Ptr[float64](0), - // Status: to.Ptr(armsql.CapabilityStatusDefault), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](8), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](10), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](12), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](14), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](16), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](18), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }}, - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](20), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // SupportedPerDatabaseMinPerformanceLevels: []*armsql.ElasticPoolPerDatabaseMinPerformanceLevelCapability{ - // { - // Limit: to.Ptr[float64](0), - // Status: to.Ptr(armsql.CapabilityStatusDefault), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](8), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](10), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](12), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](14), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](16), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](18), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](20), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }}, - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](24), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // SupportedPerDatabaseMinPerformanceLevels: []*armsql.ElasticPoolPerDatabaseMinPerformanceLevelCapability{ - // { - // Limit: to.Ptr[float64](0), - // Status: to.Ptr(armsql.CapabilityStatusDefault), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](8), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](10), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](12), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](14), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](16), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](18), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](20), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](24), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }}, - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](32), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // SupportedPerDatabaseMinPerformanceLevels: []*armsql.ElasticPoolPerDatabaseMinPerformanceLevelCapability{ - // { - // Limit: to.Ptr[float64](0), - // Status: to.Ptr(armsql.CapabilityStatusDefault), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](8), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](10), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](12), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](14), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](16), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](18), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](20), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](24), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](32), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }}, - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](40), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // SupportedPerDatabaseMinPerformanceLevels: []*armsql.ElasticPoolPerDatabaseMinPerformanceLevelCapability{ - // { - // Limit: to.Ptr[float64](0), - // Status: to.Ptr(armsql.CapabilityStatusDefault), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](8), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](10), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](12), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](14), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](16), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](18), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](20), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](24), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](32), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](40), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }}, - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](64), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // SupportedPerDatabaseMinPerformanceLevels: []*armsql.ElasticPoolPerDatabaseMinPerformanceLevelCapability{ - // { - // Limit: to.Ptr[float64](0), - // Status: to.Ptr(armsql.CapabilityStatusDefault), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](8), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](10), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](12), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](14), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](16), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](18), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](20), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](24), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](32), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](40), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](64), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }}, - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](80), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // SupportedPerDatabaseMinPerformanceLevels: []*armsql.ElasticPoolPerDatabaseMinPerformanceLevelCapability{ - // { - // Limit: to.Ptr[float64](0), - // Status: to.Ptr(armsql.CapabilityStatusDefault), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](8), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](10), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](12), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](14), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](16), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](18), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](20), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](24), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](32), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](40), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](64), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](80), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }}, - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](128), - // Status: to.Ptr(armsql.CapabilityStatusDefault), - // SupportedPerDatabaseMinPerformanceLevels: []*armsql.ElasticPoolPerDatabaseMinPerformanceLevelCapability{ - // { - // Limit: to.Ptr[float64](0), - // Status: to.Ptr(armsql.CapabilityStatusDefault), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](8), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](10), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](12), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](14), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](16), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](18), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](20), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](24), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](32), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](40), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](64), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](80), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }, - // { - // Limit: to.Ptr[float64](128), - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }}, - // Unit: to.Ptr(armsql.PerformanceLevelUnitVCores), - // }}, - // SupportedPerDatabaseMaxSizes: []*armsql.MaxSizeRangeCapability{ - // { - // MaxValue: &armsql.MaxSizeCapability{ - // Limit: to.Ptr[int32](31744), - // Unit: to.Ptr(armsql.MaxSizeUnitMegabytes), - // }, - // MinValue: &armsql.MaxSizeCapability{ - // Limit: to.Ptr[int32](1024), - // Unit: to.Ptr(armsql.MaxSizeUnitMegabytes), - // }, - // ScaleSize: &armsql.MaxSizeCapability{ - // Limit: to.Ptr[int32](1024), - // Unit: to.Ptr(armsql.MaxSizeUnitMegabytes), - // }, - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // }, - // { - // MaxValue: &armsql.MaxSizeCapability{ - // Limit: to.Ptr[int32](32768), - // Unit: to.Ptr(armsql.MaxSizeUnitMegabytes), - // }, - // MinValue: &armsql.MaxSizeCapability{ - // Limit: to.Ptr[int32](32768), - // Unit: to.Ptr(armsql.MaxSizeUnitMegabytes), - // }, - // ScaleSize: &armsql.MaxSizeCapability{ - // Limit: to.Ptr[int32](0), - // Unit: to.Ptr(armsql.MaxSizeUnitMegabytes), - // }, - // Status: to.Ptr(armsql.CapabilityStatusDefault), - // }, - // { - // MaxValue: &armsql.MaxSizeCapability{ - // Limit: to.Ptr[int32](3144704), - // Unit: to.Ptr(armsql.MaxSizeUnitMegabytes), - // }, - // MinValue: &armsql.MaxSizeCapability{ - // Limit: to.Ptr[int32](33792), - // Unit: to.Ptr(armsql.MaxSizeUnitMegabytes), - // }, - // ScaleSize: &armsql.MaxSizeCapability{ - // Limit: to.Ptr[int32](1024), - // Unit: to.Ptr(armsql.MaxSizeUnitMegabytes), - // }, - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // }, - // { - // MaxValue: &armsql.MaxSizeCapability{ - // Limit: to.Ptr[int32](4194304), - // Unit: to.Ptr(armsql.MaxSizeUnitMegabytes), - // }, - // MinValue: &armsql.MaxSizeCapability{ - // Limit: to.Ptr[int32](3145728), - // Unit: to.Ptr(armsql.MaxSizeUnitMegabytes), - // }, - // ScaleSize: &armsql.MaxSizeCapability{ - // Limit: to.Ptr[int32](1024), - // Unit: to.Ptr(armsql.MaxSizeUnitMegabytes), - // }, - // Status: to.Ptr(armsql.CapabilityStatusAvailable), - // }}, - // ZoneRedundant: to.Ptr(false), - // }}, - // ZoneRedundant: to.Ptr(false), - // }}, - // }}, - // } -} diff --git a/sdk/resourcemanager/sql/armsql/client_factory.go b/sdk/resourcemanager/sql/armsql/client_factory.go index 8a15965a7f85..2240ad002959 100644 --- a/sdk/resourcemanager/sql/armsql/client_factory.go +++ b/sdk/resourcemanager/sql/armsql/client_factory.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armsql @@ -38,8 +37,18 @@ func NewClientFactory(subscriptionID string, credential azcore.TokenCredential, }, nil } -func (c *ClientFactory) NewRecoverableDatabasesClient() *RecoverableDatabasesClient { - subClient, _ := NewRecoverableDatabasesClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewAgentClient() *AgentClient { + subClient, _ := NewAgentClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewBackupShortTermRetentionPoliciesClient() *BackupShortTermRetentionPoliciesClient { + subClient, _ := NewBackupShortTermRetentionPoliciesClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewCapabilitiesClient() *CapabilitiesClient { + subClient, _ := NewCapabilitiesClient(c.subscriptionID, c.credential, c.options) return subClient } @@ -53,63 +62,83 @@ func (c *ClientFactory) NewDataMaskingRulesClient() *DataMaskingRulesClient { return subClient } -func (c *ClientFactory) NewGeoBackupPoliciesClient() *GeoBackupPoliciesClient { - subClient, _ := NewGeoBackupPoliciesClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewDataWarehouseUserActivitiesClient() *DataWarehouseUserActivitiesClient { + subClient, _ := NewDataWarehouseUserActivitiesClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewDatabasesClient() *DatabasesClient { - subClient, _ := NewDatabasesClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewDatabaseAdvancedThreatProtectionSettingsClient() *DatabaseAdvancedThreatProtectionSettingsClient { + subClient, _ := NewDatabaseAdvancedThreatProtectionSettingsClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewElasticPoolsClient() *ElasticPoolsClient { - subClient, _ := NewElasticPoolsClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewDatabaseAdvisorsClient() *DatabaseAdvisorsClient { + subClient, _ := NewDatabaseAdvisorsClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewServerCommunicationLinksClient() *ServerCommunicationLinksClient { - subClient, _ := NewServerCommunicationLinksClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewDatabaseAutomaticTuningClient() *DatabaseAutomaticTuningClient { + subClient, _ := NewDatabaseAutomaticTuningClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewServiceObjectivesClient() *ServiceObjectivesClient { - subClient, _ := NewServiceObjectivesClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewDatabaseBlobAuditingPoliciesClient() *DatabaseBlobAuditingPoliciesClient { + subClient, _ := NewDatabaseBlobAuditingPoliciesClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewElasticPoolActivitiesClient() *ElasticPoolActivitiesClient { - subClient, _ := NewElasticPoolActivitiesClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewDatabaseColumnsClient() *DatabaseColumnsClient { + subClient, _ := NewDatabaseColumnsClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewElasticPoolDatabaseActivitiesClient() *ElasticPoolDatabaseActivitiesClient { - subClient, _ := NewElasticPoolDatabaseActivitiesClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewDatabaseEncryptionProtectorsClient() *DatabaseEncryptionProtectorsClient { + subClient, _ := NewDatabaseEncryptionProtectorsClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewServerUsagesClient() *ServerUsagesClient { - subClient, _ := NewServerUsagesClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewDatabaseExtensionsClient() *DatabaseExtensionsClient { + subClient, _ := NewDatabaseExtensionsClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewDatabaseAdvisorsClient() *DatabaseAdvisorsClient { - subClient, _ := NewDatabaseAdvisorsClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewDatabaseOperationsClient() *DatabaseOperationsClient { + subClient, _ := NewDatabaseOperationsClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewDatabaseAutomaticTuningClient() *DatabaseAutomaticTuningClient { - subClient, _ := NewDatabaseAutomaticTuningClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewDatabaseRecommendedActionsClient() *DatabaseRecommendedActionsClient { + subClient, _ := NewDatabaseRecommendedActionsClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewDatabaseColumnsClient() *DatabaseColumnsClient { - subClient, _ := NewDatabaseColumnsClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewDatabaseSQLVulnerabilityAssessmentBaselinesClient() *DatabaseSQLVulnerabilityAssessmentBaselinesClient { + subClient, _ := NewDatabaseSQLVulnerabilityAssessmentBaselinesClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewDatabaseRecommendedActionsClient() *DatabaseRecommendedActionsClient { - subClient, _ := NewDatabaseRecommendedActionsClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewDatabaseSQLVulnerabilityAssessmentExecuteScanClient() *DatabaseSQLVulnerabilityAssessmentExecuteScanClient { + subClient, _ := NewDatabaseSQLVulnerabilityAssessmentExecuteScanClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewDatabaseSQLVulnerabilityAssessmentRuleBaselinesClient() *DatabaseSQLVulnerabilityAssessmentRuleBaselinesClient { + subClient, _ := NewDatabaseSQLVulnerabilityAssessmentRuleBaselinesClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewDatabaseSQLVulnerabilityAssessmentScanResultClient() *DatabaseSQLVulnerabilityAssessmentScanResultClient { + subClient, _ := NewDatabaseSQLVulnerabilityAssessmentScanResultClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewDatabaseSQLVulnerabilityAssessmentScansClient() *DatabaseSQLVulnerabilityAssessmentScansClient { + subClient, _ := NewDatabaseSQLVulnerabilityAssessmentScansClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewDatabaseSQLVulnerabilityAssessmentsSettingsClient() *DatabaseSQLVulnerabilityAssessmentsSettingsClient { + subClient, _ := NewDatabaseSQLVulnerabilityAssessmentsSettingsClient(c.subscriptionID, c.credential, c.options) return subClient } @@ -128,13 +157,13 @@ func (c *ClientFactory) NewDatabaseTablesClient() *DatabaseTablesClient { return subClient } -func (c *ClientFactory) NewDatabaseVulnerabilityAssessmentRuleBaselinesClient() *DatabaseVulnerabilityAssessmentRuleBaselinesClient { - subClient, _ := NewDatabaseVulnerabilityAssessmentRuleBaselinesClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewDatabaseUsagesClient() *DatabaseUsagesClient { + subClient, _ := NewDatabaseUsagesClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewDatabaseVulnerabilityAssessmentsClient() *DatabaseVulnerabilityAssessmentsClient { - subClient, _ := NewDatabaseVulnerabilityAssessmentsClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewDatabaseVulnerabilityAssessmentRuleBaselinesClient() *DatabaseVulnerabilityAssessmentRuleBaselinesClient { + subClient, _ := NewDatabaseVulnerabilityAssessmentRuleBaselinesClient(c.subscriptionID, c.credential, c.options) return subClient } @@ -143,8 +172,13 @@ func (c *ClientFactory) NewDatabaseVulnerabilityAssessmentScansClient() *Databas return subClient } -func (c *ClientFactory) NewDataWarehouseUserActivitiesClient() *DataWarehouseUserActivitiesClient { - subClient, _ := NewDataWarehouseUserActivitiesClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewDatabaseVulnerabilityAssessmentsClient() *DatabaseVulnerabilityAssessmentsClient { + subClient, _ := NewDatabaseVulnerabilityAssessmentsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewDatabasesClient() *DatabasesClient { + subClient, _ := NewDatabasesClient(c.subscriptionID, c.credential, c.options) return subClient } @@ -153,16 +187,41 @@ func (c *ClientFactory) NewDeletedServersClient() *DeletedServersClient { return subClient } +func (c *ClientFactory) NewDistributedAvailabilityGroupsClient() *DistributedAvailabilityGroupsClient { + subClient, _ := NewDistributedAvailabilityGroupsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + func (c *ClientFactory) NewElasticPoolOperationsClient() *ElasticPoolOperationsClient { subClient, _ := NewElasticPoolOperationsClient(c.subscriptionID, c.credential, c.options) return subClient } +func (c *ClientFactory) NewElasticPoolsClient() *ElasticPoolsClient { + subClient, _ := NewElasticPoolsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + func (c *ClientFactory) NewEncryptionProtectorsClient() *EncryptionProtectorsClient { subClient, _ := NewEncryptionProtectorsClient(c.subscriptionID, c.credential, c.options) return subClient } +func (c *ClientFactory) NewEndpointCertificatesClient() *EndpointCertificatesClient { + subClient, _ := NewEndpointCertificatesClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewExtendedDatabaseBlobAuditingPoliciesClient() *ExtendedDatabaseBlobAuditingPoliciesClient { + subClient, _ := NewExtendedDatabaseBlobAuditingPoliciesClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewExtendedServerBlobAuditingPoliciesClient() *ExtendedServerBlobAuditingPoliciesClient { + subClient, _ := NewExtendedServerBlobAuditingPoliciesClient(c.subscriptionID, c.credential, c.options) + return subClient +} + func (c *ClientFactory) NewFailoverGroupsClient() *FailoverGroupsClient { subClient, _ := NewFailoverGroupsClient(c.subscriptionID, c.credential, c.options) return subClient @@ -173,6 +232,16 @@ func (c *ClientFactory) NewFirewallRulesClient() *FirewallRulesClient { return subClient } +func (c *ClientFactory) NewGeoBackupPoliciesClient() *GeoBackupPoliciesClient { + subClient, _ := NewGeoBackupPoliciesClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewIPv6FirewallRulesClient() *IPv6FirewallRulesClient { + subClient, _ := NewIPv6FirewallRulesClient(c.subscriptionID, c.credential, c.options) + return subClient +} + func (c *ClientFactory) NewInstanceFailoverGroupsClient() *InstanceFailoverGroupsClient { subClient, _ := NewInstanceFailoverGroupsClient(c.subscriptionID, c.credential, c.options) return subClient @@ -198,11 +267,6 @@ func (c *ClientFactory) NewJobExecutionsClient() *JobExecutionsClient { return subClient } -func (c *ClientFactory) NewJobsClient() *JobsClient { - subClient, _ := NewJobsClient(c.subscriptionID, c.credential, c.options) - return subClient -} - func (c *ClientFactory) NewJobStepExecutionsClient() *JobStepExecutionsClient { subClient, _ := NewJobStepExecutionsClient(c.subscriptionID, c.credential, c.options) return subClient @@ -228,8 +292,23 @@ func (c *ClientFactory) NewJobVersionsClient() *JobVersionsClient { return subClient } -func (c *ClientFactory) NewCapabilitiesClient() *CapabilitiesClient { - subClient, _ := NewCapabilitiesClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewJobsClient() *JobsClient { + subClient, _ := NewJobsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewLedgerDigestUploadsClient() *LedgerDigestUploadsClient { + subClient, _ := NewLedgerDigestUploadsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewLongTermRetentionBackupsClient() *LongTermRetentionBackupsClient { + subClient, _ := NewLongTermRetentionBackupsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewLongTermRetentionManagedInstanceBackupsClient() *LongTermRetentionManagedInstanceBackupsClient { + subClient, _ := NewLongTermRetentionManagedInstanceBackupsClient(c.subscriptionID, c.credential, c.options) return subClient } @@ -253,23 +332,33 @@ func (c *ClientFactory) NewManagedBackupShortTermRetentionPoliciesClient() *Mana return subClient } +func (c *ClientFactory) NewManagedDatabaseAdvancedThreatProtectionSettingsClient() *ManagedDatabaseAdvancedThreatProtectionSettingsClient { + subClient, _ := NewManagedDatabaseAdvancedThreatProtectionSettingsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + func (c *ClientFactory) NewManagedDatabaseColumnsClient() *ManagedDatabaseColumnsClient { subClient, _ := NewManagedDatabaseColumnsClient(c.subscriptionID, c.credential, c.options) return subClient } +func (c *ClientFactory) NewManagedDatabaseMoveOperationsClient() *ManagedDatabaseMoveOperationsClient { + subClient, _ := NewManagedDatabaseMoveOperationsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + func (c *ClientFactory) NewManagedDatabaseQueriesClient() *ManagedDatabaseQueriesClient { subClient, _ := NewManagedDatabaseQueriesClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewManagedDatabaseRestoreDetailsClient() *ManagedDatabaseRestoreDetailsClient { - subClient, _ := NewManagedDatabaseRestoreDetailsClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewManagedDatabaseRecommendedSensitivityLabelsClient() *ManagedDatabaseRecommendedSensitivityLabelsClient { + subClient, _ := NewManagedDatabaseRecommendedSensitivityLabelsClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewManagedDatabasesClient() *ManagedDatabasesClient { - subClient, _ := NewManagedDatabasesClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewManagedDatabaseRestoreDetailsClient() *ManagedDatabaseRestoreDetailsClient { + subClient, _ := NewManagedDatabaseRestoreDetailsClient(c.subscriptionID, c.credential, c.options) return subClient } @@ -288,6 +377,11 @@ func (c *ClientFactory) NewManagedDatabaseSecurityEventsClient() *ManagedDatabas return subClient } +func (c *ClientFactory) NewManagedDatabaseSensitivityLabelsClient() *ManagedDatabaseSensitivityLabelsClient { + subClient, _ := NewManagedDatabaseSensitivityLabelsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + func (c *ClientFactory) NewManagedDatabaseTablesClient() *ManagedDatabaseTablesClient { subClient, _ := NewManagedDatabaseTablesClient(c.subscriptionID, c.credential, c.options) return subClient @@ -303,13 +397,18 @@ func (c *ClientFactory) NewManagedDatabaseVulnerabilityAssessmentRuleBaselinesCl return subClient } +func (c *ClientFactory) NewManagedDatabaseVulnerabilityAssessmentScansClient() *ManagedDatabaseVulnerabilityAssessmentScansClient { + subClient, _ := NewManagedDatabaseVulnerabilityAssessmentScansClient(c.subscriptionID, c.credential, c.options) + return subClient +} + func (c *ClientFactory) NewManagedDatabaseVulnerabilityAssessmentsClient() *ManagedDatabaseVulnerabilityAssessmentsClient { subClient, _ := NewManagedDatabaseVulnerabilityAssessmentsClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewManagedDatabaseVulnerabilityAssessmentScansClient() *ManagedDatabaseVulnerabilityAssessmentScansClient { - subClient, _ := NewManagedDatabaseVulnerabilityAssessmentScansClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewManagedDatabasesClient() *ManagedDatabasesClient { + subClient, _ := NewManagedDatabasesClient(c.subscriptionID, c.credential, c.options) return subClient } @@ -318,11 +417,21 @@ func (c *ClientFactory) NewManagedInstanceAdministratorsClient() *ManagedInstanc return subClient } +func (c *ClientFactory) NewManagedInstanceAdvancedThreatProtectionSettingsClient() *ManagedInstanceAdvancedThreatProtectionSettingsClient { + subClient, _ := NewManagedInstanceAdvancedThreatProtectionSettingsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + func (c *ClientFactory) NewManagedInstanceAzureADOnlyAuthenticationsClient() *ManagedInstanceAzureADOnlyAuthenticationsClient { subClient, _ := NewManagedInstanceAzureADOnlyAuthenticationsClient(c.subscriptionID, c.credential, c.options) return subClient } +func (c *ClientFactory) NewManagedInstanceDtcsClient() *ManagedInstanceDtcsClient { + subClient, _ := NewManagedInstanceDtcsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + func (c *ClientFactory) NewManagedInstanceEncryptionProtectorsClient() *ManagedInstanceEncryptionProtectorsClient { subClient, _ := NewManagedInstanceEncryptionProtectorsClient(c.subscriptionID, c.credential, c.options) return subClient @@ -363,297 +472,297 @@ func (c *ClientFactory) NewManagedInstanceVulnerabilityAssessmentsClient() *Mana return subClient } -func (c *ClientFactory) NewManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClient() *ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClient { - subClient, _ := NewManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewManagedInstancesClient() *ManagedInstancesClient { + subClient, _ := NewManagedInstancesClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewManagedServerSecurityAlertPoliciesClient() *ManagedServerSecurityAlertPoliciesClient { - subClient, _ := NewManagedServerSecurityAlertPoliciesClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewManagedLedgerDigestUploadsClient() *ManagedLedgerDigestUploadsClient { + subClient, _ := NewManagedLedgerDigestUploadsClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewOperationsClient() *OperationsClient { - subClient, _ := NewOperationsClient(c.credential, c.options) +func (c *ClientFactory) NewManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClient() *ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClient { + subClient, _ := NewManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewPrivateEndpointConnectionsClient() *PrivateEndpointConnectionsClient { - subClient, _ := NewPrivateEndpointConnectionsClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewManagedServerDNSAliasesClient() *ManagedServerDNSAliasesClient { + subClient, _ := NewManagedServerDNSAliasesClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewPrivateLinkResourcesClient() *PrivateLinkResourcesClient { - subClient, _ := NewPrivateLinkResourcesClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewManagedServerSecurityAlertPoliciesClient() *ManagedServerSecurityAlertPoliciesClient { + subClient, _ := NewManagedServerSecurityAlertPoliciesClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewRecoverableManagedDatabasesClient() *RecoverableManagedDatabasesClient { - subClient, _ := NewRecoverableManagedDatabasesClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewNetworkSecurityPerimeterConfigurationsClient() *NetworkSecurityPerimeterConfigurationsClient { + subClient, _ := NewNetworkSecurityPerimeterConfigurationsClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewRestorePointsClient() *RestorePointsClient { - subClient, _ := NewRestorePointsClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewOperationsClient() *OperationsClient { + subClient, _ := NewOperationsClient(c.credential, c.options) return subClient } -func (c *ClientFactory) NewServerAdvisorsClient() *ServerAdvisorsClient { - subClient, _ := NewServerAdvisorsClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewOutboundFirewallRulesClient() *OutboundFirewallRulesClient { + subClient, _ := NewOutboundFirewallRulesClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewServerAutomaticTuningClient() *ServerAutomaticTuningClient { - subClient, _ := NewServerAutomaticTuningClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewPrivateEndpointConnectionsClient() *PrivateEndpointConnectionsClient { + subClient, _ := NewPrivateEndpointConnectionsClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewServerAzureADAdministratorsClient() *ServerAzureADAdministratorsClient { - subClient, _ := NewServerAzureADAdministratorsClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewPrivateLinkResourcesClient() *PrivateLinkResourcesClient { + subClient, _ := NewPrivateLinkResourcesClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewServerAzureADOnlyAuthenticationsClient() *ServerAzureADOnlyAuthenticationsClient { - subClient, _ := NewServerAzureADOnlyAuthenticationsClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewRecommendedSensitivityLabelsClient() *RecommendedSensitivityLabelsClient { + subClient, _ := NewRecommendedSensitivityLabelsClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewServerDevOpsAuditSettingsClient() *ServerDevOpsAuditSettingsClient { - subClient, _ := NewServerDevOpsAuditSettingsClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewRecoverableDatabasesClient() *RecoverableDatabasesClient { + subClient, _ := NewRecoverableDatabasesClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewServerDNSAliasesClient() *ServerDNSAliasesClient { - subClient, _ := NewServerDNSAliasesClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewRecoverableManagedDatabasesClient() *RecoverableManagedDatabasesClient { + subClient, _ := NewRecoverableManagedDatabasesClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewServerKeysClient() *ServerKeysClient { - subClient, _ := NewServerKeysClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewReplicationLinksClient() *ReplicationLinksClient { + subClient, _ := NewReplicationLinksClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewServerOperationsClient() *ServerOperationsClient { - subClient, _ := NewServerOperationsClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewRestorableDroppedDatabasesClient() *RestorableDroppedDatabasesClient { + subClient, _ := NewRestorableDroppedDatabasesClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewServerSecurityAlertPoliciesClient() *ServerSecurityAlertPoliciesClient { - subClient, _ := NewServerSecurityAlertPoliciesClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewRestorableDroppedManagedDatabasesClient() *RestorableDroppedManagedDatabasesClient { + subClient, _ := NewRestorableDroppedManagedDatabasesClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewServerTrustGroupsClient() *ServerTrustGroupsClient { - subClient, _ := NewServerTrustGroupsClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewRestorePointsClient() *RestorePointsClient { + subClient, _ := NewRestorePointsClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewServerVulnerabilityAssessmentsClient() *ServerVulnerabilityAssessmentsClient { - subClient, _ := NewServerVulnerabilityAssessmentsClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewSensitivityLabelsClient() *SensitivityLabelsClient { + subClient, _ := NewSensitivityLabelsClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewAgentClient() *AgentClient { - subClient, _ := NewAgentClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewServerAdvancedThreatProtectionSettingsClient() *ServerAdvancedThreatProtectionSettingsClient { + subClient, _ := NewServerAdvancedThreatProtectionSettingsClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewSubscriptionUsagesClient() *SubscriptionUsagesClient { - subClient, _ := NewSubscriptionUsagesClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewServerAdvisorsClient() *ServerAdvisorsClient { + subClient, _ := NewServerAdvisorsClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewSyncAgentsClient() *SyncAgentsClient { - subClient, _ := NewSyncAgentsClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewServerAutomaticTuningClient() *ServerAutomaticTuningClient { + subClient, _ := NewServerAutomaticTuningClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewSyncGroupsClient() *SyncGroupsClient { - subClient, _ := NewSyncGroupsClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewServerAzureADAdministratorsClient() *ServerAzureADAdministratorsClient { + subClient, _ := NewServerAzureADAdministratorsClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewSyncMembersClient() *SyncMembersClient { - subClient, _ := NewSyncMembersClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewServerAzureADOnlyAuthenticationsClient() *ServerAzureADOnlyAuthenticationsClient { + subClient, _ := NewServerAzureADOnlyAuthenticationsClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewTdeCertificatesClient() *TdeCertificatesClient { - subClient, _ := NewTdeCertificatesClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewServerBlobAuditingPoliciesClient() *ServerBlobAuditingPoliciesClient { + subClient, _ := NewServerBlobAuditingPoliciesClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewTimeZonesClient() *TimeZonesClient { - subClient, _ := NewTimeZonesClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewServerConfigurationOptionsClient() *ServerConfigurationOptionsClient { + subClient, _ := NewServerConfigurationOptionsClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewVirtualClustersClient() *VirtualClustersClient { - subClient, _ := NewVirtualClustersClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewServerConnectionPoliciesClient() *ServerConnectionPoliciesClient { + subClient, _ := NewServerConnectionPoliciesClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewVirtualNetworkRulesClient() *VirtualNetworkRulesClient { - subClient, _ := NewVirtualNetworkRulesClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewServerDNSAliasesClient() *ServerDNSAliasesClient { + subClient, _ := NewServerDNSAliasesClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewWorkloadClassifiersClient() *WorkloadClassifiersClient { - subClient, _ := NewWorkloadClassifiersClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewServerDevOpsAuditSettingsClient() *ServerDevOpsAuditSettingsClient { + subClient, _ := NewServerDevOpsAuditSettingsClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewWorkloadGroupsClient() *WorkloadGroupsClient { - subClient, _ := NewWorkloadGroupsClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewServerKeysClient() *ServerKeysClient { + subClient, _ := NewServerKeysClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewTransparentDataEncryptionsClient() *TransparentDataEncryptionsClient { - subClient, _ := NewTransparentDataEncryptionsClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewServerOperationsClient() *ServerOperationsClient { + subClient, _ := NewServerOperationsClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewBackupShortTermRetentionPoliciesClient() *BackupShortTermRetentionPoliciesClient { - subClient, _ := NewBackupShortTermRetentionPoliciesClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewServerSecurityAlertPoliciesClient() *ServerSecurityAlertPoliciesClient { + subClient, _ := NewServerSecurityAlertPoliciesClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewDatabaseExtensionsClient() *DatabaseExtensionsClient { - subClient, _ := NewDatabaseExtensionsClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewServerTrustCertificatesClient() *ServerTrustCertificatesClient { + subClient, _ := NewServerTrustCertificatesClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewDatabaseOperationsClient() *DatabaseOperationsClient { - subClient, _ := NewDatabaseOperationsClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewServerTrustGroupsClient() *ServerTrustGroupsClient { + subClient, _ := NewServerTrustGroupsClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewDatabaseUsagesClient() *DatabaseUsagesClient { - subClient, _ := NewDatabaseUsagesClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewServerUsagesClient() *ServerUsagesClient { + subClient, _ := NewServerUsagesClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewLedgerDigestUploadsClient() *LedgerDigestUploadsClient { - subClient, _ := NewLedgerDigestUploadsClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewServerVulnerabilityAssessmentsClient() *ServerVulnerabilityAssessmentsClient { + subClient, _ := NewServerVulnerabilityAssessmentsClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewOutboundFirewallRulesClient() *OutboundFirewallRulesClient { - subClient, _ := NewOutboundFirewallRulesClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewServersClient() *ServersClient { + subClient, _ := NewServersClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewServersClient() *ServersClient { - subClient, _ := NewServersClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewStartStopManagedInstanceSchedulesClient() *StartStopManagedInstanceSchedulesClient { + subClient, _ := NewStartStopManagedInstanceSchedulesClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewUsagesClient() *UsagesClient { - subClient, _ := NewUsagesClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewSubscriptionUsagesClient() *SubscriptionUsagesClient { + subClient, _ := NewSubscriptionUsagesClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewLongTermRetentionBackupsClient() *LongTermRetentionBackupsClient { - subClient, _ := NewLongTermRetentionBackupsClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewSynapseLinkWorkspacesClient() *SynapseLinkWorkspacesClient { + subClient, _ := NewSynapseLinkWorkspacesClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewLongTermRetentionManagedInstanceBackupsClient() *LongTermRetentionManagedInstanceBackupsClient { - subClient, _ := NewLongTermRetentionManagedInstanceBackupsClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewSyncAgentsClient() *SyncAgentsClient { + subClient, _ := NewSyncAgentsClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewManagedInstancesClient() *ManagedInstancesClient { - subClient, _ := NewManagedInstancesClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewSyncGroupsClient() *SyncGroupsClient { + subClient, _ := NewSyncGroupsClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewRestorableDroppedDatabasesClient() *RestorableDroppedDatabasesClient { - subClient, _ := NewRestorableDroppedDatabasesClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewSyncMembersClient() *SyncMembersClient { + subClient, _ := NewSyncMembersClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewRestorableDroppedManagedDatabasesClient() *RestorableDroppedManagedDatabasesClient { - subClient, _ := NewRestorableDroppedManagedDatabasesClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewTdeCertificatesClient() *TdeCertificatesClient { + subClient, _ := NewTdeCertificatesClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewServerConnectionPoliciesClient() *ServerConnectionPoliciesClient { - subClient, _ := NewServerConnectionPoliciesClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewTimeZonesClient() *TimeZonesClient { + subClient, _ := NewTimeZonesClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewDistributedAvailabilityGroupsClient() *DistributedAvailabilityGroupsClient { - subClient, _ := NewDistributedAvailabilityGroupsClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewTransparentDataEncryptionsClient() *TransparentDataEncryptionsClient { + subClient, _ := NewTransparentDataEncryptionsClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewServerTrustCertificatesClient() *ServerTrustCertificatesClient { - subClient, _ := NewServerTrustCertificatesClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewUsagesClient() *UsagesClient { + subClient, _ := NewUsagesClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewIPv6FirewallRulesClient() *IPv6FirewallRulesClient { - subClient, _ := NewIPv6FirewallRulesClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewVirtualClustersClient() *VirtualClustersClient { + subClient, _ := NewVirtualClustersClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewEndpointCertificatesClient() *EndpointCertificatesClient { - subClient, _ := NewEndpointCertificatesClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewVirtualNetworkRulesClient() *VirtualNetworkRulesClient { + subClient, _ := NewVirtualNetworkRulesClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewReplicationLinksClient() *ReplicationLinksClient { - subClient, _ := NewReplicationLinksClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewVulnerabilityAssessmentBaselineClient() *VulnerabilityAssessmentBaselineClient { + subClient, _ := NewVulnerabilityAssessmentBaselineClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewManagedDatabaseSensitivityLabelsClient() *ManagedDatabaseSensitivityLabelsClient { - subClient, _ := NewManagedDatabaseSensitivityLabelsClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewVulnerabilityAssessmentBaselinesClient() *VulnerabilityAssessmentBaselinesClient { + subClient, _ := NewVulnerabilityAssessmentBaselinesClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewManagedDatabaseRecommendedSensitivityLabelsClient() *ManagedDatabaseRecommendedSensitivityLabelsClient { - subClient, _ := NewManagedDatabaseRecommendedSensitivityLabelsClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewVulnerabilityAssessmentExecuteScanClient() *VulnerabilityAssessmentExecuteScanClient { + subClient, _ := NewVulnerabilityAssessmentExecuteScanClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewSensitivityLabelsClient() *SensitivityLabelsClient { - subClient, _ := NewSensitivityLabelsClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewVulnerabilityAssessmentRuleBaselineClient() *VulnerabilityAssessmentRuleBaselineClient { + subClient, _ := NewVulnerabilityAssessmentRuleBaselineClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewRecommendedSensitivityLabelsClient() *RecommendedSensitivityLabelsClient { - subClient, _ := NewRecommendedSensitivityLabelsClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewVulnerabilityAssessmentRuleBaselinesClient() *VulnerabilityAssessmentRuleBaselinesClient { + subClient, _ := NewVulnerabilityAssessmentRuleBaselinesClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewServerBlobAuditingPoliciesClient() *ServerBlobAuditingPoliciesClient { - subClient, _ := NewServerBlobAuditingPoliciesClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewVulnerabilityAssessmentScanResultClient() *VulnerabilityAssessmentScanResultClient { + subClient, _ := NewVulnerabilityAssessmentScanResultClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewDatabaseBlobAuditingPoliciesClient() *DatabaseBlobAuditingPoliciesClient { - subClient, _ := NewDatabaseBlobAuditingPoliciesClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewVulnerabilityAssessmentScansClient() *VulnerabilityAssessmentScansClient { + subClient, _ := NewVulnerabilityAssessmentScansClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewExtendedDatabaseBlobAuditingPoliciesClient() *ExtendedDatabaseBlobAuditingPoliciesClient { - subClient, _ := NewExtendedDatabaseBlobAuditingPoliciesClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewVulnerabilityAssessmentsClient() *VulnerabilityAssessmentsClient { + subClient, _ := NewVulnerabilityAssessmentsClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewExtendedServerBlobAuditingPoliciesClient() *ExtendedServerBlobAuditingPoliciesClient { - subClient, _ := NewExtendedServerBlobAuditingPoliciesClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewVulnerabilityAssessmentsSettingsClient() *VulnerabilityAssessmentsSettingsClient { + subClient, _ := NewVulnerabilityAssessmentsSettingsClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewDatabaseAdvancedThreatProtectionSettingsClient() *DatabaseAdvancedThreatProtectionSettingsClient { - subClient, _ := NewDatabaseAdvancedThreatProtectionSettingsClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewWorkloadClassifiersClient() *WorkloadClassifiersClient { + subClient, _ := NewWorkloadClassifiersClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewServerAdvancedThreatProtectionSettingsClient() *ServerAdvancedThreatProtectionSettingsClient { - subClient, _ := NewServerAdvancedThreatProtectionSettingsClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewWorkloadGroupsClient() *WorkloadGroupsClient { + subClient, _ := NewWorkloadGroupsClient(c.subscriptionID, c.credential, c.options) return subClient } diff --git a/sdk/resourcemanager/sql/armsql/constants.go b/sdk/resourcemanager/sql/armsql/constants.go index efdb70297eed..45d4a6a34e39 100644 --- a/sdk/resourcemanager/sql/armsql/constants.go +++ b/sdk/resourcemanager/sql/armsql/constants.go @@ -3,15 +3,14 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armsql const ( moduleName = "armsql" - moduleVersion = "v1.1.0" + moduleVersion = "v2.0.0-beta.1" ) type AdministratorName string @@ -59,17 +58,17 @@ func PossibleAdvancedThreatProtectionNameValues() []AdvancedThreatProtectionName type AdvancedThreatProtectionState string const ( - AdvancedThreatProtectionStateNew AdvancedThreatProtectionState = "New" - AdvancedThreatProtectionStateEnabled AdvancedThreatProtectionState = "Enabled" AdvancedThreatProtectionStateDisabled AdvancedThreatProtectionState = "Disabled" + AdvancedThreatProtectionStateEnabled AdvancedThreatProtectionState = "Enabled" + AdvancedThreatProtectionStateNew AdvancedThreatProtectionState = "New" ) // PossibleAdvancedThreatProtectionStateValues returns the possible values for the AdvancedThreatProtectionState const type. func PossibleAdvancedThreatProtectionStateValues() []AdvancedThreatProtectionState { return []AdvancedThreatProtectionState{ - AdvancedThreatProtectionStateNew, - AdvancedThreatProtectionStateEnabled, AdvancedThreatProtectionStateDisabled, + AdvancedThreatProtectionStateEnabled, + AdvancedThreatProtectionStateNew, } } @@ -79,18 +78,18 @@ type AdvisorStatus string const ( AdvisorStatusGA AdvisorStatus = "GA" - AdvisorStatusPublicPreview AdvisorStatus = "PublicPreview" AdvisorStatusLimitedPublicPreview AdvisorStatus = "LimitedPublicPreview" AdvisorStatusPrivatePreview AdvisorStatus = "PrivatePreview" + AdvisorStatusPublicPreview AdvisorStatus = "PublicPreview" ) // PossibleAdvisorStatusValues returns the possible values for the AdvisorStatus const type. func PossibleAdvisorStatusValues() []AdvisorStatus { return []AdvisorStatus{ AdvisorStatusGA, - AdvisorStatusPublicPreview, AdvisorStatusLimitedPublicPreview, AdvisorStatusPrivatePreview, + AdvisorStatusPublicPreview, } } @@ -115,6 +114,22 @@ func PossibleAggregationFunctionTypeValues() []AggregationFunctionType { } } +// AlwaysEncryptedEnclaveType - Type of enclave requested on the database i.e. Default or VBS enclaves. +type AlwaysEncryptedEnclaveType string + +const ( + AlwaysEncryptedEnclaveTypeDefault AlwaysEncryptedEnclaveType = "Default" + AlwaysEncryptedEnclaveTypeVBS AlwaysEncryptedEnclaveType = "VBS" +) + +// PossibleAlwaysEncryptedEnclaveTypeValues returns the possible values for the AlwaysEncryptedEnclaveType const type. +func PossibleAlwaysEncryptedEnclaveTypeValues() []AlwaysEncryptedEnclaveType { + return []AlwaysEncryptedEnclaveType{ + AlwaysEncryptedEnclaveTypeDefault, + AlwaysEncryptedEnclaveTypeVBS, + } +} + type AuthenticationName string const ( @@ -133,17 +148,17 @@ func PossibleAuthenticationNameValues() []AuthenticationName { type AutoExecuteStatus string const ( - AutoExecuteStatusEnabled AutoExecuteStatus = "Enabled" - AutoExecuteStatusDisabled AutoExecuteStatus = "Disabled" AutoExecuteStatusDefault AutoExecuteStatus = "Default" + AutoExecuteStatusDisabled AutoExecuteStatus = "Disabled" + AutoExecuteStatusEnabled AutoExecuteStatus = "Enabled" ) // PossibleAutoExecuteStatusValues returns the possible values for the AutoExecuteStatus const type. func PossibleAutoExecuteStatusValues() []AutoExecuteStatus { return []AutoExecuteStatus{ - AutoExecuteStatusEnabled, - AutoExecuteStatusDisabled, AutoExecuteStatusDefault, + AutoExecuteStatusDisabled, + AutoExecuteStatusEnabled, } } @@ -153,21 +168,21 @@ func PossibleAutoExecuteStatusValues() []AutoExecuteStatus { type AutoExecuteStatusInheritedFrom string const ( + AutoExecuteStatusInheritedFromDatabase AutoExecuteStatusInheritedFrom = "Database" AutoExecuteStatusInheritedFromDefault AutoExecuteStatusInheritedFrom = "Default" - AutoExecuteStatusInheritedFromSubscription AutoExecuteStatusInheritedFrom = "Subscription" - AutoExecuteStatusInheritedFromServer AutoExecuteStatusInheritedFrom = "Server" AutoExecuteStatusInheritedFromElasticPool AutoExecuteStatusInheritedFrom = "ElasticPool" - AutoExecuteStatusInheritedFromDatabase AutoExecuteStatusInheritedFrom = "Database" + AutoExecuteStatusInheritedFromServer AutoExecuteStatusInheritedFrom = "Server" + AutoExecuteStatusInheritedFromSubscription AutoExecuteStatusInheritedFrom = "Subscription" ) // PossibleAutoExecuteStatusInheritedFromValues returns the possible values for the AutoExecuteStatusInheritedFrom const type. func PossibleAutoExecuteStatusInheritedFromValues() []AutoExecuteStatusInheritedFrom { return []AutoExecuteStatusInheritedFrom{ + AutoExecuteStatusInheritedFromDatabase, AutoExecuteStatusInheritedFromDefault, - AutoExecuteStatusInheritedFromSubscription, - AutoExecuteStatusInheritedFromServer, AutoExecuteStatusInheritedFromElasticPool, - AutoExecuteStatusInheritedFromDatabase, + AutoExecuteStatusInheritedFromServer, + AutoExecuteStatusInheritedFromSubscription, } } @@ -175,25 +190,25 @@ func PossibleAutoExecuteStatusInheritedFromValues() []AutoExecuteStatusInherited type AutomaticTuningDisabledReason string const ( + AutomaticTuningDisabledReasonAutoConfigured AutomaticTuningDisabledReason = "AutoConfigured" AutomaticTuningDisabledReasonDefault AutomaticTuningDisabledReason = "Default" AutomaticTuningDisabledReasonDisabled AutomaticTuningDisabledReason = "Disabled" - AutomaticTuningDisabledReasonAutoConfigured AutomaticTuningDisabledReason = "AutoConfigured" AutomaticTuningDisabledReasonInheritedFromServer AutomaticTuningDisabledReason = "InheritedFromServer" + AutomaticTuningDisabledReasonNotSupported AutomaticTuningDisabledReason = "NotSupported" AutomaticTuningDisabledReasonQueryStoreOff AutomaticTuningDisabledReason = "QueryStoreOff" AutomaticTuningDisabledReasonQueryStoreReadOnly AutomaticTuningDisabledReason = "QueryStoreReadOnly" - AutomaticTuningDisabledReasonNotSupported AutomaticTuningDisabledReason = "NotSupported" ) // PossibleAutomaticTuningDisabledReasonValues returns the possible values for the AutomaticTuningDisabledReason const type. func PossibleAutomaticTuningDisabledReasonValues() []AutomaticTuningDisabledReason { return []AutomaticTuningDisabledReason{ + AutomaticTuningDisabledReasonAutoConfigured, AutomaticTuningDisabledReasonDefault, AutomaticTuningDisabledReasonDisabled, - AutomaticTuningDisabledReasonAutoConfigured, AutomaticTuningDisabledReasonInheritedFromServer, + AutomaticTuningDisabledReasonNotSupported, AutomaticTuningDisabledReasonQueryStoreOff, AutomaticTuningDisabledReasonQueryStoreReadOnly, - AutomaticTuningDisabledReasonNotSupported, } } @@ -201,18 +216,18 @@ func PossibleAutomaticTuningDisabledReasonValues() []AutomaticTuningDisabledReas type AutomaticTuningMode string const ( - AutomaticTuningModeInherit AutomaticTuningMode = "Inherit" - AutomaticTuningModeCustom AutomaticTuningMode = "Custom" AutomaticTuningModeAuto AutomaticTuningMode = "Auto" + AutomaticTuningModeCustom AutomaticTuningMode = "Custom" + AutomaticTuningModeInherit AutomaticTuningMode = "Inherit" AutomaticTuningModeUnspecified AutomaticTuningMode = "Unspecified" ) // PossibleAutomaticTuningModeValues returns the possible values for the AutomaticTuningMode const type. func PossibleAutomaticTuningModeValues() []AutomaticTuningMode { return []AutomaticTuningMode{ - AutomaticTuningModeInherit, - AutomaticTuningModeCustom, AutomaticTuningModeAuto, + AutomaticTuningModeCustom, + AutomaticTuningModeInherit, AutomaticTuningModeUnspecified, } } @@ -237,17 +252,17 @@ func PossibleAutomaticTuningOptionModeActualValues() []AutomaticTuningOptionMode type AutomaticTuningOptionModeDesired string const ( + AutomaticTuningOptionModeDesiredDefault AutomaticTuningOptionModeDesired = "Default" AutomaticTuningOptionModeDesiredOff AutomaticTuningOptionModeDesired = "Off" AutomaticTuningOptionModeDesiredOn AutomaticTuningOptionModeDesired = "On" - AutomaticTuningOptionModeDesiredDefault AutomaticTuningOptionModeDesired = "Default" ) // PossibleAutomaticTuningOptionModeDesiredValues returns the possible values for the AutomaticTuningOptionModeDesired const type. func PossibleAutomaticTuningOptionModeDesiredValues() []AutomaticTuningOptionModeDesired { return []AutomaticTuningOptionModeDesired{ + AutomaticTuningOptionModeDesiredDefault, AutomaticTuningOptionModeDesiredOff, AutomaticTuningOptionModeDesiredOn, - AutomaticTuningOptionModeDesiredDefault, } } @@ -255,16 +270,16 @@ func PossibleAutomaticTuningOptionModeDesiredValues() []AutomaticTuningOptionMod type AutomaticTuningServerMode string const ( - AutomaticTuningServerModeCustom AutomaticTuningServerMode = "Custom" AutomaticTuningServerModeAuto AutomaticTuningServerMode = "Auto" + AutomaticTuningServerModeCustom AutomaticTuningServerMode = "Custom" AutomaticTuningServerModeUnspecified AutomaticTuningServerMode = "Unspecified" ) // PossibleAutomaticTuningServerModeValues returns the possible values for the AutomaticTuningServerMode const type. func PossibleAutomaticTuningServerModeValues() []AutomaticTuningServerMode { return []AutomaticTuningServerMode{ - AutomaticTuningServerModeCustom, AutomaticTuningServerModeAuto, + AutomaticTuningServerModeCustom, AutomaticTuningServerModeUnspecified, } } @@ -273,17 +288,37 @@ func PossibleAutomaticTuningServerModeValues() []AutomaticTuningServerMode { type AutomaticTuningServerReason string const ( + AutomaticTuningServerReasonAutoConfigured AutomaticTuningServerReason = "AutoConfigured" AutomaticTuningServerReasonDefault AutomaticTuningServerReason = "Default" AutomaticTuningServerReasonDisabled AutomaticTuningServerReason = "Disabled" - AutomaticTuningServerReasonAutoConfigured AutomaticTuningServerReason = "AutoConfigured" ) // PossibleAutomaticTuningServerReasonValues returns the possible values for the AutomaticTuningServerReason const type. func PossibleAutomaticTuningServerReasonValues() []AutomaticTuningServerReason { return []AutomaticTuningServerReason{ + AutomaticTuningServerReasonAutoConfigured, AutomaticTuningServerReasonDefault, AutomaticTuningServerReasonDisabled, - AutomaticTuningServerReasonAutoConfigured, + } +} + +// AvailabilityZoneType - Specifies the availability zone the database is pinned to. +type AvailabilityZoneType string + +const ( + AvailabilityZoneTypeNoPreference AvailabilityZoneType = "NoPreference" + AvailabilityZoneTypeOne AvailabilityZoneType = "1" + AvailabilityZoneTypeThree AvailabilityZoneType = "3" + AvailabilityZoneTypeTwo AvailabilityZoneType = "2" +) + +// PossibleAvailabilityZoneTypeValues returns the possible values for the AvailabilityZoneType const type. +func PossibleAvailabilityZoneTypeValues() []AvailabilityZoneType { + return []AvailabilityZoneType{ + AvailabilityZoneTypeNoPreference, + AvailabilityZoneTypeOne, + AvailabilityZoneTypeThree, + AvailabilityZoneTypeTwo, } } @@ -307,20 +342,33 @@ func PossibleBackupStorageRedundancyValues() []BackupStorageRedundancy { } } +type BaselineName string + +const ( + BaselineNameDefault BaselineName = "default" +) + +// PossibleBaselineNameValues returns the possible values for the BaselineName const type. +func PossibleBaselineNameValues() []BaselineName { + return []BaselineName{ + BaselineNameDefault, + } +} + // BlobAuditingPolicyState - Specifies the state of the audit. If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled // are required. type BlobAuditingPolicyState string const ( - BlobAuditingPolicyStateEnabled BlobAuditingPolicyState = "Enabled" BlobAuditingPolicyStateDisabled BlobAuditingPolicyState = "Disabled" + BlobAuditingPolicyStateEnabled BlobAuditingPolicyState = "Enabled" ) // PossibleBlobAuditingPolicyStateValues returns the possible values for the BlobAuditingPolicyState const type. func PossibleBlobAuditingPolicyStateValues() []BlobAuditingPolicyState { return []BlobAuditingPolicyState{ - BlobAuditingPolicyStateEnabled, BlobAuditingPolicyStateDisabled, + BlobAuditingPolicyStateEnabled, } } @@ -349,19 +397,19 @@ func PossibleCapabilityGroupValues() []CapabilityGroup { type CapabilityStatus string const ( - CapabilityStatusVisible CapabilityStatus = "Visible" CapabilityStatusAvailable CapabilityStatus = "Available" CapabilityStatusDefault CapabilityStatus = "Default" CapabilityStatusDisabled CapabilityStatus = "Disabled" + CapabilityStatusVisible CapabilityStatus = "Visible" ) // PossibleCapabilityStatusValues returns the possible values for the CapabilityStatus const type. func PossibleCapabilityStatusValues() []CapabilityStatus { return []CapabilityStatus{ - CapabilityStatusVisible, CapabilityStatusAvailable, CapabilityStatusDefault, CapabilityStatusDisabled, + CapabilityStatusVisible, } } @@ -386,15 +434,15 @@ func PossibleCatalogCollationTypeValues() []CatalogCollationType { type CheckNameAvailabilityReason string const ( - CheckNameAvailabilityReasonInvalid CheckNameAvailabilityReason = "Invalid" CheckNameAvailabilityReasonAlreadyExists CheckNameAvailabilityReason = "AlreadyExists" + CheckNameAvailabilityReasonInvalid CheckNameAvailabilityReason = "Invalid" ) // PossibleCheckNameAvailabilityReasonValues returns the possible values for the CheckNameAvailabilityReason const type. func PossibleCheckNameAvailabilityReasonValues() []CheckNameAvailabilityReason { return []CheckNameAvailabilityReason{ - CheckNameAvailabilityReasonInvalid, CheckNameAvailabilityReasonAlreadyExists, + CheckNameAvailabilityReasonInvalid, } } @@ -561,19 +609,21 @@ func PossibleCreatedByTypeValues() []CreatedByType { } } -// DNSRefreshConfigurationPropertiesStatus - The status of the DNS refresh operation. -type DNSRefreshConfigurationPropertiesStatus string +// DNSRefreshOperationStatus - The status of the DNS refresh operation. +type DNSRefreshOperationStatus string const ( - DNSRefreshConfigurationPropertiesStatusFailed DNSRefreshConfigurationPropertiesStatus = "Failed" - DNSRefreshConfigurationPropertiesStatusSucceeded DNSRefreshConfigurationPropertiesStatus = "Succeeded" + DNSRefreshOperationStatusFailed DNSRefreshOperationStatus = "Failed" + DNSRefreshOperationStatusInProgress DNSRefreshOperationStatus = "InProgress" + DNSRefreshOperationStatusSucceeded DNSRefreshOperationStatus = "Succeeded" ) -// PossibleDNSRefreshConfigurationPropertiesStatusValues returns the possible values for the DNSRefreshConfigurationPropertiesStatus const type. -func PossibleDNSRefreshConfigurationPropertiesStatusValues() []DNSRefreshConfigurationPropertiesStatus { - return []DNSRefreshConfigurationPropertiesStatus{ - DNSRefreshConfigurationPropertiesStatusFailed, - DNSRefreshConfigurationPropertiesStatusSucceeded, +// PossibleDNSRefreshOperationStatusValues returns the possible values for the DNSRefreshOperationStatus const type. +func PossibleDNSRefreshOperationStatusValues() []DNSRefreshOperationStatus { + return []DNSRefreshOperationStatus{ + DNSRefreshOperationStatusFailed, + DNSRefreshOperationStatusInProgress, + DNSRefreshOperationStatusSucceeded, } } @@ -581,8 +631,8 @@ func PossibleDNSRefreshConfigurationPropertiesStatusValues() []DNSRefreshConfigu type DataMaskingFunction string const ( - DataMaskingFunctionDefault DataMaskingFunction = "Default" DataMaskingFunctionCCN DataMaskingFunction = "CCN" + DataMaskingFunctionDefault DataMaskingFunction = "Default" DataMaskingFunctionEmail DataMaskingFunction = "Email" DataMaskingFunctionNumber DataMaskingFunction = "Number" DataMaskingFunctionSSN DataMaskingFunction = "SSN" @@ -592,8 +642,8 @@ const ( // PossibleDataMaskingFunctionValues returns the possible values for the DataMaskingFunction const type. func PossibleDataMaskingFunctionValues() []DataMaskingFunction { return []DataMaskingFunction{ - DataMaskingFunctionDefault, DataMaskingFunctionCCN, + DataMaskingFunctionDefault, DataMaskingFunctionEmail, DataMaskingFunctionNumber, DataMaskingFunctionSSN, @@ -601,6 +651,19 @@ func PossibleDataMaskingFunctionValues() []DataMaskingFunction { } } +type DataMaskingPolicyName string + +const ( + DataMaskingPolicyNameDefault DataMaskingPolicyName = "Default" +) + +// PossibleDataMaskingPolicyNameValues returns the possible values for the DataMaskingPolicyName const type. +func PossibleDataMaskingPolicyNameValues() []DataMaskingPolicyName { + return []DataMaskingPolicyName{ + DataMaskingPolicyNameDefault, + } +} + // DataMaskingRuleState - The rule state. Used to delete a rule. To delete an existing rule, specify the schemaName, tableName, // columnName, maskingFunction, and specify ruleState as disabled. However, if the rule doesn't // already exist, the rule will be created with ruleState set to enabled, regardless of the provided value of ruleState. @@ -664,6 +727,20 @@ func PossibleDatabaseIdentityTypeValues() []DatabaseIdentityType { } } +// DatabaseKeyType - The database key type. Only supported value is 'AzureKeyVault'. +type DatabaseKeyType string + +const ( + DatabaseKeyTypeAzureKeyVault DatabaseKeyType = "AzureKeyVault" +) + +// PossibleDatabaseKeyTypeValues returns the possible values for the DatabaseKeyType const type. +func PossibleDatabaseKeyTypeValues() []DatabaseKeyType { + return []DatabaseKeyType{ + DatabaseKeyTypeAzureKeyVault, + } +} + // DatabaseLicenseType - The license type to apply for this database. LicenseIncluded if you need a license, or BasePrice // if you have a license and are eligible for the Azure Hybrid Benefit. type DatabaseLicenseType string @@ -802,6 +879,19 @@ func PossibleDayOfWeekValues() []DayOfWeek { } } +type DevOpsAuditingSettingsName string + +const ( + DevOpsAuditingSettingsNameDefault DevOpsAuditingSettingsName = "Default" +) + +// PossibleDevOpsAuditingSettingsNameValues returns the possible values for the DevOpsAuditingSettingsName const type. +func PossibleDevOpsAuditingSettingsNameValues() []DevOpsAuditingSettingsName { + return []DevOpsAuditingSettingsName{ + DevOpsAuditingSettingsNameDefault, + } +} + // DiffBackupIntervalInHours - The differential backup interval in hours. This is how many interval hours between each differential // backup will be supported. This is only applicable to live databases but not dropped databases. type DiffBackupIntervalInHours int32 @@ -819,6 +909,19 @@ func PossibleDiffBackupIntervalInHoursValues() []DiffBackupIntervalInHours { } } +type DtcName string + +const ( + DtcNameCurrent DtcName = "current" +) + +// PossibleDtcNameValues returns the possible values for the DtcName const type. +func PossibleDtcNameValues() []DtcName { + return []DtcName{ + DtcNameCurrent, + } +} + // ElasticPoolLicenseType - The license type to apply for this elastic pool. type ElasticPoolLicenseType string @@ -866,6 +969,22 @@ func PossibleEncryptionProtectorNameValues() []EncryptionProtectorName { } } +// ExternalGovernanceStatus - Status of external governance. +type ExternalGovernanceStatus string + +const ( + ExternalGovernanceStatusDisabled ExternalGovernanceStatus = "Disabled" + ExternalGovernanceStatusEnabled ExternalGovernanceStatus = "Enabled" +) + +// PossibleExternalGovernanceStatusValues returns the possible values for the ExternalGovernanceStatus const type. +func PossibleExternalGovernanceStatusValues() []ExternalGovernanceStatus { + return []ExternalGovernanceStatus{ + ExternalGovernanceStatusDisabled, + ExternalGovernanceStatusEnabled, + } +} + // FailoverGroupReplicationRole - Local replication role of the failover group instance. type FailoverGroupReplicationRole string @@ -936,15 +1055,15 @@ func PossibleIdentityTypeValues() []IdentityType { type ImplementationMethod string const ( - ImplementationMethodTSQL ImplementationMethod = "TSql" ImplementationMethodAzurePowerShell ImplementationMethod = "AzurePowerShell" + ImplementationMethodTSQL ImplementationMethod = "TSql" ) // PossibleImplementationMethodValues returns the possible values for the ImplementationMethod const type. func PossibleImplementationMethodValues() []ImplementationMethod { return []ImplementationMethod{ - ImplementationMethodTSQL, ImplementationMethodAzurePowerShell, + ImplementationMethodTSQL, } } @@ -981,19 +1100,35 @@ func PossibleInstancePoolLicenseTypeValues() []InstancePoolLicenseType { } } +// InstanceRole - New role of managed instance in a distributed availability group, can be Primary or Secondary. +type InstanceRole string + +const ( + InstanceRolePrimary InstanceRole = "Primary" + InstanceRoleSecondary InstanceRole = "Secondary" +) + +// PossibleInstanceRoleValues returns the possible values for the InstanceRole const type. +func PossibleInstanceRoleValues() []InstanceRole { + return []InstanceRole{ + InstanceRolePrimary, + InstanceRoleSecondary, + } +} + // IsRetryable - Gets whether the error could be ignored and recommended action could be retried. Possible values are: Yes/No type IsRetryable string const ( - IsRetryableYes IsRetryable = "Yes" IsRetryableNo IsRetryable = "No" + IsRetryableYes IsRetryable = "Yes" ) // PossibleIsRetryableValues returns the possible values for the IsRetryable const type. func PossibleIsRetryableValues() []IsRetryable { return []IsRetryable{ - IsRetryableYes, IsRetryableNo, + IsRetryableYes, } } @@ -1113,15 +1248,15 @@ func PossibleJobStepOutputTypeValues() []JobStepOutputType { type JobTargetGroupMembershipType string const ( - JobTargetGroupMembershipTypeInclude JobTargetGroupMembershipType = "Include" JobTargetGroupMembershipTypeExclude JobTargetGroupMembershipType = "Exclude" + JobTargetGroupMembershipTypeInclude JobTargetGroupMembershipType = "Include" ) // PossibleJobTargetGroupMembershipTypeValues returns the possible values for the JobTargetGroupMembershipType const type. func PossibleJobTargetGroupMembershipTypeValues() []JobTargetGroupMembershipType { return []JobTargetGroupMembershipType{ - JobTargetGroupMembershipTypeInclude, JobTargetGroupMembershipTypeExclude, + JobTargetGroupMembershipTypeInclude, } } @@ -1164,15 +1299,15 @@ func PossibleLedgerDigestUploadsNameValues() []LedgerDigestUploadsName { type LedgerDigestUploadsState string const ( - LedgerDigestUploadsStateEnabled LedgerDigestUploadsState = "Enabled" LedgerDigestUploadsStateDisabled LedgerDigestUploadsState = "Disabled" + LedgerDigestUploadsStateEnabled LedgerDigestUploadsState = "Enabled" ) // PossibleLedgerDigestUploadsStateValues returns the possible values for the LedgerDigestUploadsState const type. func PossibleLedgerDigestUploadsStateValues() []LedgerDigestUploadsState { return []LedgerDigestUploadsState{ - LedgerDigestUploadsStateEnabled, LedgerDigestUploadsStateDisabled, + LedgerDigestUploadsStateEnabled, } } @@ -1244,11 +1379,16 @@ type ManagedDatabaseStatus string const ( ManagedDatabaseStatusCreating ManagedDatabaseStatus = "Creating" + ManagedDatabaseStatusDbCopying ManagedDatabaseStatus = "DbCopying" + ManagedDatabaseStatusDbMoving ManagedDatabaseStatus = "DbMoving" ManagedDatabaseStatusInaccessible ManagedDatabaseStatus = "Inaccessible" ManagedDatabaseStatusOffline ManagedDatabaseStatus = "Offline" ManagedDatabaseStatusOnline ManagedDatabaseStatus = "Online" ManagedDatabaseStatusRestoring ManagedDatabaseStatus = "Restoring" ManagedDatabaseStatusShutdown ManagedDatabaseStatus = "Shutdown" + ManagedDatabaseStatusStarting ManagedDatabaseStatus = "Starting" + ManagedDatabaseStatusStopped ManagedDatabaseStatus = "Stopped" + ManagedDatabaseStatusStopping ManagedDatabaseStatus = "Stopping" ManagedDatabaseStatusUpdating ManagedDatabaseStatus = "Updating" ) @@ -1256,11 +1396,16 @@ const ( func PossibleManagedDatabaseStatusValues() []ManagedDatabaseStatus { return []ManagedDatabaseStatus{ ManagedDatabaseStatusCreating, + ManagedDatabaseStatusDbCopying, + ManagedDatabaseStatusDbMoving, ManagedDatabaseStatusInaccessible, ManagedDatabaseStatusOffline, ManagedDatabaseStatusOnline, ManagedDatabaseStatusRestoring, ManagedDatabaseStatusShutdown, + ManagedDatabaseStatusStarting, + ManagedDatabaseStatusStopped, + ManagedDatabaseStatusStopping, ManagedDatabaseStatusUpdating, } } @@ -1309,47 +1454,6 @@ func PossibleManagedInstanceLongTermRetentionPolicyNameValues() []ManagedInstanc } } -type ManagedInstancePropertiesProvisioningState string - -const ( - ManagedInstancePropertiesProvisioningStateAccepted ManagedInstancePropertiesProvisioningState = "Accepted" - ManagedInstancePropertiesProvisioningStateCanceled ManagedInstancePropertiesProvisioningState = "Canceled" - ManagedInstancePropertiesProvisioningStateCreated ManagedInstancePropertiesProvisioningState = "Created" - ManagedInstancePropertiesProvisioningStateCreating ManagedInstancePropertiesProvisioningState = "Creating" - ManagedInstancePropertiesProvisioningStateDeleted ManagedInstancePropertiesProvisioningState = "Deleted" - ManagedInstancePropertiesProvisioningStateDeleting ManagedInstancePropertiesProvisioningState = "Deleting" - ManagedInstancePropertiesProvisioningStateFailed ManagedInstancePropertiesProvisioningState = "Failed" - ManagedInstancePropertiesProvisioningStateNotSpecified ManagedInstancePropertiesProvisioningState = "NotSpecified" - ManagedInstancePropertiesProvisioningStateRegistering ManagedInstancePropertiesProvisioningState = "Registering" - ManagedInstancePropertiesProvisioningStateRunning ManagedInstancePropertiesProvisioningState = "Running" - ManagedInstancePropertiesProvisioningStateSucceeded ManagedInstancePropertiesProvisioningState = "Succeeded" - ManagedInstancePropertiesProvisioningStateTimedOut ManagedInstancePropertiesProvisioningState = "TimedOut" - ManagedInstancePropertiesProvisioningStateUnknown ManagedInstancePropertiesProvisioningState = "Unknown" - ManagedInstancePropertiesProvisioningStateUnrecognized ManagedInstancePropertiesProvisioningState = "Unrecognized" - ManagedInstancePropertiesProvisioningStateUpdating ManagedInstancePropertiesProvisioningState = "Updating" -) - -// PossibleManagedInstancePropertiesProvisioningStateValues returns the possible values for the ManagedInstancePropertiesProvisioningState const type. -func PossibleManagedInstancePropertiesProvisioningStateValues() []ManagedInstancePropertiesProvisioningState { - return []ManagedInstancePropertiesProvisioningState{ - ManagedInstancePropertiesProvisioningStateAccepted, - ManagedInstancePropertiesProvisioningStateCanceled, - ManagedInstancePropertiesProvisioningStateCreated, - ManagedInstancePropertiesProvisioningStateCreating, - ManagedInstancePropertiesProvisioningStateDeleted, - ManagedInstancePropertiesProvisioningStateDeleting, - ManagedInstancePropertiesProvisioningStateFailed, - ManagedInstancePropertiesProvisioningStateNotSpecified, - ManagedInstancePropertiesProvisioningStateRegistering, - ManagedInstancePropertiesProvisioningStateRunning, - ManagedInstancePropertiesProvisioningStateSucceeded, - ManagedInstancePropertiesProvisioningStateTimedOut, - ManagedInstancePropertiesProvisioningStateUnknown, - ManagedInstancePropertiesProvisioningStateUnrecognized, - ManagedInstancePropertiesProvisioningStateUpdating, - } -} - // ManagedInstanceProxyOverride - Connection type used for connecting to the instance. type ManagedInstanceProxyOverride string @@ -1368,6 +1472,35 @@ func PossibleManagedInstanceProxyOverrideValues() []ManagedInstanceProxyOverride } } +type ManagedLedgerDigestUploadsName string + +const ( + ManagedLedgerDigestUploadsNameCurrent ManagedLedgerDigestUploadsName = "current" +) + +// PossibleManagedLedgerDigestUploadsNameValues returns the possible values for the ManagedLedgerDigestUploadsName const type. +func PossibleManagedLedgerDigestUploadsNameValues() []ManagedLedgerDigestUploadsName { + return []ManagedLedgerDigestUploadsName{ + ManagedLedgerDigestUploadsNameCurrent, + } +} + +// ManagedLedgerDigestUploadsState - Specifies the state of ledger digest upload. +type ManagedLedgerDigestUploadsState string + +const ( + ManagedLedgerDigestUploadsStateDisabled ManagedLedgerDigestUploadsState = "Disabled" + ManagedLedgerDigestUploadsStateEnabled ManagedLedgerDigestUploadsState = "Enabled" +) + +// PossibleManagedLedgerDigestUploadsStateValues returns the possible values for the ManagedLedgerDigestUploadsState const type. +func PossibleManagedLedgerDigestUploadsStateValues() []ManagedLedgerDigestUploadsState { + return []ManagedLedgerDigestUploadsState{ + ManagedLedgerDigestUploadsStateDisabled, + ManagedLedgerDigestUploadsStateEnabled, + } +} + // ManagedServerCreateMode - Specifies the mode of database creation. // Default: Regular instance creation. // Restore: Creates an instance by restoring a set of backups to specific point in time. RestorePointInTime and SourceManagedInstanceId @@ -1465,16 +1598,36 @@ func PossibleMetricTypeValues() []MetricType { } } -// OperationMode - Operation Mode. +// MoveOperationMode - Operation mode. +type MoveOperationMode string + +const ( + MoveOperationModeCopy MoveOperationMode = "Copy" + MoveOperationModeMove MoveOperationMode = "Move" +) + +// PossibleMoveOperationModeValues returns the possible values for the MoveOperationMode const type. +func PossibleMoveOperationModeValues() []MoveOperationMode { + return []MoveOperationMode{ + MoveOperationModeCopy, + MoveOperationModeMove, + } +} + +// OperationMode - Operation mode of the operation: Import, Export, or PolybaseImport. type OperationMode string const ( + OperationModeExport OperationMode = "Export" + OperationModeImport OperationMode = "Import" OperationModePolybaseImport OperationMode = "PolybaseImport" ) // PossibleOperationModeValues returns the possible values for the OperationMode const type. func PossibleOperationModeValues() []OperationMode { return []OperationMode{ + OperationModeExport, + OperationModeImport, OperationModePolybaseImport, } } @@ -1525,27 +1678,23 @@ func PossiblePerformanceLevelUnitValues() []PerformanceLevelUnit { } } -// PrimaryAggregationType - The primary aggregation type defining how metric values are displayed. -type PrimaryAggregationType string +// Phase - The operation phase. +type Phase string const ( - PrimaryAggregationTypeAverage PrimaryAggregationType = "Average" - PrimaryAggregationTypeCount PrimaryAggregationType = "Count" - PrimaryAggregationTypeMaximum PrimaryAggregationType = "Maximum" - PrimaryAggregationTypeMinimum PrimaryAggregationType = "Minimum" - PrimaryAggregationTypeNone PrimaryAggregationType = "None" - PrimaryAggregationTypeTotal PrimaryAggregationType = "Total" + PhaseCatchup Phase = "Catchup" + PhaseCopying Phase = "Copying" + PhaseCutoverInProgress Phase = "CutoverInProgress" + PhaseWaitingForCutover Phase = "WaitingForCutover" ) -// PossiblePrimaryAggregationTypeValues returns the possible values for the PrimaryAggregationType const type. -func PossiblePrimaryAggregationTypeValues() []PrimaryAggregationType { - return []PrimaryAggregationType{ - PrimaryAggregationTypeAverage, - PrimaryAggregationTypeCount, - PrimaryAggregationTypeMaximum, - PrimaryAggregationTypeMinimum, - PrimaryAggregationTypeNone, - PrimaryAggregationTypeTotal, +// PossiblePhaseValues returns the possible values for the Phase const type. +func PossiblePhaseValues() []Phase { + return []Phase{ + PhaseCatchup, + PhaseCopying, + PhaseCutoverInProgress, + PhaseWaitingForCutover, } } @@ -1766,30 +1915,30 @@ func PossibleRecommendedActionCurrentStateValues() []RecommendedActionCurrentSta type RecommendedActionInitiatedBy string const ( - RecommendedActionInitiatedByUser RecommendedActionInitiatedBy = "User" RecommendedActionInitiatedBySystem RecommendedActionInitiatedBy = "System" + RecommendedActionInitiatedByUser RecommendedActionInitiatedBy = "User" ) // PossibleRecommendedActionInitiatedByValues returns the possible values for the RecommendedActionInitiatedBy const type. func PossibleRecommendedActionInitiatedByValues() []RecommendedActionInitiatedBy { return []RecommendedActionInitiatedBy{ - RecommendedActionInitiatedByUser, RecommendedActionInitiatedBySystem, + RecommendedActionInitiatedByUser, } } type RecommendedSensitivityLabelUpdateKind string const ( - RecommendedSensitivityLabelUpdateKindEnable RecommendedSensitivityLabelUpdateKind = "enable" RecommendedSensitivityLabelUpdateKindDisable RecommendedSensitivityLabelUpdateKind = "disable" + RecommendedSensitivityLabelUpdateKindEnable RecommendedSensitivityLabelUpdateKind = "enable" ) // PossibleRecommendedSensitivityLabelUpdateKindValues returns the possible values for the RecommendedSensitivityLabelUpdateKind const type. func PossibleRecommendedSensitivityLabelUpdateKindValues() []RecommendedSensitivityLabelUpdateKind { return []RecommendedSensitivityLabelUpdateKind{ - RecommendedSensitivityLabelUpdateKindEnable, RecommendedSensitivityLabelUpdateKindDisable, + RecommendedSensitivityLabelUpdateKindEnable, } } @@ -1808,12 +1957,13 @@ func PossibleReplicaTypeValues() []ReplicaType { } } -// ReplicationLinkType - Link type (GEO, NAMED). +// ReplicationLinkType - Link type (GEO, NAMED, STANDBY). type ReplicationLinkType string const ( - ReplicationLinkTypeGEO ReplicationLinkType = "GEO" - ReplicationLinkTypeNAMED ReplicationLinkType = "NAMED" + ReplicationLinkTypeGEO ReplicationLinkType = "GEO" + ReplicationLinkTypeNAMED ReplicationLinkType = "NAMED" + ReplicationLinkTypeSTANDBY ReplicationLinkType = "STANDBY" ) // PossibleReplicationLinkTypeValues returns the possible values for the ReplicationLinkType const type. @@ -1821,6 +1971,7 @@ func PossibleReplicationLinkTypeValues() []ReplicationLinkType { return []ReplicationLinkType{ ReplicationLinkTypeGEO, ReplicationLinkTypeNAMED, + ReplicationLinkTypeSTANDBY, } } @@ -1844,21 +1995,21 @@ func PossibleReplicationModeValues() []ReplicationMode { type ReplicationRole string const ( + ReplicationRoleCopy ReplicationRole = "Copy" + ReplicationRoleNonReadableSecondary ReplicationRole = "NonReadableSecondary" ReplicationRolePrimary ReplicationRole = "Primary" ReplicationRoleSecondary ReplicationRole = "Secondary" - ReplicationRoleNonReadableSecondary ReplicationRole = "NonReadableSecondary" ReplicationRoleSource ReplicationRole = "Source" - ReplicationRoleCopy ReplicationRole = "Copy" ) // PossibleReplicationRoleValues returns the possible values for the ReplicationRole const type. func PossibleReplicationRoleValues() []ReplicationRole { return []ReplicationRole{ + ReplicationRoleCopy, + ReplicationRoleNonReadableSecondary, ReplicationRolePrimary, ReplicationRoleSecondary, - ReplicationRoleNonReadableSecondary, ReplicationRoleSource, - ReplicationRoleCopy, } } @@ -1911,6 +2062,82 @@ func PossibleRestorePointTypeValues() []RestorePointType { } } +// RoleChangeType - The type of the role change, can be Planned or Forced. +type RoleChangeType string + +const ( + RoleChangeTypeForced RoleChangeType = "Forced" + RoleChangeTypePlanned RoleChangeType = "Planned" +) + +// PossibleRoleChangeTypeValues returns the possible values for the RoleChangeType const type. +func PossibleRoleChangeTypeValues() []RoleChangeType { + return []RoleChangeType{ + RoleChangeTypeForced, + RoleChangeTypePlanned, + } +} + +// RuleSeverity - SQL Vulnerability Assessment rule severity. +type RuleSeverity string + +const ( + RuleSeverityHigh RuleSeverity = "High" + RuleSeverityInformational RuleSeverity = "Informational" + RuleSeverityLow RuleSeverity = "Low" + RuleSeverityMedium RuleSeverity = "Medium" + RuleSeverityObsolete RuleSeverity = "Obsolete" +) + +// PossibleRuleSeverityValues returns the possible values for the RuleSeverity const type. +func PossibleRuleSeverityValues() []RuleSeverity { + return []RuleSeverity{ + RuleSeverityHigh, + RuleSeverityInformational, + RuleSeverityLow, + RuleSeverityMedium, + RuleSeverityObsolete, + } +} + +// RuleStatus - SQL Vulnerability Assessment baseline status +type RuleStatus string + +const ( + RuleStatusFinding RuleStatus = "Finding" + RuleStatusInternalError RuleStatus = "InternalError" + RuleStatusNonFinding RuleStatus = "NonFinding" +) + +// PossibleRuleStatusValues returns the possible values for the RuleStatus const type. +func PossibleRuleStatusValues() []RuleStatus { + return []RuleStatus{ + RuleStatusFinding, + RuleStatusInternalError, + RuleStatusNonFinding, + } +} + +// RuleType - SQL Vulnerability Assessment rule type. +type RuleType string + +const ( + RuleTypeBaselineExpected RuleType = "BaselineExpected" + RuleTypeBinary RuleType = "Binary" + RuleTypeNegativeList RuleType = "NegativeList" + RuleTypePositiveList RuleType = "PositiveList" +) + +// PossibleRuleTypeValues returns the possible values for the RuleType const type. +func PossibleRuleTypeValues() []RuleType { + return []RuleType{ + RuleTypeBaselineExpected, + RuleTypeBinary, + RuleTypeNegativeList, + RuleTypePositiveList, + } +} + // SQLAgentConfigurationPropertiesState - The state of Sql Agent. type SQLAgentConfigurationPropertiesState string @@ -1927,6 +2154,36 @@ func PossibleSQLAgentConfigurationPropertiesStateValues() []SQLAgentConfiguratio } } +type SQLVulnerabilityAssessmentName string + +const ( + SQLVulnerabilityAssessmentNameDefault SQLVulnerabilityAssessmentName = "default" +) + +// PossibleSQLVulnerabilityAssessmentNameValues returns the possible values for the SQLVulnerabilityAssessmentName const type. +func PossibleSQLVulnerabilityAssessmentNameValues() []SQLVulnerabilityAssessmentName { + return []SQLVulnerabilityAssessmentName{ + SQLVulnerabilityAssessmentNameDefault, + } +} + +// SQLVulnerabilityAssessmentState - Specifies the state of the SQL Vulnerability Assessment, whether it is enabled or disabled +// or a state has not been applied yet on the specific database or server. +type SQLVulnerabilityAssessmentState string + +const ( + SQLVulnerabilityAssessmentStateDisabled SQLVulnerabilityAssessmentState = "Disabled" + SQLVulnerabilityAssessmentStateEnabled SQLVulnerabilityAssessmentState = "Enabled" +) + +// PossibleSQLVulnerabilityAssessmentStateValues returns the possible values for the SQLVulnerabilityAssessmentState const type. +func PossibleSQLVulnerabilityAssessmentStateValues() []SQLVulnerabilityAssessmentState { + return []SQLVulnerabilityAssessmentState{ + SQLVulnerabilityAssessmentStateDisabled, + SQLVulnerabilityAssessmentStateEnabled, + } +} + // SampleName - The name of the sample schema to apply when creating this database. type SampleName string @@ -1945,12 +2202,29 @@ func PossibleSampleNameValues() []SampleName { } } -// SecondaryType - The secondary type of the database if it is a secondary. Valid values are Geo and Named. +// SecondaryInstanceType - Type of the geo-secondary instance. Set 'Standby' if the instance is used as a DR option only. +type SecondaryInstanceType string + +const ( + SecondaryInstanceTypeGeo SecondaryInstanceType = "Geo" + SecondaryInstanceTypeStandby SecondaryInstanceType = "Standby" +) + +// PossibleSecondaryInstanceTypeValues returns the possible values for the SecondaryInstanceType const type. +func PossibleSecondaryInstanceTypeValues() []SecondaryInstanceType { + return []SecondaryInstanceType{ + SecondaryInstanceTypeGeo, + SecondaryInstanceTypeStandby, + } +} + +// SecondaryType - The secondary type of the database if it is a secondary. Valid values are Geo, Named and Standby. type SecondaryType string const ( - SecondaryTypeGeo SecondaryType = "Geo" - SecondaryTypeNamed SecondaryType = "Named" + SecondaryTypeGeo SecondaryType = "Geo" + SecondaryTypeNamed SecondaryType = "Named" + SecondaryTypeStandby SecondaryType = "Standby" ) // PossibleSecondaryTypeValues returns the possible values for the SecondaryType const type. @@ -1958,13 +2232,14 @@ func PossibleSecondaryTypeValues() []SecondaryType { return []SecondaryType{ SecondaryTypeGeo, SecondaryTypeNamed, + SecondaryTypeStandby, } } type SecurityAlertPolicyName string const ( - SecurityAlertPolicyNameDefault SecurityAlertPolicyName = "Default" + SecurityAlertPolicyNameDefault SecurityAlertPolicyName = "default" ) // PossibleSecurityAlertPolicyNameValues returns the possible values for the SecurityAlertPolicyName const type. @@ -1974,22 +2249,35 @@ func PossibleSecurityAlertPolicyNameValues() []SecurityAlertPolicyName { } } +type SecurityAlertPolicyNameAutoGenerated string + +const ( + SecurityAlertPolicyNameAutoGeneratedDefault SecurityAlertPolicyNameAutoGenerated = "Default" +) + +// PossibleSecurityAlertPolicyNameAutoGeneratedValues returns the possible values for the SecurityAlertPolicyNameAutoGenerated const type. +func PossibleSecurityAlertPolicyNameAutoGeneratedValues() []SecurityAlertPolicyNameAutoGenerated { + return []SecurityAlertPolicyNameAutoGenerated{ + SecurityAlertPolicyNameAutoGeneratedDefault, + } +} + // SecurityAlertPolicyState - Specifies the state of the policy, whether it is enabled or disabled or a policy has not been // applied yet on the specific database. type SecurityAlertPolicyState string const ( - SecurityAlertPolicyStateNew SecurityAlertPolicyState = "New" - SecurityAlertPolicyStateEnabled SecurityAlertPolicyState = "Enabled" SecurityAlertPolicyStateDisabled SecurityAlertPolicyState = "Disabled" + SecurityAlertPolicyStateEnabled SecurityAlertPolicyState = "Enabled" + SecurityAlertPolicyStateNew SecurityAlertPolicyState = "New" ) // PossibleSecurityAlertPolicyStateValues returns the possible values for the SecurityAlertPolicyState const type. func PossibleSecurityAlertPolicyStateValues() []SecurityAlertPolicyState { return []SecurityAlertPolicyState{ - SecurityAlertPolicyStateNew, - SecurityAlertPolicyStateEnabled, SecurityAlertPolicyStateDisabled, + SecurityAlertPolicyStateEnabled, + SecurityAlertPolicyStateNew, } } @@ -1998,15 +2286,15 @@ func PossibleSecurityAlertPolicyStateValues() []SecurityAlertPolicyState { type SecurityAlertsPolicyState string const ( - SecurityAlertsPolicyStateEnabled SecurityAlertsPolicyState = "Enabled" SecurityAlertsPolicyStateDisabled SecurityAlertsPolicyState = "Disabled" + SecurityAlertsPolicyStateEnabled SecurityAlertsPolicyState = "Enabled" ) // PossibleSecurityAlertsPolicyStateValues returns the possible values for the SecurityAlertsPolicyState const type. func PossibleSecurityAlertsPolicyStateValues() []SecurityAlertsPolicyState { return []SecurityAlertsPolicyState{ - SecurityAlertsPolicyStateEnabled, SecurityAlertsPolicyStateDisabled, + SecurityAlertsPolicyStateEnabled, } } @@ -2014,38 +2302,38 @@ func PossibleSecurityAlertsPolicyStateValues() []SecurityAlertsPolicyState { type SecurityEventType string const ( - SecurityEventTypeUndefined SecurityEventType = "Undefined" - SecurityEventTypeSQLInjectionVulnerability SecurityEventType = "SqlInjectionVulnerability" SecurityEventTypeSQLInjectionExploit SecurityEventType = "SqlInjectionExploit" + SecurityEventTypeSQLInjectionVulnerability SecurityEventType = "SqlInjectionVulnerability" + SecurityEventTypeUndefined SecurityEventType = "Undefined" ) // PossibleSecurityEventTypeValues returns the possible values for the SecurityEventType const type. func PossibleSecurityEventTypeValues() []SecurityEventType { return []SecurityEventType{ - SecurityEventTypeUndefined, - SecurityEventTypeSQLInjectionVulnerability, SecurityEventTypeSQLInjectionExploit, + SecurityEventTypeSQLInjectionVulnerability, + SecurityEventTypeUndefined, } } type SensitivityLabelRank string const ( - SensitivityLabelRankNone SensitivityLabelRank = "None" + SensitivityLabelRankCritical SensitivityLabelRank = "Critical" + SensitivityLabelRankHigh SensitivityLabelRank = "High" SensitivityLabelRankLow SensitivityLabelRank = "Low" SensitivityLabelRankMedium SensitivityLabelRank = "Medium" - SensitivityLabelRankHigh SensitivityLabelRank = "High" - SensitivityLabelRankCritical SensitivityLabelRank = "Critical" + SensitivityLabelRankNone SensitivityLabelRank = "None" ) // PossibleSensitivityLabelRankValues returns the possible values for the SensitivityLabelRank const type. func PossibleSensitivityLabelRankValues() []SensitivityLabelRank { return []SensitivityLabelRank{ - SensitivityLabelRankNone, + SensitivityLabelRankCritical, + SensitivityLabelRankHigh, SensitivityLabelRankLow, SensitivityLabelRankMedium, - SensitivityLabelRankHigh, - SensitivityLabelRankCritical, + SensitivityLabelRankNone, } } @@ -2067,15 +2355,28 @@ func PossibleSensitivityLabelSourceValues() []SensitivityLabelSource { type SensitivityLabelUpdateKind string const ( - SensitivityLabelUpdateKindSet SensitivityLabelUpdateKind = "set" SensitivityLabelUpdateKindRemove SensitivityLabelUpdateKind = "remove" + SensitivityLabelUpdateKindSet SensitivityLabelUpdateKind = "set" ) // PossibleSensitivityLabelUpdateKindValues returns the possible values for the SensitivityLabelUpdateKind const type. func PossibleSensitivityLabelUpdateKindValues() []SensitivityLabelUpdateKind { return []SensitivityLabelUpdateKind{ - SensitivityLabelUpdateKindSet, SensitivityLabelUpdateKindRemove, + SensitivityLabelUpdateKindSet, + } +} + +type ServerConfigurationOptionName string + +const ( + ServerConfigurationOptionNameAllowPolybaseExport ServerConfigurationOptionName = "allowPolybaseExport" +) + +// PossibleServerConfigurationOptionNameValues returns the possible values for the ServerConfigurationOptionName const type. +func PossibleServerConfigurationOptionNameValues() []ServerConfigurationOptionName { + return []ServerConfigurationOptionName{ + ServerConfigurationOptionNameAllowPolybaseExport, } } @@ -2113,8 +2414,8 @@ func PossibleServerKeyTypeValues() []ServerKeyType { } } -// ServerNetworkAccessFlag - Whether or not public endpoint access is allowed for this server. Value is optional but if passed -// in, must be 'Enabled' or 'Disabled' +// ServerNetworkAccessFlag - Whether or not to restrict outbound network access for this server. Value is optional but if +// passed in, must be 'Enabled' or 'Disabled' type ServerNetworkAccessFlag string const ( @@ -2130,6 +2431,25 @@ func PossibleServerNetworkAccessFlagValues() []ServerNetworkAccessFlag { } } +// ServerPublicNetworkAccessFlag - Whether or not public endpoint access is allowed for this server. Value is optional but +// if passed in, must be 'Enabled' or 'Disabled' or 'SecuredByPerimeter' +type ServerPublicNetworkAccessFlag string + +const ( + ServerPublicNetworkAccessFlagDisabled ServerPublicNetworkAccessFlag = "Disabled" + ServerPublicNetworkAccessFlagEnabled ServerPublicNetworkAccessFlag = "Enabled" + ServerPublicNetworkAccessFlagSecuredByPerimeter ServerPublicNetworkAccessFlag = "SecuredByPerimeter" +) + +// PossibleServerPublicNetworkAccessFlagValues returns the possible values for the ServerPublicNetworkAccessFlag const type. +func PossibleServerPublicNetworkAccessFlagValues() []ServerPublicNetworkAccessFlag { + return []ServerPublicNetworkAccessFlag{ + ServerPublicNetworkAccessFlagDisabled, + ServerPublicNetworkAccessFlagEnabled, + ServerPublicNetworkAccessFlagSecuredByPerimeter, + } +} + type ServerTrustGroupPropertiesTrustScopesItem string const ( @@ -2161,148 +2481,6 @@ func PossibleServerWorkspaceFeatureValues() []ServerWorkspaceFeature { } } -// ServiceObjectiveName - The serviceLevelObjective for SLO usage metric. -type ServiceObjectiveName string - -const ( - ServiceObjectiveNameBasic ServiceObjectiveName = "Basic" - ServiceObjectiveNameDS100 ServiceObjectiveName = "DS100" - ServiceObjectiveNameDS1000 ServiceObjectiveName = "DS1000" - ServiceObjectiveNameDS1200 ServiceObjectiveName = "DS1200" - ServiceObjectiveNameDS1500 ServiceObjectiveName = "DS1500" - ServiceObjectiveNameDS200 ServiceObjectiveName = "DS200" - ServiceObjectiveNameDS2000 ServiceObjectiveName = "DS2000" - ServiceObjectiveNameDS300 ServiceObjectiveName = "DS300" - ServiceObjectiveNameDS400 ServiceObjectiveName = "DS400" - ServiceObjectiveNameDS500 ServiceObjectiveName = "DS500" - ServiceObjectiveNameDS600 ServiceObjectiveName = "DS600" - ServiceObjectiveNameDW100 ServiceObjectiveName = "DW100" - ServiceObjectiveNameDW1000 ServiceObjectiveName = "DW1000" - ServiceObjectiveNameDW10000C ServiceObjectiveName = "DW10000c" - ServiceObjectiveNameDW1000C ServiceObjectiveName = "DW1000c" - ServiceObjectiveNameDW1200 ServiceObjectiveName = "DW1200" - ServiceObjectiveNameDW1500 ServiceObjectiveName = "DW1500" - ServiceObjectiveNameDW15000C ServiceObjectiveName = "DW15000c" - ServiceObjectiveNameDW1500C ServiceObjectiveName = "DW1500c" - ServiceObjectiveNameDW200 ServiceObjectiveName = "DW200" - ServiceObjectiveNameDW2000 ServiceObjectiveName = "DW2000" - ServiceObjectiveNameDW2000C ServiceObjectiveName = "DW2000c" - ServiceObjectiveNameDW2500C ServiceObjectiveName = "DW2500c" - ServiceObjectiveNameDW300 ServiceObjectiveName = "DW300" - ServiceObjectiveNameDW3000 ServiceObjectiveName = "DW3000" - ServiceObjectiveNameDW30000C ServiceObjectiveName = "DW30000c" - ServiceObjectiveNameDW3000C ServiceObjectiveName = "DW3000c" - ServiceObjectiveNameDW400 ServiceObjectiveName = "DW400" - ServiceObjectiveNameDW500 ServiceObjectiveName = "DW500" - ServiceObjectiveNameDW5000C ServiceObjectiveName = "DW5000c" - ServiceObjectiveNameDW600 ServiceObjectiveName = "DW600" - ServiceObjectiveNameDW6000 ServiceObjectiveName = "DW6000" - ServiceObjectiveNameDW6000C ServiceObjectiveName = "DW6000c" - ServiceObjectiveNameDW7500C ServiceObjectiveName = "DW7500c" - ServiceObjectiveNameElasticPool ServiceObjectiveName = "ElasticPool" - ServiceObjectiveNameFree ServiceObjectiveName = "Free" - ServiceObjectiveNameP1 ServiceObjectiveName = "P1" - ServiceObjectiveNameP11 ServiceObjectiveName = "P11" - ServiceObjectiveNameP15 ServiceObjectiveName = "P15" - ServiceObjectiveNameP2 ServiceObjectiveName = "P2" - ServiceObjectiveNameP3 ServiceObjectiveName = "P3" - ServiceObjectiveNameP4 ServiceObjectiveName = "P4" - ServiceObjectiveNameP6 ServiceObjectiveName = "P6" - ServiceObjectiveNamePRS1 ServiceObjectiveName = "PRS1" - ServiceObjectiveNamePRS2 ServiceObjectiveName = "PRS2" - ServiceObjectiveNamePRS4 ServiceObjectiveName = "PRS4" - ServiceObjectiveNamePRS6 ServiceObjectiveName = "PRS6" - ServiceObjectiveNameS0 ServiceObjectiveName = "S0" - ServiceObjectiveNameS1 ServiceObjectiveName = "S1" - ServiceObjectiveNameS12 ServiceObjectiveName = "S12" - ServiceObjectiveNameS2 ServiceObjectiveName = "S2" - ServiceObjectiveNameS3 ServiceObjectiveName = "S3" - ServiceObjectiveNameS4 ServiceObjectiveName = "S4" - ServiceObjectiveNameS6 ServiceObjectiveName = "S6" - ServiceObjectiveNameS7 ServiceObjectiveName = "S7" - ServiceObjectiveNameS9 ServiceObjectiveName = "S9" - ServiceObjectiveNameSystem ServiceObjectiveName = "System" - ServiceObjectiveNameSystem0 ServiceObjectiveName = "System0" - ServiceObjectiveNameSystem1 ServiceObjectiveName = "System1" - ServiceObjectiveNameSystem2 ServiceObjectiveName = "System2" - ServiceObjectiveNameSystem2L ServiceObjectiveName = "System2L" - ServiceObjectiveNameSystem3 ServiceObjectiveName = "System3" - ServiceObjectiveNameSystem3L ServiceObjectiveName = "System3L" - ServiceObjectiveNameSystem4 ServiceObjectiveName = "System4" - ServiceObjectiveNameSystem4L ServiceObjectiveName = "System4L" -) - -// PossibleServiceObjectiveNameValues returns the possible values for the ServiceObjectiveName const type. -func PossibleServiceObjectiveNameValues() []ServiceObjectiveName { - return []ServiceObjectiveName{ - ServiceObjectiveNameBasic, - ServiceObjectiveNameDS100, - ServiceObjectiveNameDS1000, - ServiceObjectiveNameDS1200, - ServiceObjectiveNameDS1500, - ServiceObjectiveNameDS200, - ServiceObjectiveNameDS2000, - ServiceObjectiveNameDS300, - ServiceObjectiveNameDS400, - ServiceObjectiveNameDS500, - ServiceObjectiveNameDS600, - ServiceObjectiveNameDW100, - ServiceObjectiveNameDW1000, - ServiceObjectiveNameDW10000C, - ServiceObjectiveNameDW1000C, - ServiceObjectiveNameDW1200, - ServiceObjectiveNameDW1500, - ServiceObjectiveNameDW15000C, - ServiceObjectiveNameDW1500C, - ServiceObjectiveNameDW200, - ServiceObjectiveNameDW2000, - ServiceObjectiveNameDW2000C, - ServiceObjectiveNameDW2500C, - ServiceObjectiveNameDW300, - ServiceObjectiveNameDW3000, - ServiceObjectiveNameDW30000C, - ServiceObjectiveNameDW3000C, - ServiceObjectiveNameDW400, - ServiceObjectiveNameDW500, - ServiceObjectiveNameDW5000C, - ServiceObjectiveNameDW600, - ServiceObjectiveNameDW6000, - ServiceObjectiveNameDW6000C, - ServiceObjectiveNameDW7500C, - ServiceObjectiveNameElasticPool, - ServiceObjectiveNameFree, - ServiceObjectiveNameP1, - ServiceObjectiveNameP11, - ServiceObjectiveNameP15, - ServiceObjectiveNameP2, - ServiceObjectiveNameP3, - ServiceObjectiveNameP4, - ServiceObjectiveNameP6, - ServiceObjectiveNamePRS1, - ServiceObjectiveNamePRS2, - ServiceObjectiveNamePRS4, - ServiceObjectiveNamePRS6, - ServiceObjectiveNameS0, - ServiceObjectiveNameS1, - ServiceObjectiveNameS12, - ServiceObjectiveNameS2, - ServiceObjectiveNameS3, - ServiceObjectiveNameS4, - ServiceObjectiveNameS6, - ServiceObjectiveNameS7, - ServiceObjectiveNameS9, - ServiceObjectiveNameSystem, - ServiceObjectiveNameSystem0, - ServiceObjectiveNameSystem1, - ServiceObjectiveNameSystem2, - ServiceObjectiveNameSystem2L, - ServiceObjectiveNameSystem3, - ServiceObjectiveNameSystem3L, - ServiceObjectiveNameSystem4, - ServiceObjectiveNameSystem4L, - } -} - // ServicePrincipalType - Service principal type. type ServicePrincipalType string @@ -2332,25 +2510,63 @@ func PossibleShortTermRetentionPolicyNameValues() []ShortTermRetentionPolicyName } } +type StartStopScheduleName string + +const ( + StartStopScheduleNameDefault StartStopScheduleName = "default" +) + +// PossibleStartStopScheduleNameValues returns the possible values for the StartStopScheduleName const type. +func PossibleStartStopScheduleNameValues() []StartStopScheduleName { + return []StartStopScheduleName{ + StartStopScheduleNameDefault, + } +} + +type Status string + +const ( + StatusCanceled Status = "Canceled" + StatusCompleted Status = "Completed" + StatusFailed Status = "Failed" + StatusInProgress Status = "InProgress" + StatusNotStarted Status = "NotStarted" + StatusSlowedDown Status = "SlowedDown" +) + +// PossibleStatusValues returns the possible values for the Status const type. +func PossibleStatusValues() []Status { + return []Status{ + StatusCanceled, + StatusCompleted, + StatusFailed, + StatusInProgress, + StatusNotStarted, + StatusSlowedDown, + } +} + // StorageCapabilityStorageAccountType - The storage account type for the database's backups. type StorageCapabilityStorageAccountType string const ( - StorageCapabilityStorageAccountTypeGRS StorageCapabilityStorageAccountType = "GRS" - StorageCapabilityStorageAccountTypeLRS StorageCapabilityStorageAccountType = "LRS" - StorageCapabilityStorageAccountTypeZRS StorageCapabilityStorageAccountType = "ZRS" + StorageCapabilityStorageAccountTypeGRS StorageCapabilityStorageAccountType = "GRS" + StorageCapabilityStorageAccountTypeGZRS StorageCapabilityStorageAccountType = "GZRS" + StorageCapabilityStorageAccountTypeLRS StorageCapabilityStorageAccountType = "LRS" + StorageCapabilityStorageAccountTypeZRS StorageCapabilityStorageAccountType = "ZRS" ) // PossibleStorageCapabilityStorageAccountTypeValues returns the possible values for the StorageCapabilityStorageAccountType const type. func PossibleStorageCapabilityStorageAccountTypeValues() []StorageCapabilityStorageAccountType { return []StorageCapabilityStorageAccountType{ StorageCapabilityStorageAccountTypeGRS, + StorageCapabilityStorageAccountTypeGZRS, StorageCapabilityStorageAccountTypeLRS, StorageCapabilityStorageAccountTypeZRS, } } -// StorageKeyType - Storage key type. +// StorageKeyType - Storage key type: StorageAccessKey or SharedAccessKey. type StorageKeyType string const ( @@ -2578,86 +2794,15 @@ func PossibleTransparentDataEncryptionNameValues() []TransparentDataEncryptionNa type TransparentDataEncryptionState string const ( - TransparentDataEncryptionStateEnabled TransparentDataEncryptionState = "Enabled" TransparentDataEncryptionStateDisabled TransparentDataEncryptionState = "Disabled" + TransparentDataEncryptionStateEnabled TransparentDataEncryptionState = "Enabled" ) // PossibleTransparentDataEncryptionStateValues returns the possible values for the TransparentDataEncryptionState const type. func PossibleTransparentDataEncryptionStateValues() []TransparentDataEncryptionState { return []TransparentDataEncryptionState{ - TransparentDataEncryptionStateEnabled, TransparentDataEncryptionStateDisabled, - } -} - -// UnitDefinitionType - The unit of the metric. -type UnitDefinitionType string - -const ( - UnitDefinitionTypeBytes UnitDefinitionType = "Bytes" - UnitDefinitionTypeBytesPerSecond UnitDefinitionType = "BytesPerSecond" - UnitDefinitionTypeCount UnitDefinitionType = "Count" - UnitDefinitionTypeCountPerSecond UnitDefinitionType = "CountPerSecond" - UnitDefinitionTypePercent UnitDefinitionType = "Percent" - UnitDefinitionTypeSeconds UnitDefinitionType = "Seconds" -) - -// PossibleUnitDefinitionTypeValues returns the possible values for the UnitDefinitionType const type. -func PossibleUnitDefinitionTypeValues() []UnitDefinitionType { - return []UnitDefinitionType{ - UnitDefinitionTypeBytes, - UnitDefinitionTypeBytesPerSecond, - UnitDefinitionTypeCount, - UnitDefinitionTypeCountPerSecond, - UnitDefinitionTypePercent, - UnitDefinitionTypeSeconds, - } -} - -// UnitType - The unit of the metric. -type UnitType string - -const ( - UnitTypeBytes UnitType = "bytes" - UnitTypeBytesPerSecond UnitType = "bytesPerSecond" - UnitTypeCount UnitType = "count" - UnitTypeCountPerSecond UnitType = "countPerSecond" - UnitTypePercent UnitType = "percent" - UnitTypeSeconds UnitType = "seconds" -) - -// PossibleUnitTypeValues returns the possible values for the UnitType const type. -func PossibleUnitTypeValues() []UnitType { - return []UnitType{ - UnitTypeBytes, - UnitTypeBytesPerSecond, - UnitTypeCount, - UnitTypeCountPerSecond, - UnitTypePercent, - UnitTypeSeconds, - } -} - -type UpsertManagedServerOperationStepStatus string - -const ( - UpsertManagedServerOperationStepStatusCanceled UpsertManagedServerOperationStepStatus = "Canceled" - UpsertManagedServerOperationStepStatusCompleted UpsertManagedServerOperationStepStatus = "Completed" - UpsertManagedServerOperationStepStatusFailed UpsertManagedServerOperationStepStatus = "Failed" - UpsertManagedServerOperationStepStatusInProgress UpsertManagedServerOperationStepStatus = "InProgress" - UpsertManagedServerOperationStepStatusNotStarted UpsertManagedServerOperationStepStatus = "NotStarted" - UpsertManagedServerOperationStepStatusSlowedDown UpsertManagedServerOperationStepStatus = "SlowedDown" -) - -// PossibleUpsertManagedServerOperationStepStatusValues returns the possible values for the UpsertManagedServerOperationStepStatus const type. -func PossibleUpsertManagedServerOperationStepStatusValues() []UpsertManagedServerOperationStepStatus { - return []UpsertManagedServerOperationStepStatus{ - UpsertManagedServerOperationStepStatusCanceled, - UpsertManagedServerOperationStepStatusCompleted, - UpsertManagedServerOperationStepStatusFailed, - UpsertManagedServerOperationStepStatusInProgress, - UpsertManagedServerOperationStepStatusNotStarted, - UpsertManagedServerOperationStepStatusSlowedDown, + TransparentDataEncryptionStateEnabled, } } @@ -2701,15 +2846,15 @@ func PossibleVulnerabilityAssessmentNameValues() []VulnerabilityAssessmentName { type VulnerabilityAssessmentPolicyBaselineName string const ( - VulnerabilityAssessmentPolicyBaselineNameMaster VulnerabilityAssessmentPolicyBaselineName = "master" VulnerabilityAssessmentPolicyBaselineNameDefault VulnerabilityAssessmentPolicyBaselineName = "default" + VulnerabilityAssessmentPolicyBaselineNameMaster VulnerabilityAssessmentPolicyBaselineName = "master" ) // PossibleVulnerabilityAssessmentPolicyBaselineNameValues returns the possible values for the VulnerabilityAssessmentPolicyBaselineName const type. func PossibleVulnerabilityAssessmentPolicyBaselineNameValues() []VulnerabilityAssessmentPolicyBaselineName { return []VulnerabilityAssessmentPolicyBaselineName{ - VulnerabilityAssessmentPolicyBaselineNameMaster, VulnerabilityAssessmentPolicyBaselineNameDefault, + VulnerabilityAssessmentPolicyBaselineNameMaster, } } diff --git a/sdk/resourcemanager/sql/armsql/databaseadvancedthreatprotectionsettings_client.go b/sdk/resourcemanager/sql/armsql/databaseadvancedthreatprotectionsettings_client.go index 9b2664e416aa..fc03b9f6a70a 100644 --- a/sdk/resourcemanager/sql/armsql/databaseadvancedthreatprotectionsettings_client.go +++ b/sdk/resourcemanager/sql/armsql/databaseadvancedthreatprotectionsettings_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armsql @@ -47,7 +46,7 @@ func NewDatabaseAdvancedThreatProtectionSettingsClient(subscriptionID string, cr // CreateOrUpdate - Creates or updates a database's Advanced Threat Protection state. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -57,18 +56,21 @@ func NewDatabaseAdvancedThreatProtectionSettingsClient(subscriptionID string, cr // - options - DatabaseAdvancedThreatProtectionSettingsClientCreateOrUpdateOptions contains the optional parameters for the // DatabaseAdvancedThreatProtectionSettingsClient.CreateOrUpdate method. func (client *DatabaseAdvancedThreatProtectionSettingsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, databaseName string, advancedThreatProtectionName AdvancedThreatProtectionName, parameters DatabaseAdvancedThreatProtection, options *DatabaseAdvancedThreatProtectionSettingsClientCreateOrUpdateOptions) (DatabaseAdvancedThreatProtectionSettingsClientCreateOrUpdateResponse, error) { + var err error req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, serverName, databaseName, advancedThreatProtectionName, parameters, options) if err != nil { return DatabaseAdvancedThreatProtectionSettingsClientCreateOrUpdateResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return DatabaseAdvancedThreatProtectionSettingsClientCreateOrUpdateResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { - return DatabaseAdvancedThreatProtectionSettingsClientCreateOrUpdateResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return DatabaseAdvancedThreatProtectionSettingsClientCreateOrUpdateResponse{}, err } - return client.createOrUpdateHandleResponse(resp) + resp, err := client.createOrUpdateHandleResponse(httpResp) + return resp, err } // createOrUpdateCreateRequest creates the CreateOrUpdate request. @@ -99,10 +101,13 @@ func (client *DatabaseAdvancedThreatProtectionSettingsClient) createOrUpdateCrea return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // createOrUpdateHandleResponse handles the CreateOrUpdate response. @@ -117,7 +122,7 @@ func (client *DatabaseAdvancedThreatProtectionSettingsClient) createOrUpdateHand // Get - Gets a database's Advanced Threat Protection state. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -126,18 +131,21 @@ func (client *DatabaseAdvancedThreatProtectionSettingsClient) createOrUpdateHand // - options - DatabaseAdvancedThreatProtectionSettingsClientGetOptions contains the optional parameters for the DatabaseAdvancedThreatProtectionSettingsClient.Get // method. func (client *DatabaseAdvancedThreatProtectionSettingsClient) Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string, advancedThreatProtectionName AdvancedThreatProtectionName, options *DatabaseAdvancedThreatProtectionSettingsClientGetOptions) (DatabaseAdvancedThreatProtectionSettingsClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, serverName, databaseName, advancedThreatProtectionName, options) if err != nil { return DatabaseAdvancedThreatProtectionSettingsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return DatabaseAdvancedThreatProtectionSettingsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return DatabaseAdvancedThreatProtectionSettingsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DatabaseAdvancedThreatProtectionSettingsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -168,7 +176,7 @@ func (client *DatabaseAdvancedThreatProtectionSettingsClient) getCreateRequest(c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -185,7 +193,7 @@ func (client *DatabaseAdvancedThreatProtectionSettingsClient) getHandleResponse( // NewListByDatabasePager - Gets a list of database's Advanced Threat Protection states. // -// Generated from API version 2021-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -244,7 +252,7 @@ func (client *DatabaseAdvancedThreatProtectionSettingsClient) listByDatabaseCrea return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/sql/armsql/databaseadvancedthreatprotectionsettings_client_example_test.go b/sdk/resourcemanager/sql/armsql/databaseadvancedthreatprotectionsettings_client_example_test.go deleted file mode 100644 index 0cde12449deb..000000000000 --- a/sdk/resourcemanager/sql/armsql/databaseadvancedthreatprotectionsettings_client_example_test.go +++ /dev/null @@ -1,183 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsql_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sql/armsql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/DatabaseAdvancedThreatProtectionSettingsListByDatabase.json -func ExampleDatabaseAdvancedThreatProtectionSettingsClient_NewListByDatabasePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDatabaseAdvancedThreatProtectionSettingsClient().NewListByDatabasePager("threatprotection-6852", "threatprotection-2080", "testdb", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DatabaseAdvancedThreatProtectionListResult = armsql.DatabaseAdvancedThreatProtectionListResult{ - // Value: []*armsql.DatabaseAdvancedThreatProtection{ - // { - // Name: to.Ptr("Default"), - // Type: to.Ptr("Microsoft.Sql/servers/databases/advancedThreatProtectionSettings"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/threatprotection-6852/providers/Microsoft.Sql/servers/threatprotection-2080/databases/testdb/advancedThreatProtectionSettings/Default"), - // Properties: &armsql.AdvancedThreatProtectionProperties{ - // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-04-03T04:41:33.937Z"); return t}()), - // State: to.Ptr(armsql.AdvancedThreatProtectionStateEnabled), - // }, - // SystemData: &armsql.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-04-03T04:41:33.937Z"); return t}()), - // CreatedBy: to.Ptr("string"), - // CreatedByType: to.Ptr(armsql.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-04-03T04:41:33.937Z"); return t}()), - // LastModifiedBy: to.Ptr("string"), - // LastModifiedByType: to.Ptr(armsql.CreatedByTypeUser), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/DatabaseAdvancedThreatProtectionSettingsGet.json -func ExampleDatabaseAdvancedThreatProtectionSettingsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDatabaseAdvancedThreatProtectionSettingsClient().Get(ctx, "threatprotection-6852", "threatprotection-2080", "testdb", armsql.AdvancedThreatProtectionNameDefault, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DatabaseAdvancedThreatProtection = armsql.DatabaseAdvancedThreatProtection{ - // Name: to.Ptr("Default"), - // Type: to.Ptr("Microsoft.Sql/servers/databases/advancedThreatProtectionSettings"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/threatprotection-4799/providers/Microsoft.Sql/servers/threatprotection-6440/advancedThreatProtectionSettings/Default"), - // Properties: &armsql.AdvancedThreatProtectionProperties{ - // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-04-03T04:41:33.937Z"); return t}()), - // State: to.Ptr(armsql.AdvancedThreatProtectionStateEnabled), - // }, - // SystemData: &armsql.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-04-03T04:41:33.937Z"); return t}()), - // CreatedBy: to.Ptr("string"), - // CreatedByType: to.Ptr(armsql.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-04-03T04:41:33.937Z"); return t}()), - // LastModifiedBy: to.Ptr("string"), - // LastModifiedByType: to.Ptr(armsql.CreatedByTypeUser), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/DatabaseAdvancedThreatProtectionSettingsCreateMax.json -func ExampleDatabaseAdvancedThreatProtectionSettingsClient_CreateOrUpdate_updateADatabasesAdvancedThreatProtectionSettingsWithAllParameters() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDatabaseAdvancedThreatProtectionSettingsClient().CreateOrUpdate(ctx, "threatprotection-4799", "threatprotection-6440", "testdb", armsql.AdvancedThreatProtectionNameDefault, armsql.DatabaseAdvancedThreatProtection{ - Properties: &armsql.AdvancedThreatProtectionProperties{ - State: to.Ptr(armsql.AdvancedThreatProtectionStateEnabled), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DatabaseAdvancedThreatProtection = armsql.DatabaseAdvancedThreatProtection{ - // Name: to.Ptr("Default"), - // Type: to.Ptr("Microsoft.Sql/servers/databases/advancedThreatProtectionSettings"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/threatprotection-4799/providers/Microsoft.Sql/servers/threatprotection-6440/advancedThreatProtectionSettings/Default"), - // Properties: &armsql.AdvancedThreatProtectionProperties{ - // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-04-03T04:41:33.937Z"); return t}()), - // State: to.Ptr(armsql.AdvancedThreatProtectionStateEnabled), - // }, - // SystemData: &armsql.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-04-03T04:41:33.937Z"); return t}()), - // CreatedBy: to.Ptr("string"), - // CreatedByType: to.Ptr(armsql.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-04-03T04:41:33.937Z"); return t}()), - // LastModifiedBy: to.Ptr("string"), - // LastModifiedByType: to.Ptr(armsql.CreatedByTypeUser), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/DatabaseAdvancedThreatProtectionSettingsCreateMin.json -func ExampleDatabaseAdvancedThreatProtectionSettingsClient_CreateOrUpdate_updateADatabasesAdvancedThreatProtectionSettingsWithMinimalParameters() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDatabaseAdvancedThreatProtectionSettingsClient().CreateOrUpdate(ctx, "threatprotection-4799", "threatprotection-6440", "testdb", armsql.AdvancedThreatProtectionNameDefault, armsql.DatabaseAdvancedThreatProtection{ - Properties: &armsql.AdvancedThreatProtectionProperties{ - State: to.Ptr(armsql.AdvancedThreatProtectionStateDisabled), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DatabaseAdvancedThreatProtection = armsql.DatabaseAdvancedThreatProtection{ - // Name: to.Ptr("Default"), - // Type: to.Ptr("Microsoft.Sql/servers/databases/advancedThreatProtectionSettings"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/threatprotection-4799/providers/Microsoft.Sql/servers/threatprotection-6440/advancedThreatProtectionSettings/Default"), - // Properties: &armsql.AdvancedThreatProtectionProperties{ - // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-04-03T04:41:33.937Z"); return t}()), - // State: to.Ptr(armsql.AdvancedThreatProtectionStateDisabled), - // }, - // SystemData: &armsql.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-04-03T04:41:33.937Z"); return t}()), - // CreatedBy: to.Ptr("string"), - // CreatedByType: to.Ptr(armsql.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-04-03T04:41:33.937Z"); return t}()), - // LastModifiedBy: to.Ptr("string"), - // LastModifiedByType: to.Ptr(armsql.CreatedByTypeUser), - // }, - // } -} diff --git a/sdk/resourcemanager/sql/armsql/databaseadvisors_client.go b/sdk/resourcemanager/sql/armsql/databaseadvisors_client.go index e72518d4c382..2334dbfdc36f 100644 --- a/sdk/resourcemanager/sql/armsql/databaseadvisors_client.go +++ b/sdk/resourcemanager/sql/armsql/databaseadvisors_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armsql @@ -47,7 +46,7 @@ func NewDatabaseAdvisorsClient(subscriptionID string, credential azcore.TokenCre // Get - Gets a database advisor. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -55,18 +54,21 @@ func NewDatabaseAdvisorsClient(subscriptionID string, credential azcore.TokenCre // - advisorName - The name of the Database Advisor. // - options - DatabaseAdvisorsClientGetOptions contains the optional parameters for the DatabaseAdvisorsClient.Get method. func (client *DatabaseAdvisorsClient) Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string, advisorName string, options *DatabaseAdvisorsClientGetOptions) (DatabaseAdvisorsClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, serverName, databaseName, advisorName, options) if err != nil { return DatabaseAdvisorsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return DatabaseAdvisorsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return DatabaseAdvisorsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DatabaseAdvisorsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -97,7 +99,7 @@ func (client *DatabaseAdvisorsClient) getCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -115,7 +117,7 @@ func (client *DatabaseAdvisorsClient) getHandleResponse(resp *http.Response) (Da // ListByDatabase - Gets a list of database advisors. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -123,18 +125,21 @@ func (client *DatabaseAdvisorsClient) getHandleResponse(resp *http.Response) (Da // - options - DatabaseAdvisorsClientListByDatabaseOptions contains the optional parameters for the DatabaseAdvisorsClient.ListByDatabase // method. func (client *DatabaseAdvisorsClient) ListByDatabase(ctx context.Context, resourceGroupName string, serverName string, databaseName string, options *DatabaseAdvisorsClientListByDatabaseOptions) (DatabaseAdvisorsClientListByDatabaseResponse, error) { + var err error req, err := client.listByDatabaseCreateRequest(ctx, resourceGroupName, serverName, databaseName, options) if err != nil { return DatabaseAdvisorsClientListByDatabaseResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return DatabaseAdvisorsClientListByDatabaseResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return DatabaseAdvisorsClientListByDatabaseResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DatabaseAdvisorsClientListByDatabaseResponse{}, err } - return client.listByDatabaseHandleResponse(resp) + resp, err := client.listByDatabaseHandleResponse(httpResp) + return resp, err } // listByDatabaseCreateRequest creates the ListByDatabase request. @@ -164,7 +169,7 @@ func (client *DatabaseAdvisorsClient) listByDatabaseCreateRequest(ctx context.Co if options != nil && options.Expand != nil { reqQP.Set("$expand", *options.Expand) } - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -182,7 +187,7 @@ func (client *DatabaseAdvisorsClient) listByDatabaseHandleResponse(resp *http.Re // Update - Updates a database advisor. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -191,18 +196,21 @@ func (client *DatabaseAdvisorsClient) listByDatabaseHandleResponse(resp *http.Re // - parameters - The requested advisor resource state. // - options - DatabaseAdvisorsClientUpdateOptions contains the optional parameters for the DatabaseAdvisorsClient.Update method. func (client *DatabaseAdvisorsClient) Update(ctx context.Context, resourceGroupName string, serverName string, databaseName string, advisorName string, parameters Advisor, options *DatabaseAdvisorsClientUpdateOptions) (DatabaseAdvisorsClientUpdateResponse, error) { + var err error req, err := client.updateCreateRequest(ctx, resourceGroupName, serverName, databaseName, advisorName, parameters, options) if err != nil { return DatabaseAdvisorsClientUpdateResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return DatabaseAdvisorsClientUpdateResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return DatabaseAdvisorsClientUpdateResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DatabaseAdvisorsClientUpdateResponse{}, err } - return client.updateHandleResponse(resp) + resp, err := client.updateHandleResponse(httpResp) + return resp, err } // updateCreateRequest creates the Update request. @@ -233,10 +241,13 @@ func (client *DatabaseAdvisorsClient) updateCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // updateHandleResponse handles the Update response. diff --git a/sdk/resourcemanager/sql/armsql/databaseadvisors_client_example_test.go b/sdk/resourcemanager/sql/armsql/databaseadvisors_client_example_test.go deleted file mode 100644 index 91211a2a89cd..000000000000 --- a/sdk/resourcemanager/sql/armsql/databaseadvisors_client_example_test.go +++ /dev/null @@ -1,815 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsql_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sql/armsql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseAdvisorList.json -func ExampleDatabaseAdvisorsClient_ListByDatabase_listOfDatabaseAdvisors() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDatabaseAdvisorsClient().ListByDatabase(ctx, "workloadinsight-demos", "misosisvr", "IndexAdvisor_test_3", &armsql.DatabaseAdvisorsClientListByDatabaseOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.AdvisorArray = []*armsql.Advisor{ - // { - // Name: to.Ptr("CreateIndex"), - // Type: to.Ptr("Microsoft.Sql/servers/databases/advisors"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/workloadinsight-demos/providers/Microsoft.Sql/servers/misosisvr/databases/IndexAdvisor_test_3/advisors/CreateIndex"), - // Kind: to.Ptr(""), - // Location: to.Ptr("East Asia"), - // Properties: &armsql.AdvisorProperties{ - // AdvisorStatus: to.Ptr(armsql.AdvisorStatusGA), - // AutoExecuteStatus: to.Ptr(armsql.AutoExecuteStatusDisabled), - // AutoExecuteStatusInheritedFrom: to.Ptr(armsql.AutoExecuteStatusInheritedFromDatabase), - // LastChecked: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-06-20T00:24:39Z"); return t}()), - // RecommendationsStatus: to.Ptr("Ok"), - // }, - // }, - // { - // Name: to.Ptr("DropIndex"), - // Type: to.Ptr("Microsoft.Sql/servers/databases/advisors"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/workloadinsight-demos/providers/Microsoft.Sql/servers/misosisvr/databases/IndexAdvisor_test_3/advisors/DropIndex"), - // Kind: to.Ptr(""), - // Location: to.Ptr("East Asia"), - // Properties: &armsql.AdvisorProperties{ - // AdvisorStatus: to.Ptr(armsql.AdvisorStatusGA), - // AutoExecuteStatus: to.Ptr(armsql.AutoExecuteStatusDisabled), - // AutoExecuteStatusInheritedFrom: to.Ptr(armsql.AutoExecuteStatusInheritedFromDatabase), - // LastChecked: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-06-19T20:42:43Z"); return t}()), - // RecommendationsStatus: to.Ptr("DbSeemsTuned"), - // }, - // }, - // { - // Name: to.Ptr("DbParameterization"), - // Type: to.Ptr("Microsoft.Sql/servers/databases/advisors"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/workloadinsight-demos/providers/Microsoft.Sql/servers/misosisvr/databases/IndexAdvisor_test_3/advisors/DbParameterization"), - // Kind: to.Ptr(""), - // Location: to.Ptr("East Asia"), - // Properties: &armsql.AdvisorProperties{ - // AdvisorStatus: to.Ptr(armsql.AdvisorStatusGA), - // AutoExecuteStatus: to.Ptr(armsql.AutoExecuteStatusEnabled), - // AutoExecuteStatusInheritedFrom: to.Ptr(armsql.AutoExecuteStatusInheritedFromDatabase), - // LastChecked: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-06-19T19:13:03Z"); return t}()), - // RecommendationsStatus: to.Ptr("DbParameterizationIssue"), - // }, - // }, - // { - // Name: to.Ptr("SchemaIssue"), - // Type: to.Ptr("Microsoft.Sql/servers/databases/advisors"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/workloadinsight-demos/providers/Microsoft.Sql/servers/misosisvr/databases/IndexAdvisor_test_3/advisors/SchemaIssue"), - // Kind: to.Ptr(""), - // Location: to.Ptr("East Asia"), - // Properties: &armsql.AdvisorProperties{ - // AdvisorStatus: to.Ptr(armsql.AdvisorStatusPublicPreview), - // AutoExecuteStatus: to.Ptr(armsql.AutoExecuteStatusDisabled), - // AutoExecuteStatusInheritedFrom: to.Ptr(armsql.AutoExecuteStatusInheritedFromDefault), - // LastChecked: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-06-20T14:00:32Z"); return t}()), - // RecommendationsStatus: to.Ptr("SchemaIsNotConsistent"), - // }, - // }, - // { - // Name: to.Ptr("ForceLastGoodPlan"), - // Type: to.Ptr("Microsoft.Sql/servers/databases/advisors"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/workloadinsight-demos/providers/Microsoft.Sql/servers/misosisvr/databases/IndexAdvisor_test_3/advisors/ForceLastGoodPlan"), - // Kind: to.Ptr(""), - // Location: to.Ptr("East Asia"), - // Properties: &armsql.AdvisorProperties{ - // AdvisorStatus: to.Ptr(armsql.AdvisorStatusPrivatePreview), - // AutoExecuteStatus: to.Ptr(armsql.AutoExecuteStatusDisabled), - // AutoExecuteStatusInheritedFrom: to.Ptr(armsql.AutoExecuteStatusInheritedFromDefault), - // }, - // }} -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseRecommendedActionListExpand.json -func ExampleDatabaseAdvisorsClient_ListByDatabase_listOfDatabaseRecommendedActionsForAllAdvisors() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDatabaseAdvisorsClient().ListByDatabase(ctx, "workloadinsight-demos", "misosisvr", "IndexAdvisor_test_3", &armsql.DatabaseAdvisorsClientListByDatabaseOptions{Expand: to.Ptr("recommendedActions")}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.AdvisorArray = []*armsql.Advisor{ - // { - // Name: to.Ptr("CreateIndex"), - // Type: to.Ptr("Microsoft.Sql/servers/databases/advisors"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/workloadinsight-demos/providers/Microsoft.Sql/servers/misosisvr/databases/IndexAdvisor_test_3/advisors/CreateIndex"), - // Kind: to.Ptr(""), - // Location: to.Ptr("East Asia"), - // Properties: &armsql.AdvisorProperties{ - // AdvisorStatus: to.Ptr(armsql.AdvisorStatusGA), - // AutoExecuteStatus: to.Ptr(armsql.AutoExecuteStatusDisabled), - // AutoExecuteStatusInheritedFrom: to.Ptr(armsql.AutoExecuteStatusInheritedFromDatabase), - // LastChecked: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-06-20T16:39:16Z"); return t}()), - // RecommendationsStatus: to.Ptr("Ok"), - // RecommendedActions: []*armsql.RecommendedAction{ - // { - // Name: to.Ptr("IR_[CRM]_[DataPoints]_4821CD2F9510D98184BB"), - // Type: to.Ptr("Microsoft.Sql/servers/databases/advisors/recommendedActions"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/workloadinsight-demos/providers/Microsoft.Sql/servers/misosisvr/databases/IndexAdvisor_test_3/advisors/CreateIndex/recommendedActions/IR_[CRM]_[DataPoints]_4821CD2F9510D98184BB"), - // Kind: to.Ptr(""), - // Location: to.Ptr("East Asia"), - // Properties: &armsql.RecommendedActionProperties{ - // ErrorDetails: &armsql.RecommendedActionErrorInfo{ - // }, - // EstimatedImpact: []*armsql.RecommendedActionImpactRecord{ - // { - // AbsoluteValue: to.Ptr[float64](1440), - // DimensionName: to.Ptr("ActionDuration"), - // Unit: to.Ptr("Seconds"), - // }, - // { - // AbsoluteValue: to.Ptr[float64](209.3125), - // DimensionName: to.Ptr("SpaceChange"), - // Unit: to.Ptr("Megabytes"), - // }}, - // ImplementationDetails: &armsql.RecommendedActionImplementationInfo{ - // Method: to.Ptr(armsql.ImplementationMethodTSQL), - // Script: to.Ptr("CREATE NONCLUSTERED INDEX [nci_wi_DataPoints_B892614093BAC56295EF6018BD4CB51B] ON [CRM].[DataPoints] ([Name],[Money],[Power]) INCLUDE ([Hour], [System], [LastChanged]) WITH (ONLINE = ON)"), - // }, - // IsArchivedAction: to.Ptr(false), - // IsExecutableAction: to.Ptr(true), - // IsRevertableAction: to.Ptr(true), - // LastRefresh: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-03-01T14:38:04Z"); return t}()), - // ObservedImpact: []*armsql.RecommendedActionImpactRecord{ - // }, - // RecommendationReason: to.Ptr(""), - // Score: to.Ptr[int32](1), - // State: &armsql.RecommendedActionStateInfo{ - // CurrentValue: to.Ptr(armsql.RecommendedActionCurrentStateActive), - // LastModified: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-06-20T15:15:40Z"); return t}()), - // }, - // TimeSeries: []*armsql.RecommendedActionMetricInfo{ - // }, - // ValidSince: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-03-01T14:38:04Z"); return t}()), - // Details: map[string]any{ - // "schema": "[CRM]", - // "includedColumns": "[Hour], [System], [LastChanged]", - // "indexColumns": "[Name],[Money],[Power]", - // "indexName": "nci_wi_DataPoints_B892614093BAC56295EF6018BD4CB51B", - // "indexType": "NONCLUSTERED", - // "table": "[DataPoints]", - // }, - // }, - // }, - // { - // Name: to.Ptr("IR_[dbo]_[DataPoints]_F5D2F347AA22DB46E4CC"), - // Type: to.Ptr("Microsoft.Sql/servers/databases/advisors/recommendedActions"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/workloadinsight-demos/providers/Microsoft.Sql/servers/misosisvr/databases/IndexAdvisor_test_3/advisors/CreateIndex/recommendedActions/IR_[dbo]_[DataPoints]_F5D2F347AA22DB46E4CC"), - // Kind: to.Ptr(""), - // Location: to.Ptr("East Asia"), - // Properties: &armsql.RecommendedActionProperties{ - // ErrorDetails: &armsql.RecommendedActionErrorInfo{ - // }, - // EstimatedImpact: []*armsql.RecommendedActionImpactRecord{ - // { - // AbsoluteValue: to.Ptr[float64](5040), - // DimensionName: to.Ptr("ActionDuration"), - // Unit: to.Ptr("Seconds"), - // }, - // { - // AbsoluteValue: to.Ptr[float64](120), - // DimensionName: to.Ptr("SpaceChange"), - // Unit: to.Ptr("Megabytes"), - // }}, - // ExecuteActionDuration: to.Ptr("PT1M"), - // ExecuteActionInitiatedBy: to.Ptr(armsql.RecommendedActionInitiatedByUser), - // ExecuteActionInitiatedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-03-01T14:38:05Z"); return t}()), - // ExecuteActionStartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-03-01T14:38:05Z"); return t}()), - // ImplementationDetails: &armsql.RecommendedActionImplementationInfo{ - // Method: to.Ptr(armsql.ImplementationMethodTSQL), - // Script: to.Ptr("DROP INDEX [nci_wi_DataPoints_609E4B7D6A3813990ED44B28B340C8FC] ON [dbo].[DataPoints]"), - // }, - // IsArchivedAction: to.Ptr(false), - // IsExecutableAction: to.Ptr(true), - // IsRevertableAction: to.Ptr(true), - // LastRefresh: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-03-01T14:38:05Z"); return t}()), - // ObservedImpact: []*armsql.RecommendedActionImpactRecord{ - // { - // ChangeValueAbsolute: to.Ptr[float64](-12.7), - // ChangeValueRelative: to.Ptr[float64](-0.9), - // DimensionName: to.Ptr("AffectedQueriesCpuUtilization"), - // Unit: to.Ptr("CpuCores"), - // }, - // { - // ChangeValueAbsolute: to.Ptr[float64](-12.7), - // ChangeValueRelative: to.Ptr[float64](-0.3175), - // DimensionName: to.Ptr("CpuUtilization"), - // Unit: to.Ptr("CpuCores"), - // }, - // { - // AbsoluteValue: to.Ptr[float64](12), - // DimensionName: to.Ptr("QueriesWithImprovedPerformance"), - // Unit: to.Ptr("Count"), - // }, - // { - // AbsoluteValue: to.Ptr[float64](1), - // DimensionName: to.Ptr("QueriesWithRegressedPerformance"), - // Unit: to.Ptr("Count"), - // }, - // { - // AbsoluteValue: to.Ptr[float64](130.742187), - // DimensionName: to.Ptr("SpaceChange"), - // Unit: to.Ptr("Megabytes"), - // }, - // { - // AbsoluteValue: to.Ptr[float64](0), - // DimensionName: to.Ptr("VerificationProgress"), - // Unit: to.Ptr("Percent"), - // }}, - // RecommendationReason: to.Ptr(""), - // Score: to.Ptr[int32](3), - // State: &armsql.RecommendedActionStateInfo{ - // ActionInitiatedBy: to.Ptr(armsql.RecommendedActionInitiatedByUser), - // CurrentValue: to.Ptr(armsql.RecommendedActionCurrentStateSuccess), - // LastModified: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-03-01T14:38:05Z"); return t}()), - // }, - // TimeSeries: []*armsql.RecommendedActionMetricInfo{ - // }, - // ValidSince: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-03-01T14:38:05Z"); return t}()), - // Details: map[string]any{ - // "schema": "[dbo]", - // "includedColumns": "[Power],[Pineapple]", - // "indexActionDuration": "00:01:00", - // "indexActionStartTime": "2017-03-01T14:38:05.337", - // "indexColumns": "[Name],[Money]", - // "indexName": "nci_wi_DataPoints_609E4B7D6A3813990ED44B28B340C8FC", - // "indexType": "NONCLUSTERED", - // "table": "[DataPoints]", - // }, - // }, - // }, - // { - // Name: to.Ptr("IR_[dbo]_[Employees]_560E15A98D14CA09BDFB"), - // Type: to.Ptr("Microsoft.Sql/servers/databases/advisors/recommendedActions"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/workloadinsight-demos/providers/Microsoft.Sql/servers/misosisvr/databases/IndexAdvisor_test_3/advisors/CreateIndex/recommendedActions/IR_[dbo]_[Employees]_560E15A98D14CA09BDFB"), - // Kind: to.Ptr(""), - // Location: to.Ptr("East Asia"), - // Properties: &armsql.RecommendedActionProperties{ - // ErrorDetails: &armsql.RecommendedActionErrorInfo{ - // }, - // EstimatedImpact: []*armsql.RecommendedActionImpactRecord{ - // { - // AbsoluteValue: to.Ptr[float64](17), - // DimensionName: to.Ptr("ActionDuration"), - // Unit: to.Ptr("Seconds"), - // }, - // { - // AbsoluteValue: to.Ptr[float64](128), - // DimensionName: to.Ptr("SpaceChange"), - // Unit: to.Ptr("Megabytes"), - // }}, - // ImplementationDetails: &armsql.RecommendedActionImplementationInfo{ - // Method: to.Ptr(armsql.ImplementationMethodTSQL), - // Script: to.Ptr("CREATE NONCLUSTERED INDEX [nci_wi_Employees_8C18C2AF4267DC77793040782641CCDE] ON [dbo].[Employees] ([City], [State]) INCLUDE ([Postal]) WITH (ONLINE = ON)"), - // }, - // IsArchivedAction: to.Ptr(false), - // IsExecutableAction: to.Ptr(true), - // IsRevertableAction: to.Ptr(true), - // LastRefresh: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-03-01T14:38:05Z"); return t}()), - // ObservedImpact: []*armsql.RecommendedActionImpactRecord{ - // }, - // RecommendationReason: to.Ptr(""), - // Score: to.Ptr[int32](3), - // State: &armsql.RecommendedActionStateInfo{ - // CurrentValue: to.Ptr(armsql.RecommendedActionCurrentStateActive), - // LastModified: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-03-01T14:38:05Z"); return t}()), - // }, - // TimeSeries: []*armsql.RecommendedActionMetricInfo{ - // }, - // ValidSince: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-03-01T14:38:05Z"); return t}()), - // Details: map[string]any{ - // "schema": "[dbo]", - // "includedColumns": "[Postal]", - // "indexColumns": "[City], [State]", - // "indexName": "nci_wi_Employees_8C18C2AF4267DC77793040782641CCDE", - // "indexType": "NONCLUSTERED", - // "table": "[Employees]", - // }, - // }, - // }}, - // }, - // }, - // { - // Name: to.Ptr("DropIndex"), - // Type: to.Ptr("Microsoft.Sql/servers/databases/advisors"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/workloadinsight-demos/providers/Microsoft.Sql/servers/misosisvr/databases/IndexAdvisor_test_3/advisors/DropIndex"), - // Kind: to.Ptr(""), - // Location: to.Ptr("East Asia"), - // Properties: &armsql.AdvisorProperties{ - // AdvisorStatus: to.Ptr(armsql.AdvisorStatusGA), - // AutoExecuteStatus: to.Ptr(armsql.AutoExecuteStatusDisabled), - // AutoExecuteStatusInheritedFrom: to.Ptr(armsql.AutoExecuteStatusInheritedFromDatabase), - // LastChecked: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-06-19T20:42:43Z"); return t}()), - // RecommendationsStatus: to.Ptr("DbSeemsTuned"), - // RecommendedActions: []*armsql.RecommendedAction{ - // { - // Name: to.Ptr("IR_[CRM]_[DataPoints1]_13ADA5F354E9E14A983B"), - // Type: to.Ptr("Microsoft.Sql/servers/databases/advisors/recommendedActions"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/workloadinsight-demos/providers/Microsoft.Sql/servers/misosisvr/databases/IndexAdvisor_test_3/advisors/DropIndex/recommendedActions/IR_[CRM]_[DataPoints1]_13ADA5F354E9E14A983B"), - // Kind: to.Ptr(""), - // Location: to.Ptr("East Asia"), - // Properties: &armsql.RecommendedActionProperties{ - // ErrorDetails: &armsql.RecommendedActionErrorInfo{ - // }, - // EstimatedImpact: []*armsql.RecommendedActionImpactRecord{ - // { - // AbsoluteValue: to.Ptr[float64](645), - // DimensionName: to.Ptr("ActionDuration"), - // Unit: to.Ptr("Seconds"), - // }, - // { - // AbsoluteValue: to.Ptr[float64](342), - // DimensionName: to.Ptr("SpaceChange"), - // Unit: to.Ptr("Megabytes"), - // }}, - // ExecuteActionInitiatedBy: to.Ptr(armsql.RecommendedActionInitiatedBySystem), - // ExecuteActionInitiatedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-03-23T14:14:35Z"); return t}()), - // ImplementationDetails: &armsql.RecommendedActionImplementationInfo{ - // Method: to.Ptr(armsql.ImplementationMethodTSQL), - // Script: to.Ptr("DROP INDEX [IX_FF] ON [CRM].[DataPoints1]"), - // }, - // IsArchivedAction: to.Ptr(false), - // IsExecutableAction: to.Ptr(true), - // IsRevertableAction: to.Ptr(true), - // LastRefresh: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-03-01T14:38:05Z"); return t}()), - // ObservedImpact: []*armsql.RecommendedActionImpactRecord{ - // }, - // RecommendationReason: to.Ptr("Unused"), - // Score: to.Ptr[int32](1), - // State: &armsql.RecommendedActionStateInfo{ - // ActionInitiatedBy: to.Ptr(armsql.RecommendedActionInitiatedBySystem), - // CurrentValue: to.Ptr(armsql.RecommendedActionCurrentStatePending), - // LastModified: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-03-23T14:14:35Z"); return t}()), - // }, - // TimeSeries: []*armsql.RecommendedActionMetricInfo{ - // }, - // ValidSince: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-03-01T14:38:05Z"); return t}()), - // Details: map[string]any{ - // "schema": "[CRM]", - // "includedColumns": "[Apple]", - // "indexColumns": "[Protocol],[SessionId]", - // "indexName": "IX_FF", - // "indexType": "NONCLUSTERED", - // "originalIndexName": "IX_COM_SKU_SKUDepartmentID", - // "table": "[DataPoints1]", - // }, - // }, - // }, - // { - // Name: to.Ptr("IR_[CRM]_[DataPoints1]_29AEA82685D24704DE1A"), - // Type: to.Ptr("Microsoft.Sql/servers/databases/advisors/recommendedActions"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/workloadinsight-demos/providers/Microsoft.Sql/servers/misosisvr/databases/IndexAdvisor_test_3/advisors/DropIndex/recommendedActions/IR_[CRM]_[DataPoints1]_29AEA82685D24704DE1A"), - // Kind: to.Ptr(""), - // Location: to.Ptr("East Asia"), - // Properties: &armsql.RecommendedActionProperties{ - // ErrorDetails: &armsql.RecommendedActionErrorInfo{ - // }, - // EstimatedImpact: []*armsql.RecommendedActionImpactRecord{ - // { - // AbsoluteValue: to.Ptr[float64](803), - // DimensionName: to.Ptr("ActionDuration"), - // Unit: to.Ptr("Seconds"), - // }, - // { - // AbsoluteValue: to.Ptr[float64](144.6875), - // DimensionName: to.Ptr("SpaceChange"), - // Unit: to.Ptr("Megabytes"), - // }}, - // ExecuteActionInitiatedBy: to.Ptr(armsql.RecommendedActionInitiatedBySystem), - // ExecuteActionInitiatedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-03-01T14:38:05Z"); return t}()), - // ImplementationDetails: &armsql.RecommendedActionImplementationInfo{ - // Method: to.Ptr(armsql.ImplementationMethodTSQL), - // Script: to.Ptr("DROP INDEX [MyIndex123] ON [CRM].[DataPoints1]"), - // }, - // IsArchivedAction: to.Ptr(false), - // IsExecutableAction: to.Ptr(true), - // IsRevertableAction: to.Ptr(true), - // LastRefresh: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-03-01T14:38:05Z"); return t}()), - // ObservedImpact: []*armsql.RecommendedActionImpactRecord{ - // }, - // RecommendationReason: to.Ptr("Duplicate"), - // Score: to.Ptr[int32](1), - // State: &armsql.RecommendedActionStateInfo{ - // ActionInitiatedBy: to.Ptr(armsql.RecommendedActionInitiatedBySystem), - // CurrentValue: to.Ptr(armsql.RecommendedActionCurrentStatePending), - // LastModified: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-03-01T14:38:05Z"); return t}()), - // }, - // TimeSeries: []*armsql.RecommendedActionMetricInfo{ - // }, - // ValidSince: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-03-01T14:38:05Z"); return t}()), - // Details: map[string]any{ - // "schema": "[CRM]", - // "includedColumns": "[Apple]", - // "indexColumns": "[Cookies],[SessionId]", - // "indexName": "MyIndex123", - // "indexType": "NONCLUSTERED", - // "originalIndexName": "IX_COM_SKU_SKUDepartmentID", - // "table": "[DataPoints1]", - // }, - // }, - // }, - // { - // Name: to.Ptr("IR_[CRM]_[DataPoints2]_E4B21F229379807E531A"), - // Type: to.Ptr("Microsoft.Sql/servers/databases/advisors/recommendedActions"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/workloadinsight-demos/providers/Microsoft.Sql/servers/misosisvr/databases/IndexAdvisor_test_3/advisors/DropIndex/recommendedActions/IR_[CRM]_[DataPoints2]_E4B21F229379807E531A"), - // Kind: to.Ptr(""), - // Location: to.Ptr("East Asia"), - // Properties: &armsql.RecommendedActionProperties{ - // ErrorDetails: &armsql.RecommendedActionErrorInfo{ - // }, - // EstimatedImpact: []*armsql.RecommendedActionImpactRecord{ - // { - // AbsoluteValue: to.Ptr[float64](705), - // DimensionName: to.Ptr("ActionDuration"), - // Unit: to.Ptr("Seconds"), - // }, - // { - // AbsoluteValue: to.Ptr[float64](342), - // DimensionName: to.Ptr("SpaceChange"), - // Unit: to.Ptr("Megabytes"), - // }}, - // ExecuteActionDuration: to.Ptr("PT1M"), - // ExecuteActionInitiatedBy: to.Ptr(armsql.RecommendedActionInitiatedByUser), - // ExecuteActionInitiatedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-03-01T14:38:05Z"); return t}()), - // ExecuteActionStartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-03-01T14:38:05Z"); return t}()), - // ImplementationDetails: &armsql.RecommendedActionImplementationInfo{ - // Method: to.Ptr(armsql.ImplementationMethodTSQL), - // Script: to.Ptr("CREATE NONCLUSTERED INDEX [MyIndex321] ON [CRM].[DataPoints2] ([Cookies],[SessionId],[Protocol]) INCLUDE ([Apple]) WITH (ONLINE = ON)"), - // }, - // IsArchivedAction: to.Ptr(false), - // IsExecutableAction: to.Ptr(true), - // IsRevertableAction: to.Ptr(true), - // LastRefresh: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-03-01T14:38:05Z"); return t}()), - // ObservedImpact: []*armsql.RecommendedActionImpactRecord{ - // { - // ChangeValueAbsolute: to.Ptr[float64](0), - // ChangeValueRelative: to.Ptr[float64](0), - // DimensionName: to.Ptr("AffectedQueriesCpuUtilization"), - // Unit: to.Ptr("CpuCores"), - // }, - // { - // ChangeValueAbsolute: to.Ptr[float64](0), - // ChangeValueRelative: to.Ptr[float64](0), - // DimensionName: to.Ptr("CpuUtilization"), - // Unit: to.Ptr("CpuCores"), - // }, - // { - // AbsoluteValue: to.Ptr[float64](0), - // DimensionName: to.Ptr("QueriesWithImprovedPerformance"), - // Unit: to.Ptr("Count"), - // }, - // { - // AbsoluteValue: to.Ptr[float64](0), - // DimensionName: to.Ptr("QueriesWithRegressedPerformance"), - // Unit: to.Ptr("Count"), - // }, - // { - // AbsoluteValue: to.Ptr[float64](-342), - // DimensionName: to.Ptr("SpaceChange"), - // Unit: to.Ptr("Megabytes"), - // }, - // { - // AbsoluteValue: to.Ptr[float64](0), - // DimensionName: to.Ptr("VerificationProgress"), - // Unit: to.Ptr("Percent"), - // }}, - // RecommendationReason: to.Ptr("Duplicate"), - // Score: to.Ptr[int32](1), - // State: &armsql.RecommendedActionStateInfo{ - // ActionInitiatedBy: to.Ptr(armsql.RecommendedActionInitiatedByUser), - // CurrentValue: to.Ptr(armsql.RecommendedActionCurrentStateSuccess), - // LastModified: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-03-01T14:38:05Z"); return t}()), - // }, - // TimeSeries: []*armsql.RecommendedActionMetricInfo{ - // }, - // ValidSince: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-03-01T14:38:05Z"); return t}()), - // Details: map[string]any{ - // "schema": "[CRM]", - // "includedColumns": "[Apple]", - // "indexActionDuration": "00:01:00", - // "indexActionStartTime": "2017-03-01T14:38:05.697", - // "indexColumns": "[Cookies],[SessionId],[Protocol]", - // "indexName": "MyIndex321", - // "indexType": "NONCLUSTERED", - // "originalIndexName": "IX_COM_SKU_SKUDepartmentID", - // "table": "[DataPoints2]", - // }, - // }, - // }, - // { - // Name: to.Ptr("IR_[dbo]_[FactFinance]_13ADA5F354E9E14A983B"), - // Type: to.Ptr("Microsoft.Sql/servers/databases/advisors/recommendedActions"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/workloadinsight-demos/providers/Microsoft.Sql/servers/misosisvr/databases/IndexAdvisor_test_3/advisors/DropIndex/recommendedActions/IR_[dbo]_[FactFinance]_13ADA5F354E9E14A983B"), - // Kind: to.Ptr(""), - // Location: to.Ptr("East Asia"), - // Properties: &armsql.RecommendedActionProperties{ - // ErrorDetails: &armsql.RecommendedActionErrorInfo{ - // }, - // EstimatedImpact: []*armsql.RecommendedActionImpactRecord{ - // { - // AbsoluteValue: to.Ptr[float64](705), - // DimensionName: to.Ptr("ActionDuration"), - // Unit: to.Ptr("Seconds"), - // }, - // { - // AbsoluteValue: to.Ptr[float64](342), - // DimensionName: to.Ptr("SpaceChange"), - // Unit: to.Ptr("Megabytes"), - // }}, - // ExecuteActionDuration: to.Ptr("PT1M"), - // ExecuteActionInitiatedBy: to.Ptr(armsql.RecommendedActionInitiatedBySystem), - // ExecuteActionInitiatedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-03-01T14:38:05Z"); return t}()), - // ExecuteActionStartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-03-01T14:38:05Z"); return t}()), - // ImplementationDetails: &armsql.RecommendedActionImplementationInfo{ - // Method: to.Ptr(armsql.ImplementationMethodTSQL), - // Script: to.Ptr("CREATE NONCLUSTERED INDEX [IX_FF] ON [dbo].[FactFinance] ([FinanceKey],[DateKey]) INCLUDE ([OrganizationKey]) WITH (ONLINE = ON)"), - // }, - // IsArchivedAction: to.Ptr(false), - // IsExecutableAction: to.Ptr(true), - // IsRevertableAction: to.Ptr(true), - // LastRefresh: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-03-01T14:38:05Z"); return t}()), - // ObservedImpact: []*armsql.RecommendedActionImpactRecord{ - // { - // ChangeValueAbsolute: to.Ptr[float64](0), - // ChangeValueRelative: to.Ptr[float64](0), - // DimensionName: to.Ptr("AffectedQueriesCpuUtilization"), - // Unit: to.Ptr("CpuCores"), - // }, - // { - // ChangeValueAbsolute: to.Ptr[float64](0), - // ChangeValueRelative: to.Ptr[float64](0), - // DimensionName: to.Ptr("CpuUtilization"), - // Unit: to.Ptr("CpuCores"), - // }, - // { - // AbsoluteValue: to.Ptr[float64](0), - // DimensionName: to.Ptr("QueriesWithImprovedPerformance"), - // Unit: to.Ptr("Count"), - // }, - // { - // AbsoluteValue: to.Ptr[float64](0), - // DimensionName: to.Ptr("QueriesWithRegressedPerformance"), - // Unit: to.Ptr("Count"), - // }, - // { - // AbsoluteValue: to.Ptr[float64](-342), - // DimensionName: to.Ptr("SpaceChange"), - // Unit: to.Ptr("Megabytes"), - // }, - // { - // AbsoluteValue: to.Ptr[float64](0), - // DimensionName: to.Ptr("VerificationProgress"), - // Unit: to.Ptr("Percent"), - // }}, - // RecommendationReason: to.Ptr("Duplicate"), - // Score: to.Ptr[int32](1), - // State: &armsql.RecommendedActionStateInfo{ - // ActionInitiatedBy: to.Ptr(armsql.RecommendedActionInitiatedBySystem), - // CurrentValue: to.Ptr(armsql.RecommendedActionCurrentStateSuccess), - // LastModified: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-02-28T14:38:05Z"); return t}()), - // }, - // TimeSeries: []*armsql.RecommendedActionMetricInfo{ - // }, - // ValidSince: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-03-01T14:38:05Z"); return t}()), - // Details: map[string]any{ - // "schema": "[dbo]", - // "includedColumns": "[OrganizationKey]", - // "indexActionDuration": "00:01:00", - // "indexActionStartTime": "2017-03-01T14:38:05.837", - // "indexColumns": "[FinanceKey],[DateKey]", - // "indexName": "IX_FF", - // "indexType": "NONCLUSTERED", - // "originalIndexName": "IX_COM_SKU_SKUDepartmentID", - // "table": "[FactFinance]", - // }, - // }, - // }}, - // }, - // }, - // { - // Name: to.Ptr("DbParameterization"), - // Type: to.Ptr("Microsoft.Sql/servers/databases/advisors"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/workloadinsight-demos/providers/Microsoft.Sql/servers/misosisvr/databases/IndexAdvisor_test_3/advisors/DbParameterization"), - // Kind: to.Ptr(""), - // Location: to.Ptr("East Asia"), - // Properties: &armsql.AdvisorProperties{ - // AdvisorStatus: to.Ptr(armsql.AdvisorStatusGA), - // AutoExecuteStatus: to.Ptr(armsql.AutoExecuteStatusEnabled), - // AutoExecuteStatusInheritedFrom: to.Ptr(armsql.AutoExecuteStatusInheritedFromDatabase), - // LastChecked: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-06-19T19:13:03Z"); return t}()), - // RecommendationsStatus: to.Ptr("DbParameterizationIssue"), - // RecommendedActions: []*armsql.RecommendedAction{ - // { - // Name: to.Ptr("ForceDbParameterization"), - // Type: to.Ptr("Microsoft.Sql/servers/databases/advisors/recommendedActions"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/workloadinsight-demos/providers/Microsoft.Sql/servers/misosisvr/databases/IndexAdvisor_test_3/advisors/DbParameterization/recommendedActions/ForceDbParameterization"), - // Kind: to.Ptr(""), - // Location: to.Ptr("East Asia"), - // Properties: &armsql.RecommendedActionProperties{ - // ErrorDetails: &armsql.RecommendedActionErrorInfo{ - // }, - // EstimatedImpact: []*armsql.RecommendedActionImpactRecord{ - // { - // ChangeValueAbsolute: to.Ptr[float64](22.5613696939135), - // DimensionName: to.Ptr("CpuSavings"), - // Unit: to.Ptr("Percent"), - // }, - // { - // ChangeValueAbsolute: to.Ptr[float64](0.701823681806341), - // DimensionName: to.Ptr("QueryDurationDecrease"), - // Unit: to.Ptr("secs"), - // }}, - // ExecuteActionInitiatedBy: to.Ptr(armsql.RecommendedActionInitiatedBySystem), - // ExecuteActionInitiatedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-05-11T15:08:31Z"); return t}()), - // ImplementationDetails: &armsql.RecommendedActionImplementationInfo{ - // Method: to.Ptr(armsql.ImplementationMethodTSQL), - // Script: to.Ptr("ALTER DATABASE [IndexAdvisor_test_3] SET PARAMETERIZATION FORCED"), - // }, - // IsArchivedAction: to.Ptr(false), - // IsExecutableAction: to.Ptr(true), - // IsRevertableAction: to.Ptr(true), - // LastRefresh: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-03-01T14:37:44Z"); return t}()), - // ObservedImpact: []*armsql.RecommendedActionImpactRecord{ - // }, - // RecommendationReason: to.Ptr(""), - // Score: to.Ptr[int32](3), - // State: &armsql.RecommendedActionStateInfo{ - // ActionInitiatedBy: to.Ptr(armsql.RecommendedActionInitiatedBySystem), - // CurrentValue: to.Ptr(armsql.RecommendedActionCurrentStatePending), - // LastModified: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-05-11T15:08:31Z"); return t}()), - // }, - // TimeSeries: []*armsql.RecommendedActionMetricInfo{ - // }, - // ValidSince: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-03-01T14:37:44Z"); return t}()), - // }, - // }}, - // }, - // }, - // { - // Name: to.Ptr("SchemaIssue"), - // Type: to.Ptr("Microsoft.Sql/servers/databases/advisors"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/workloadinsight-demos/providers/Microsoft.Sql/servers/misosisvr/databases/IndexAdvisor_test_3/advisors/SchemaIssue"), - // Kind: to.Ptr(""), - // Location: to.Ptr("East Asia"), - // Properties: &armsql.AdvisorProperties{ - // AdvisorStatus: to.Ptr(armsql.AdvisorStatusPublicPreview), - // AutoExecuteStatus: to.Ptr(armsql.AutoExecuteStatusDisabled), - // AutoExecuteStatusInheritedFrom: to.Ptr(armsql.AutoExecuteStatusInheritedFromDefault), - // LastChecked: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-06-20T18:50:21Z"); return t}()), - // RecommendationsStatus: to.Ptr("SchemaIsNotConsistent"), - // RecommendedActions: []*armsql.RecommendedAction{ - // { - // Name: to.Ptr("SchemaProblem_1A258C5714A7410C9D23"), - // Type: to.Ptr("Microsoft.Sql/servers/databases/advisors/recommendedActions"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/workloadinsight-demos/providers/Microsoft.Sql/servers/misosisvr/databases/IndexAdvisor_test_3/advisors/SchemaIssue/recommendedActions/SchemaProblem_1A258C5714A7410C9D23"), - // Kind: to.Ptr(""), - // Location: to.Ptr("East Asia"), - // Properties: &armsql.RecommendedActionProperties{ - // ErrorDetails: &armsql.RecommendedActionErrorInfo{ - // }, - // EstimatedImpact: []*armsql.RecommendedActionImpactRecord{ - // }, - // ImplementationDetails: &armsql.RecommendedActionImplementationInfo{ - // }, - // IsArchivedAction: to.Ptr(false), - // IsExecutableAction: to.Ptr(false), - // IsRevertableAction: to.Ptr(false), - // LastRefresh: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-06-07T22:19:53Z"); return t}()), - // ObservedImpact: []*armsql.RecommendedActionImpactRecord{ - // }, - // RecommendationReason: to.Ptr("SchemaProblem"), - // Score: to.Ptr[int32](3), - // State: &armsql.RecommendedActionStateInfo{ - // CurrentValue: to.Ptr(armsql.RecommendedActionCurrentStateActive), - // LastModified: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-03-01T14:37:48Z"); return t}()), - // }, - // TimeSeries: []*armsql.RecommendedActionMetricInfo{ - // }, - // ValidSince: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-03-01T14:37:48Z"); return t}()), - // Details: map[string]any{ - // "sqlErrorCount": float64(342482), - // "sqlErrorMessage": "Invalid object name 'dbo.Companies'.", - // "sqlErrorNumber": float64(208), - // }, - // }, - // }}, - // }, - // }, - // { - // Name: to.Ptr("ForceLastGoodPlan"), - // Type: to.Ptr("Microsoft.Sql/servers/databases/advisors"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/workloadinsight-demos/providers/Microsoft.Sql/servers/misosisvr/databases/IndexAdvisor_test_3/advisors/ForceLastGoodPlan"), - // Kind: to.Ptr(""), - // Location: to.Ptr("East Asia"), - // Properties: &armsql.AdvisorProperties{ - // AdvisorStatus: to.Ptr(armsql.AdvisorStatusPrivatePreview), - // AutoExecuteStatus: to.Ptr(armsql.AutoExecuteStatusDisabled), - // AutoExecuteStatusInheritedFrom: to.Ptr(armsql.AutoExecuteStatusInheritedFromDefault), - // RecommendedActions: []*armsql.RecommendedAction{ - // }, - // }, - // }} -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseAdvisorGet.json -func ExampleDatabaseAdvisorsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDatabaseAdvisorsClient().Get(ctx, "workloadinsight-demos", "misosisvr", "IndexAdvisor_test_3", "CreateIndex", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Advisor = armsql.Advisor{ - // Name: to.Ptr("CreateIndex"), - // Type: to.Ptr("Microsoft.Sql/servers/databases/advisors"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/workloadinsight-demos/providers/Microsoft.Sql/servers/misosisvr/databases/IndexAdvisor_test_3/advisors/CreateIndex"), - // Properties: &armsql.AdvisorProperties{ - // AdvisorStatus: to.Ptr(armsql.AdvisorStatusGA), - // AutoExecuteStatus: to.Ptr(armsql.AutoExecuteStatusDisabled), - // LastChecked: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-06-20T00:24:39Z"); return t}()), - // RecommendationsStatus: to.Ptr("Ok"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseAdvisorUpdate.json -func ExampleDatabaseAdvisorsClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDatabaseAdvisorsClient().Update(ctx, "workloadinsight-demos", "misosisvr", "IndexAdvisor_test_3", "CreateIndex", armsql.Advisor{ - Properties: &armsql.AdvisorProperties{ - AutoExecuteStatus: to.Ptr(armsql.AutoExecuteStatusDisabled), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Advisor = armsql.Advisor{ - // Name: to.Ptr("CreateIndex"), - // Type: to.Ptr("Microsoft.Sql/servers/databases/advisors"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/workloadinsight-demos/providers/Microsoft.Sql/servers/misosisvr/databases/IndexAdvisor_test_3/advisors/CreateIndex"), - // Properties: &armsql.AdvisorProperties{ - // AdvisorStatus: to.Ptr(armsql.AdvisorStatusGA), - // AutoExecuteStatus: to.Ptr(armsql.AutoExecuteStatusDisabled), - // LastChecked: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-06-20T00:24:39Z"); return t}()), - // RecommendationsStatus: to.Ptr("Ok"), - // }, - // } -} diff --git a/sdk/resourcemanager/sql/armsql/databaseautomatictuning_client.go b/sdk/resourcemanager/sql/armsql/databaseautomatictuning_client.go index a3322a9790fa..6ebb1735bd60 100644 --- a/sdk/resourcemanager/sql/armsql/databaseautomatictuning_client.go +++ b/sdk/resourcemanager/sql/armsql/databaseautomatictuning_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armsql @@ -47,7 +46,7 @@ func NewDatabaseAutomaticTuningClient(subscriptionID string, credential azcore.T // Get - Gets a database's automatic tuning. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -55,18 +54,21 @@ func NewDatabaseAutomaticTuningClient(subscriptionID string, credential azcore.T // - options - DatabaseAutomaticTuningClientGetOptions contains the optional parameters for the DatabaseAutomaticTuningClient.Get // method. func (client *DatabaseAutomaticTuningClient) Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string, options *DatabaseAutomaticTuningClientGetOptions) (DatabaseAutomaticTuningClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, serverName, databaseName, options) if err != nil { return DatabaseAutomaticTuningClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return DatabaseAutomaticTuningClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return DatabaseAutomaticTuningClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DatabaseAutomaticTuningClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -93,7 +95,7 @@ func (client *DatabaseAutomaticTuningClient) getCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -111,7 +113,7 @@ func (client *DatabaseAutomaticTuningClient) getHandleResponse(resp *http.Respon // Update - Update automatic tuning properties for target database. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -120,18 +122,21 @@ func (client *DatabaseAutomaticTuningClient) getHandleResponse(resp *http.Respon // - options - DatabaseAutomaticTuningClientUpdateOptions contains the optional parameters for the DatabaseAutomaticTuningClient.Update // method. func (client *DatabaseAutomaticTuningClient) Update(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters DatabaseAutomaticTuning, options *DatabaseAutomaticTuningClientUpdateOptions) (DatabaseAutomaticTuningClientUpdateResponse, error) { + var err error req, err := client.updateCreateRequest(ctx, resourceGroupName, serverName, databaseName, parameters, options) if err != nil { return DatabaseAutomaticTuningClientUpdateResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return DatabaseAutomaticTuningClientUpdateResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return DatabaseAutomaticTuningClientUpdateResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DatabaseAutomaticTuningClientUpdateResponse{}, err } - return client.updateHandleResponse(resp) + resp, err := client.updateHandleResponse(httpResp) + return resp, err } // updateCreateRequest creates the Update request. @@ -158,10 +163,13 @@ func (client *DatabaseAutomaticTuningClient) updateCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // updateHandleResponse handles the Update response. diff --git a/sdk/resourcemanager/sql/armsql/databaseautomatictuning_client_example_test.go b/sdk/resourcemanager/sql/armsql/databaseautomatictuning_client_example_test.go deleted file mode 100644 index 635a4d9358d5..000000000000 --- a/sdk/resourcemanager/sql/armsql/databaseautomatictuning_client_example_test.go +++ /dev/null @@ -1,199 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsql_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sql/armsql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseAutomaticTuningGet.json -func ExampleDatabaseAutomaticTuningClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDatabaseAutomaticTuningClient().Get(ctx, "default-sql-onebox", "testsvr11", "db1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DatabaseAutomaticTuning = armsql.DatabaseAutomaticTuning{ - // Name: to.Ptr("current"), - // Type: to.Ptr("Microsoft.Sql/servers/databases/automaticTuning"), - // ID: to.Ptr("/subscriptions/c3aa9078-0000-0000-0000-e36f151182d7/resourceGroups/default-sql-onebox/providers/Microsoft.Sql/servers/testsvr11/databases/db1/automaticTuning/current"), - // Properties: &armsql.DatabaseAutomaticTuningProperties{ - // ActualState: to.Ptr(armsql.AutomaticTuningModeAuto), - // DesiredState: to.Ptr(armsql.AutomaticTuningModeAuto), - // Options: map[string]*armsql.AutomaticTuningOptions{ - // "createIndex": &armsql.AutomaticTuningOptions{ - // ActualState: to.Ptr(armsql.AutomaticTuningOptionModeActualOn), - // DesiredState: to.Ptr(armsql.AutomaticTuningOptionModeDesiredDefault), - // ReasonCode: to.Ptr[int32](2), - // ReasonDesc: to.Ptr(armsql.AutomaticTuningDisabledReasonAutoConfigured), - // }, - // "dropIndex": &armsql.AutomaticTuningOptions{ - // ActualState: to.Ptr(armsql.AutomaticTuningOptionModeActualOff), - // DesiredState: to.Ptr(armsql.AutomaticTuningOptionModeDesiredDefault), - // ReasonCode: to.Ptr[int32](2), - // ReasonDesc: to.Ptr(armsql.AutomaticTuningDisabledReasonAutoConfigured), - // }, - // "forceLastGoodPlan": &armsql.AutomaticTuningOptions{ - // ActualState: to.Ptr(armsql.AutomaticTuningOptionModeActualOn), - // DesiredState: to.Ptr(armsql.AutomaticTuningOptionModeDesiredDefault), - // ReasonCode: to.Ptr[int32](2), - // ReasonDesc: to.Ptr(armsql.AutomaticTuningDisabledReasonAutoConfigured), - // }, - // "maintainIndex": &armsql.AutomaticTuningOptions{ - // ActualState: to.Ptr(armsql.AutomaticTuningOptionModeActualOff), - // DesiredState: to.Ptr(armsql.AutomaticTuningOptionModeDesiredDefault), - // ReasonCode: to.Ptr[int32](2), - // ReasonDesc: to.Ptr(armsql.AutomaticTuningDisabledReasonAutoConfigured), - // }, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseAutomaticTuningUpdateMax.json -func ExampleDatabaseAutomaticTuningClient_Update_updatesDatabaseAutomaticTuningSettingsWithAllProperties() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDatabaseAutomaticTuningClient().Update(ctx, "default-sql-onebox", "testsvr11", "db1", armsql.DatabaseAutomaticTuning{ - Properties: &armsql.DatabaseAutomaticTuningProperties{ - DesiredState: to.Ptr(armsql.AutomaticTuningModeAuto), - Options: map[string]*armsql.AutomaticTuningOptions{ - "createIndex": { - DesiredState: to.Ptr(armsql.AutomaticTuningOptionModeDesiredOff), - }, - "dropIndex": { - DesiredState: to.Ptr(armsql.AutomaticTuningOptionModeDesiredOn), - }, - "forceLastGoodPlan": { - DesiredState: to.Ptr(armsql.AutomaticTuningOptionModeDesiredDefault), - }, - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DatabaseAutomaticTuning = armsql.DatabaseAutomaticTuning{ - // Name: to.Ptr("current"), - // Type: to.Ptr("Microsoft.Sql/servers/databases/automaticTuning"), - // ID: to.Ptr("/subscriptions/c3aa9078-0000-0000-0000-e36f151182d7/resourceGroups/default-sql-onebox/providers/Microsoft.Sql/servers/testsvr11/databases/db1/automaticTuning/current"), - // Properties: &armsql.DatabaseAutomaticTuningProperties{ - // ActualState: to.Ptr(armsql.AutomaticTuningModeAuto), - // DesiredState: to.Ptr(armsql.AutomaticTuningModeAuto), - // Options: map[string]*armsql.AutomaticTuningOptions{ - // "createIndex": &armsql.AutomaticTuningOptions{ - // ActualState: to.Ptr(armsql.AutomaticTuningOptionModeActualOff), - // DesiredState: to.Ptr(armsql.AutomaticTuningOptionModeDesiredOff), - // }, - // "dropIndex": &armsql.AutomaticTuningOptions{ - // ActualState: to.Ptr(armsql.AutomaticTuningOptionModeActualOn), - // DesiredState: to.Ptr(armsql.AutomaticTuningOptionModeDesiredOn), - // }, - // "forceLastGoodPlan": &armsql.AutomaticTuningOptions{ - // ActualState: to.Ptr(armsql.AutomaticTuningOptionModeActualOn), - // DesiredState: to.Ptr(armsql.AutomaticTuningOptionModeDesiredDefault), - // ReasonCode: to.Ptr[int32](2), - // ReasonDesc: to.Ptr(armsql.AutomaticTuningDisabledReasonAutoConfigured), - // }, - // "maintainIndex": &armsql.AutomaticTuningOptions{ - // ActualState: to.Ptr(armsql.AutomaticTuningOptionModeActualOff), - // DesiredState: to.Ptr(armsql.AutomaticTuningOptionModeDesiredDefault), - // ReasonCode: to.Ptr[int32](2), - // ReasonDesc: to.Ptr(armsql.AutomaticTuningDisabledReasonAutoConfigured), - // }, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseAutomaticTuningUpdateMin.json -func ExampleDatabaseAutomaticTuningClient_Update_updatesDatabaseAutomaticTuningSettingsWithMinimalProperties() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDatabaseAutomaticTuningClient().Update(ctx, "default-sql-onebox", "testsvr11", "db1", armsql.DatabaseAutomaticTuning{ - Properties: &armsql.DatabaseAutomaticTuningProperties{ - DesiredState: to.Ptr(armsql.AutomaticTuningModeAuto), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DatabaseAutomaticTuning = armsql.DatabaseAutomaticTuning{ - // Name: to.Ptr("current"), - // Type: to.Ptr("Microsoft.Sql/servers/databases/automaticTuning"), - // ID: to.Ptr("/subscriptions/c3aa9078-0000-0000-0000-e36f151182d7/resourceGroups/default-sql-onebox/providers/Microsoft.Sql/servers/testsvr11/databases/db1/automaticTuning/current"), - // Properties: &armsql.DatabaseAutomaticTuningProperties{ - // ActualState: to.Ptr(armsql.AutomaticTuningModeAuto), - // DesiredState: to.Ptr(armsql.AutomaticTuningModeAuto), - // Options: map[string]*armsql.AutomaticTuningOptions{ - // "createIndex": &armsql.AutomaticTuningOptions{ - // ActualState: to.Ptr(armsql.AutomaticTuningOptionModeActualOn), - // DesiredState: to.Ptr(armsql.AutomaticTuningOptionModeDesiredDefault), - // ReasonCode: to.Ptr[int32](2), - // ReasonDesc: to.Ptr(armsql.AutomaticTuningDisabledReasonAutoConfigured), - // }, - // "dropIndex": &armsql.AutomaticTuningOptions{ - // ActualState: to.Ptr(armsql.AutomaticTuningOptionModeActualOff), - // DesiredState: to.Ptr(armsql.AutomaticTuningOptionModeDesiredDefault), - // ReasonCode: to.Ptr[int32](2), - // ReasonDesc: to.Ptr(armsql.AutomaticTuningDisabledReasonAutoConfigured), - // }, - // "forceLastGoodPlan": &armsql.AutomaticTuningOptions{ - // ActualState: to.Ptr(armsql.AutomaticTuningOptionModeActualOn), - // DesiredState: to.Ptr(armsql.AutomaticTuningOptionModeDesiredDefault), - // ReasonCode: to.Ptr[int32](2), - // ReasonDesc: to.Ptr(armsql.AutomaticTuningDisabledReasonAutoConfigured), - // }, - // "maintainIndex": &armsql.AutomaticTuningOptions{ - // ActualState: to.Ptr(armsql.AutomaticTuningOptionModeActualOff), - // DesiredState: to.Ptr(armsql.AutomaticTuningOptionModeDesiredDefault), - // ReasonCode: to.Ptr[int32](2), - // ReasonDesc: to.Ptr(armsql.AutomaticTuningDisabledReasonAutoConfigured), - // }, - // }, - // }, - // } -} diff --git a/sdk/resourcemanager/sql/armsql/databaseblobauditingpolicies_client.go b/sdk/resourcemanager/sql/armsql/databaseblobauditingpolicies_client.go index 832005fd4e72..093de3e29aeb 100644 --- a/sdk/resourcemanager/sql/armsql/databaseblobauditingpolicies_client.go +++ b/sdk/resourcemanager/sql/armsql/databaseblobauditingpolicies_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armsql @@ -47,7 +46,7 @@ func NewDatabaseBlobAuditingPoliciesClient(subscriptionID string, credential azc // CreateOrUpdate - Creates or updates a database's blob auditing policy. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -56,18 +55,21 @@ func NewDatabaseBlobAuditingPoliciesClient(subscriptionID string, credential azc // - options - DatabaseBlobAuditingPoliciesClientCreateOrUpdateOptions contains the optional parameters for the DatabaseBlobAuditingPoliciesClient.CreateOrUpdate // method. func (client *DatabaseBlobAuditingPoliciesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters DatabaseBlobAuditingPolicy, options *DatabaseBlobAuditingPoliciesClientCreateOrUpdateOptions) (DatabaseBlobAuditingPoliciesClientCreateOrUpdateResponse, error) { + var err error req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, serverName, databaseName, parameters, options) if err != nil { return DatabaseBlobAuditingPoliciesClientCreateOrUpdateResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return DatabaseBlobAuditingPoliciesClientCreateOrUpdateResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { - return DatabaseBlobAuditingPoliciesClientCreateOrUpdateResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return DatabaseBlobAuditingPoliciesClientCreateOrUpdateResponse{}, err } - return client.createOrUpdateHandleResponse(resp) + resp, err := client.createOrUpdateHandleResponse(httpResp) + return resp, err } // createOrUpdateCreateRequest creates the CreateOrUpdate request. @@ -95,10 +97,13 @@ func (client *DatabaseBlobAuditingPoliciesClient) createOrUpdateCreateRequest(ct return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // createOrUpdateHandleResponse handles the CreateOrUpdate response. @@ -113,7 +118,7 @@ func (client *DatabaseBlobAuditingPoliciesClient) createOrUpdateHandleResponse(r // Get - Gets a database's blob auditing policy. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -121,18 +126,21 @@ func (client *DatabaseBlobAuditingPoliciesClient) createOrUpdateHandleResponse(r // - options - DatabaseBlobAuditingPoliciesClientGetOptions contains the optional parameters for the DatabaseBlobAuditingPoliciesClient.Get // method. func (client *DatabaseBlobAuditingPoliciesClient) Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string, options *DatabaseBlobAuditingPoliciesClientGetOptions) (DatabaseBlobAuditingPoliciesClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, serverName, databaseName, options) if err != nil { return DatabaseBlobAuditingPoliciesClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return DatabaseBlobAuditingPoliciesClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return DatabaseBlobAuditingPoliciesClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DatabaseBlobAuditingPoliciesClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -160,7 +168,7 @@ func (client *DatabaseBlobAuditingPoliciesClient) getCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -177,7 +185,7 @@ func (client *DatabaseBlobAuditingPoliciesClient) getHandleResponse(resp *http.R // NewListByDatabasePager - Lists auditing settings of a database. // -// Generated from API version 2021-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -236,7 +244,7 @@ func (client *DatabaseBlobAuditingPoliciesClient) listByDatabaseCreateRequest(ct return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/sql/armsql/databaseblobauditingpolicies_client_example_test.go b/sdk/resourcemanager/sql/armsql/databaseblobauditingpolicies_client_example_test.go deleted file mode 100644 index e0605fecd624..000000000000 --- a/sdk/resourcemanager/sql/armsql/databaseblobauditingpolicies_client_example_test.go +++ /dev/null @@ -1,238 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsql_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sql/armsql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/DatabaseAuditingSettingsList.json -func ExampleDatabaseBlobAuditingPoliciesClient_NewListByDatabasePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDatabaseBlobAuditingPoliciesClient().NewListByDatabasePager("blobauditingtest-6852", "blobauditingtest-2080", "testdb", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DatabaseBlobAuditingPolicyListResult = armsql.DatabaseBlobAuditingPolicyListResult{ - // Value: []*armsql.DatabaseBlobAuditingPolicy{ - // { - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.Sql/servers/databases/auditingSettings"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/blobauditingtest-6852/providers/Microsoft.Sql/servers/blobauditingtest-2080/databases/testdb/auditingSettings/default"), - // Kind: to.Ptr("V12"), - // Properties: &armsql.DatabaseBlobAuditingPolicyProperties{ - // AuditActionsAndGroups: []*string{ - // }, - // IsAzureMonitorTargetEnabled: to.Ptr(false), - // IsStorageSecondaryKeyInUse: to.Ptr(false), - // RetentionDays: to.Ptr[int32](0), - // State: to.Ptr(armsql.BlobAuditingPolicyStateDisabled), - // StorageAccountSubscriptionID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // StorageEndpoint: to.Ptr(""), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/DatabaseBlobAuditingGet.json -func ExampleDatabaseBlobAuditingPoliciesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDatabaseBlobAuditingPoliciesClient().Get(ctx, "blobauditingtest-6852", "blobauditingtest-2080", "testdb", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DatabaseBlobAuditingPolicy = armsql.DatabaseBlobAuditingPolicy{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.Sql/servers/databases/auditingSettings"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/blobauditingtest-6852/providers/Microsoft.Sql/servers/blobauditingtest-2080/databases/testdb"), - // Kind: to.Ptr("V12"), - // Properties: &armsql.DatabaseBlobAuditingPolicyProperties{ - // AuditActionsAndGroups: []*string{ - // }, - // IsAzureMonitorTargetEnabled: to.Ptr(false), - // IsStorageSecondaryKeyInUse: to.Ptr(false), - // RetentionDays: to.Ptr[int32](0), - // State: to.Ptr(armsql.BlobAuditingPolicyStateDisabled), - // StorageAccountSubscriptionID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // StorageEndpoint: to.Ptr(""), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/DatabaseAzureMonitorAuditingCreateMin.json -func ExampleDatabaseBlobAuditingPoliciesClient_CreateOrUpdate_createOrUpdateADatabasesAzureMonitorAuditingPolicyWithMinimalParameters() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDatabaseBlobAuditingPoliciesClient().CreateOrUpdate(ctx, "blobauditingtest-4799", "blobauditingtest-6440", "testdb", armsql.DatabaseBlobAuditingPolicy{ - Properties: &armsql.DatabaseBlobAuditingPolicyProperties{ - IsAzureMonitorTargetEnabled: to.Ptr(true), - State: to.Ptr(armsql.BlobAuditingPolicyStateEnabled), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DatabaseBlobAuditingPolicy = armsql.DatabaseBlobAuditingPolicy{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.Sql/servers/databases/auditingSettings"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/blobauditingtest-4799/providers/Microsoft.Sql/servers/blobauditingtest-6440/databases/testdb"), - // Kind: to.Ptr("V12"), - // Properties: &armsql.DatabaseBlobAuditingPolicyProperties{ - // AuditActionsAndGroups: []*string{ - // to.Ptr("SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP"), - // to.Ptr("FAILED_DATABASE_AUTHENTICATION_GROUP"), - // to.Ptr("BATCH_COMPLETED_GROUP")}, - // IsAzureMonitorTargetEnabled: to.Ptr(true), - // RetentionDays: to.Ptr[int32](0), - // State: to.Ptr(armsql.BlobAuditingPolicyStateEnabled), - // StorageAccountSubscriptionID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/DatabaseBlobAuditingCreateMax.json -func ExampleDatabaseBlobAuditingPoliciesClient_CreateOrUpdate_createOrUpdateADatabasesBlobAuditingPolicyWithAllParameters() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDatabaseBlobAuditingPoliciesClient().CreateOrUpdate(ctx, "blobauditingtest-4799", "blobauditingtest-6440", "testdb", armsql.DatabaseBlobAuditingPolicy{ - Properties: &armsql.DatabaseBlobAuditingPolicyProperties{ - AuditActionsAndGroups: []*string{ - to.Ptr("DATABASE_LOGOUT_GROUP"), - to.Ptr("DATABASE_ROLE_MEMBER_CHANGE_GROUP"), - to.Ptr("UPDATE on database::TestDatabaseName by public")}, - IsAzureMonitorTargetEnabled: to.Ptr(true), - IsStorageSecondaryKeyInUse: to.Ptr(false), - QueueDelayMs: to.Ptr[int32](4000), - RetentionDays: to.Ptr[int32](6), - State: to.Ptr(armsql.BlobAuditingPolicyStateEnabled), - StorageAccountAccessKey: to.Ptr("sdlfkjabc+sdlfkjsdlkfsjdfLDKFTERLKFDFKLjsdfksjdflsdkfD2342309432849328476458/3RSD=="), - StorageAccountSubscriptionID: to.Ptr("00000000-1234-0000-5678-000000000000"), - StorageEndpoint: to.Ptr("https://mystorage.blob.core.windows.net"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DatabaseBlobAuditingPolicy = armsql.DatabaseBlobAuditingPolicy{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.Sql/servers/databases/auditingSettings"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/blobauditingtest-4799/providers/Microsoft.Sql/servers/blobauditingtest-6440/databases/testdb"), - // Kind: to.Ptr("V12"), - // Properties: &armsql.DatabaseBlobAuditingPolicyProperties{ - // AuditActionsAndGroups: []*string{ - // to.Ptr("DATABASE_LOGOUT_GROUP"), - // to.Ptr("DATABASE_ROLE_MEMBER_CHANGE_GROUP"), - // to.Ptr("UPDATE on database::TestDatabaseName by public")}, - // IsAzureMonitorTargetEnabled: to.Ptr(true), - // IsStorageSecondaryKeyInUse: to.Ptr(false), - // QueueDelayMs: to.Ptr[int32](4000), - // RetentionDays: to.Ptr[int32](0), - // State: to.Ptr(armsql.BlobAuditingPolicyStateEnabled), - // StorageAccountSubscriptionID: to.Ptr("00000000-1234-0000-5678-000000000000"), - // StorageEndpoint: to.Ptr("https://mystorage.blob.core.windows.net"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/DatabaseBlobAuditingCreateMin.json -func ExampleDatabaseBlobAuditingPoliciesClient_CreateOrUpdate_createOrUpdateADatabasesBlobAuditingPolicyWithMinimalParameters() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDatabaseBlobAuditingPoliciesClient().CreateOrUpdate(ctx, "blobauditingtest-4799", "blobauditingtest-6440", "testdb", armsql.DatabaseBlobAuditingPolicy{ - Properties: &armsql.DatabaseBlobAuditingPolicyProperties{ - State: to.Ptr(armsql.BlobAuditingPolicyStateEnabled), - StorageAccountAccessKey: to.Ptr("sdlfkjabc+sdlfkjsdlkfsjdfLDKFTERLKFDFKLjsdfksjdflsdkfD2342309432849328476458/3RSD=="), - StorageEndpoint: to.Ptr("https://mystorage.blob.core.windows.net"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DatabaseBlobAuditingPolicy = armsql.DatabaseBlobAuditingPolicy{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.Sql/servers/databases/auditingSettings"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/blobauditingtest-4799/providers/Microsoft.Sql/servers/blobauditingtest-6440/databases/testdb"), - // Kind: to.Ptr("V12"), - // Properties: &armsql.DatabaseBlobAuditingPolicyProperties{ - // AuditActionsAndGroups: []*string{ - // to.Ptr("SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP"), - // to.Ptr("FAILED_DATABASE_AUTHENTICATION_GROUP"), - // to.Ptr("BATCH_COMPLETED_GROUP")}, - // IsAzureMonitorTargetEnabled: to.Ptr(false), - // IsStorageSecondaryKeyInUse: to.Ptr(false), - // RetentionDays: to.Ptr[int32](0), - // State: to.Ptr(armsql.BlobAuditingPolicyStateEnabled), - // StorageAccountSubscriptionID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // StorageEndpoint: to.Ptr("https://mystorage.blob.core.windows.net"), - // }, - // } -} diff --git a/sdk/resourcemanager/sql/armsql/databasecolumns_client.go b/sdk/resourcemanager/sql/armsql/databasecolumns_client.go index 493bfdb51af9..90b926916dbc 100644 --- a/sdk/resourcemanager/sql/armsql/databasecolumns_client.go +++ b/sdk/resourcemanager/sql/armsql/databasecolumns_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armsql @@ -47,7 +46,7 @@ func NewDatabaseColumnsClient(subscriptionID string, credential azcore.TokenCred // Get - Get database column // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -57,18 +56,21 @@ func NewDatabaseColumnsClient(subscriptionID string, credential azcore.TokenCred // - columnName - The name of the column. // - options - DatabaseColumnsClientGetOptions contains the optional parameters for the DatabaseColumnsClient.Get method. func (client *DatabaseColumnsClient) Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string, schemaName string, tableName string, columnName string, options *DatabaseColumnsClientGetOptions) (DatabaseColumnsClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, serverName, databaseName, schemaName, tableName, columnName, options) if err != nil { return DatabaseColumnsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return DatabaseColumnsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return DatabaseColumnsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DatabaseColumnsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -107,7 +109,7 @@ func (client *DatabaseColumnsClient) getCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -124,7 +126,7 @@ func (client *DatabaseColumnsClient) getHandleResponse(resp *http.Response) (Dat // NewListByDatabasePager - List database columns // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -206,7 +208,7 @@ func (client *DatabaseColumnsClient) listByDatabaseCreateRequest(ctx context.Con if options != nil && options.Skiptoken != nil { reqQP.Set("$skiptoken", *options.Skiptoken) } - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -223,7 +225,7 @@ func (client *DatabaseColumnsClient) listByDatabaseHandleResponse(resp *http.Res // NewListByTablePager - List database columns // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -295,7 +297,7 @@ func (client *DatabaseColumnsClient) listByTableCreateRequest(ctx context.Contex if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/sql/armsql/databasecolumns_client_example_test.go b/sdk/resourcemanager/sql/armsql/databasecolumns_client_example_test.go deleted file mode 100644 index 782bce6f21be..000000000000 --- a/sdk/resourcemanager/sql/armsql/databasecolumns_client_example_test.go +++ /dev/null @@ -1,205 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsql_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sql/armsql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ColumnsListByDatabaseMax.json -func ExampleDatabaseColumnsClient_NewListByDatabasePager_filterDatabaseColumns() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDatabaseColumnsClient().NewListByDatabasePager("myRG", "serverName", "myDatabase", &armsql.DatabaseColumnsClientListByDatabaseOptions{Schema: []string{ - "dbo"}, - Table: []string{ - "customer", - "address"}, - Column: []string{ - "username"}, - OrderBy: []string{ - "schema asc", - "table", - "column desc"}, - Skiptoken: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DatabaseColumnListResult = armsql.DatabaseColumnListResult{ - // Value: []*armsql.DatabaseColumn{ - // { - // Name: to.Ptr("username"), - // Type: to.Ptr("Microsoft.Sql/servers/databases/schemas/tables/columns"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/myRG/providers/Microsoft.Sql/servers/serverName/databases/myDatabase/schemas/dbo/tables/customer/columns/username"), - // Properties: &armsql.DatabaseColumnProperties{ - // ColumnType: to.Ptr(armsql.ColumnDataTypeNvarchar), - // IsComputed: to.Ptr(false), - // MemoryOptimized: to.Ptr(false), - // TemporalType: to.Ptr(armsql.TableTemporalTypeNonTemporalTable), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ColumnsListByDatabaseMin.json -func ExampleDatabaseColumnsClient_NewListByDatabasePager_listDatabaseColumns() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDatabaseColumnsClient().NewListByDatabasePager("myRG", "serverName", "myDatabase", &armsql.DatabaseColumnsClientListByDatabaseOptions{Schema: []string{}, - Table: []string{}, - Column: []string{}, - OrderBy: []string{}, - Skiptoken: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DatabaseColumnListResult = armsql.DatabaseColumnListResult{ - // Value: []*armsql.DatabaseColumn{ - // { - // Name: to.Ptr("col1"), - // Type: to.Ptr("Microsoft.Sql/servers/databases/schemas/tables/columns"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/myRG/providers/Microsoft.Sql/servers/serverName/databases/myDatabase/schemas/dbo/tables/table1/columns/col1"), - // Properties: &armsql.DatabaseColumnProperties{ - // ColumnType: to.Ptr(armsql.ColumnDataTypeInt), - // IsComputed: to.Ptr(false), - // MemoryOptimized: to.Ptr(false), - // TemporalType: to.Ptr(armsql.TableTemporalTypeNonTemporalTable), - // }, - // }, - // { - // Name: to.Ptr("col2"), - // Type: to.Ptr("Microsoft.Sql/servers/databases/schemas/tables/columns"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/myRG/providers/Microsoft.Sql/servers/serverName/databases/myDatabase/schemas/dbo/tables/table1/columns/col2"), - // Properties: &armsql.DatabaseColumnProperties{ - // ColumnType: to.Ptr(armsql.ColumnDataTypeBit), - // IsComputed: to.Ptr(false), - // MemoryOptimized: to.Ptr(false), - // TemporalType: to.Ptr(armsql.TableTemporalTypeSystemVersionedTemporalTable), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseColumnListByTable.json -func ExampleDatabaseColumnsClient_NewListByTablePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDatabaseColumnsClient().NewListByTablePager("myRG", "serverName", "myDatabase", "dbo", "table1", &armsql.DatabaseColumnsClientListByTableOptions{Filter: nil}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DatabaseColumnListResult = armsql.DatabaseColumnListResult{ - // Value: []*armsql.DatabaseColumn{ - // { - // Name: to.Ptr("col1"), - // Type: to.Ptr("Microsoft.Sql/servers/databases/schemas/tables/columns"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/myRG/providers/Microsoft.Sql/servers/serverName/databases/myDatabase/schemas/dbo/tables/table1/columns/col1"), - // Properties: &armsql.DatabaseColumnProperties{ - // ColumnType: to.Ptr(armsql.ColumnDataTypeNvarchar), - // IsComputed: to.Ptr(false), - // MemoryOptimized: to.Ptr(false), - // TemporalType: to.Ptr(armsql.TableTemporalTypeNonTemporalTable), - // }, - // }, - // { - // Name: to.Ptr("col2"), - // Type: to.Ptr("Microsoft.Sql/servers/databases/schemas/tables/columns"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/myRG/providers/Microsoft.Sql/servers/serverName/databases/myDatabase/schemas/dbo/tables/table1/columns/col2"), - // Properties: &armsql.DatabaseColumnProperties{ - // ColumnType: to.Ptr(armsql.ColumnDataTypeBit), - // IsComputed: to.Ptr(false), - // MemoryOptimized: to.Ptr(false), - // TemporalType: to.Ptr(armsql.TableTemporalTypeNonTemporalTable), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseColumnGet.json -func ExampleDatabaseColumnsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDatabaseColumnsClient().Get(ctx, "myRG", "serverName", "myDatabase", "dbo", "table1", "column1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DatabaseColumn = armsql.DatabaseColumn{ - // Name: to.Ptr("column1"), - // Type: to.Ptr("Microsoft.Sql/servers/databases/schemas/tables/columns"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/myRG/providers/Microsoft.Sql/servers/serverName/databases/myDatabase/schemas/dbo/tables/table1/columns/column1"), - // Properties: &armsql.DatabaseColumnProperties{ - // ColumnType: to.Ptr(armsql.ColumnDataTypeBit), - // IsComputed: to.Ptr(false), - // MemoryOptimized: to.Ptr(false), - // TemporalType: to.Ptr(armsql.TableTemporalTypeSystemVersionedTemporalTable), - // }, - // } -} diff --git a/sdk/resourcemanager/sql/armsql/databaseencryptionprotectors_client.go b/sdk/resourcemanager/sql/armsql/databaseencryptionprotectors_client.go new file mode 100644 index 000000000000..71bb7d32509d --- /dev/null +++ b/sdk/resourcemanager/sql/armsql/databaseencryptionprotectors_client.go @@ -0,0 +1,204 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armsql + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// DatabaseEncryptionProtectorsClient contains the methods for the DatabaseEncryptionProtectors group. +// Don't use this type directly, use NewDatabaseEncryptionProtectorsClient() instead. +type DatabaseEncryptionProtectorsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewDatabaseEncryptionProtectorsClient creates a new instance of DatabaseEncryptionProtectorsClient with the specified values. +// - subscriptionID - The subscription ID that identifies an Azure subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewDatabaseEncryptionProtectorsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*DatabaseEncryptionProtectorsClient, error) { + cl, err := arm.NewClient(moduleName+".DatabaseEncryptionProtectorsClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &DatabaseEncryptionProtectorsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginRevalidate - Revalidates an existing encryption protector for a particular database. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-11-01-preview +// - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure +// Resource Manager API or the portal. +// - serverName - The name of the server. +// - databaseName - The name of the database. +// - encryptionProtectorName - The name of the encryption protector to be updated. +// - options - DatabaseEncryptionProtectorsClientBeginRevalidateOptions contains the optional parameters for the DatabaseEncryptionProtectorsClient.BeginRevalidate +// method. +func (client *DatabaseEncryptionProtectorsClient) BeginRevalidate(ctx context.Context, resourceGroupName string, serverName string, databaseName string, encryptionProtectorName EncryptionProtectorName, options *DatabaseEncryptionProtectorsClientBeginRevalidateOptions) (*runtime.Poller[DatabaseEncryptionProtectorsClientRevalidateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.revalidate(ctx, resourceGroupName, serverName, databaseName, encryptionProtectorName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DatabaseEncryptionProtectorsClientRevalidateResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[DatabaseEncryptionProtectorsClientRevalidateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Revalidate - Revalidates an existing encryption protector for a particular database. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-11-01-preview +func (client *DatabaseEncryptionProtectorsClient) revalidate(ctx context.Context, resourceGroupName string, serverName string, databaseName string, encryptionProtectorName EncryptionProtectorName, options *DatabaseEncryptionProtectorsClientBeginRevalidateOptions) (*http.Response, error) { + var err error + req, err := client.revalidateCreateRequest(ctx, resourceGroupName, serverName, databaseName, encryptionProtectorName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// revalidateCreateRequest creates the Revalidate request. +func (client *DatabaseEncryptionProtectorsClient) revalidateCreateRequest(ctx context.Context, resourceGroupName string, serverName string, databaseName string, encryptionProtectorName EncryptionProtectorName, options *DatabaseEncryptionProtectorsClientBeginRevalidateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/encryptionProtector/{encryptionProtectorName}/revalidate" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serverName == "" { + return nil, errors.New("parameter serverName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serverName}", url.PathEscape(serverName)) + if databaseName == "" { + return nil, errors.New("parameter databaseName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{databaseName}", url.PathEscape(databaseName)) + if encryptionProtectorName == "" { + return nil, errors.New("parameter encryptionProtectorName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{encryptionProtectorName}", url.PathEscape(string(encryptionProtectorName))) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + return req, nil +} + +// BeginRevert - Reverts an existing encryption protector for a particular database. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-11-01-preview +// - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure +// Resource Manager API or the portal. +// - serverName - The name of the server. +// - databaseName - The name of the database. +// - encryptionProtectorName - The name of the encryption protector to be updated. +// - options - DatabaseEncryptionProtectorsClientBeginRevertOptions contains the optional parameters for the DatabaseEncryptionProtectorsClient.BeginRevert +// method. +func (client *DatabaseEncryptionProtectorsClient) BeginRevert(ctx context.Context, resourceGroupName string, serverName string, databaseName string, encryptionProtectorName EncryptionProtectorName, options *DatabaseEncryptionProtectorsClientBeginRevertOptions) (*runtime.Poller[DatabaseEncryptionProtectorsClientRevertResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.revert(ctx, resourceGroupName, serverName, databaseName, encryptionProtectorName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DatabaseEncryptionProtectorsClientRevertResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[DatabaseEncryptionProtectorsClientRevertResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Revert - Reverts an existing encryption protector for a particular database. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-11-01-preview +func (client *DatabaseEncryptionProtectorsClient) revert(ctx context.Context, resourceGroupName string, serverName string, databaseName string, encryptionProtectorName EncryptionProtectorName, options *DatabaseEncryptionProtectorsClientBeginRevertOptions) (*http.Response, error) { + var err error + req, err := client.revertCreateRequest(ctx, resourceGroupName, serverName, databaseName, encryptionProtectorName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// revertCreateRequest creates the Revert request. +func (client *DatabaseEncryptionProtectorsClient) revertCreateRequest(ctx context.Context, resourceGroupName string, serverName string, databaseName string, encryptionProtectorName EncryptionProtectorName, options *DatabaseEncryptionProtectorsClientBeginRevertOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/encryptionProtector/{encryptionProtectorName}/revert" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serverName == "" { + return nil, errors.New("parameter serverName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serverName}", url.PathEscape(serverName)) + if databaseName == "" { + return nil, errors.New("parameter databaseName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{databaseName}", url.PathEscape(databaseName)) + if encryptionProtectorName == "" { + return nil, errors.New("parameter encryptionProtectorName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{encryptionProtectorName}", url.PathEscape(string(encryptionProtectorName))) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + return req, nil +} diff --git a/sdk/resourcemanager/sql/armsql/databaseextensions_client.go b/sdk/resourcemanager/sql/armsql/databaseextensions_client.go index 2c0aa1aeea94..f9f09505866a 100644 --- a/sdk/resourcemanager/sql/armsql/databaseextensions_client.go +++ b/sdk/resourcemanager/sql/armsql/databaseextensions_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armsql @@ -44,10 +43,10 @@ func NewDatabaseExtensionsClient(subscriptionID string, credential azcore.TokenC return client, nil } -// BeginCreateOrUpdate - Perform a database extension operation, like polybase import +// BeginCreateOrUpdate - Perform a database extension operation, like database import, database export, or polybase import // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-02-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -61,29 +60,32 @@ func (client *DatabaseExtensionsClient) BeginCreateOrUpdate(ctx context.Context, if err != nil { return nil, err } - return runtime.NewPoller[DatabaseExtensionsClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[DatabaseExtensionsClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[DatabaseExtensionsClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } } -// CreateOrUpdate - Perform a database extension operation, like polybase import +// CreateOrUpdate - Perform a database extension operation, like database import, database export, or polybase import // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-02-01-preview +// Generated from API version 2022-11-01-preview func (client *DatabaseExtensionsClient) createOrUpdate(ctx context.Context, resourceGroupName string, serverName string, databaseName string, extensionName string, parameters DatabaseExtensions, options *DatabaseExtensionsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, serverName, databaseName, extensionName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createOrUpdateCreateRequest creates the CreateOrUpdate request. @@ -114,32 +116,37 @@ func (client *DatabaseExtensionsClient) createOrUpdateCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-02-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // Get - Gets a database extension. This will return resource not found as it is not supported. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-02-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. // - databaseName - The name of the database. // - options - DatabaseExtensionsClientGetOptions contains the optional parameters for the DatabaseExtensionsClient.Get method. func (client *DatabaseExtensionsClient) Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string, extensionName string, options *DatabaseExtensionsClientGetOptions) (DatabaseExtensionsClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, serverName, databaseName, extensionName, options) if err != nil { return DatabaseExtensionsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return DatabaseExtensionsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return DatabaseExtensionsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DatabaseExtensionsClientGetResponse{}, err } return DatabaseExtensionsClientGetResponse{}, nil } @@ -172,14 +179,14 @@ func (client *DatabaseExtensionsClient) getCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-02-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } // NewListByDatabasePager - List database extension. This will return an empty list as it is not supported. // -// Generated from API version 2021-02-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -238,7 +245,7 @@ func (client *DatabaseExtensionsClient) listByDatabaseCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-02-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/sql/armsql/databaseextensions_client_example_test.go b/sdk/resourcemanager/sql/armsql/databaseextensions_client_example_test.go deleted file mode 100644 index cd74e6b56e12..000000000000 --- a/sdk/resourcemanager/sql/armsql/databaseextensions_client_example_test.go +++ /dev/null @@ -1,109 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsql_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sql/armsql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/GetDatabaseExtensions.json -func ExampleDatabaseExtensionsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewDatabaseExtensionsClient().Get(ctx, "rg_a1f9d6f8-30d5-4228-9504-8a364361bca3", "srv_65858e0f-b1d1-4bdc-8351-a7da86ca4939", "11aa6c5e-58ed-4693-b303-3b8e3131deaa", "polybaseimport", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/CreateOrUpdateDatabaseExtensions.json -func ExampleDatabaseExtensionsClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDatabaseExtensionsClient().BeginCreateOrUpdate(ctx, "rg_20cbe0f0-c2d9-4522-9177-5469aad53029", "srv_1ffd1cf8-9951-47fb-807d-a9c384763849", "878e303f-1ea0-4f17-aa3d-a22ac5e9da08", "polybaseimport", armsql.DatabaseExtensions{ - Properties: &armsql.DatabaseExtensionsProperties{ - OperationMode: to.Ptr(armsql.OperationModePolybaseImport), - StorageKey: to.Ptr("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"), - StorageKeyType: to.Ptr(armsql.StorageKeyTypeStorageAccessKey), - StorageURI: to.Ptr("https://teststorage.blob.core.windows.net/testcontainer/Manifest.xml"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ImportExportExtensionsOperationResult = armsql.ImportExportExtensionsOperationResult{ - // Name: to.Ptr("10000000-0000-0000-0000-000000000002"), - // Type: to.Ptr("Microsoft.Sql/servers/databases/extensions"), - // ID: to.Ptr("10000000-0000-0000-0000-000000000002"), - // Properties: &armsql.ImportExportExtensionsOperationResultProperties{ - // DatabaseName: to.Ptr("878e303f-1ea0-4f17-aa3d-a22ac5e9da08"), - // LastModifiedTime: to.Ptr("lastModifiedTime"), - // RequestID: to.Ptr("10000000-0000-0000-0000-000000000002"), - // RequestType: to.Ptr("PolybaseImport"), - // ServerName: to.Ptr("srv_1ffd1cf8-9951-47fb-807d-a9c384763849"), - // Status: to.Ptr("succeeded"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/ListDatabaseExtensions.json -func ExampleDatabaseExtensionsClient_NewListByDatabasePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDatabaseExtensionsClient().NewListByDatabasePager("rg_4007c5a9-b3b0-41e1-bd46-9eef38768a4a", "srv_3b67ec2a-519b-43a7-8533-fb62dce3431e", "719d8fa4-bf0f-48fc-8cd3-ef40fe6ba1fe", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ImportExportExtensionsOperationListResult = armsql.ImportExportExtensionsOperationListResult{ - // Value: []*armsql.ImportExportExtensionsOperationResult{ - // }, - // } - } -} diff --git a/sdk/resourcemanager/sql/armsql/databaseoperations_client.go b/sdk/resourcemanager/sql/armsql/databaseoperations_client.go index 6f744d5979c6..792b30065e0c 100644 --- a/sdk/resourcemanager/sql/armsql/databaseoperations_client.go +++ b/sdk/resourcemanager/sql/armsql/databaseoperations_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armsql @@ -47,7 +46,7 @@ func NewDatabaseOperationsClient(subscriptionID string, credential azcore.TokenC // Cancel - Cancels the asynchronous operation on the database. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-02-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -56,16 +55,18 @@ func NewDatabaseOperationsClient(subscriptionID string, credential azcore.TokenC // - options - DatabaseOperationsClientCancelOptions contains the optional parameters for the DatabaseOperationsClient.Cancel // method. func (client *DatabaseOperationsClient) Cancel(ctx context.Context, resourceGroupName string, serverName string, databaseName string, operationID string, options *DatabaseOperationsClientCancelOptions) (DatabaseOperationsClientCancelResponse, error) { + var err error req, err := client.cancelCreateRequest(ctx, resourceGroupName, serverName, databaseName, operationID, options) if err != nil { return DatabaseOperationsClientCancelResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return DatabaseOperationsClientCancelResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return DatabaseOperationsClientCancelResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DatabaseOperationsClientCancelResponse{}, err } return DatabaseOperationsClientCancelResponse{}, nil } @@ -95,14 +96,14 @@ func (client *DatabaseOperationsClient) cancelCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-02-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } // NewListByDatabasePager - Gets a list of operations performed on the database. // -// Generated from API version 2021-02-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -161,7 +162,7 @@ func (client *DatabaseOperationsClient) listByDatabaseCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-02-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/sql/armsql/databaseoperations_client_example_test.go b/sdk/resourcemanager/sql/armsql/databaseoperations_client_example_test.go deleted file mode 100644 index 99be0592e2ec..000000000000 --- a/sdk/resourcemanager/sql/armsql/databaseoperations_client_example_test.go +++ /dev/null @@ -1,91 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsql_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sql/armsql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/CancelDatabaseOperation.json -func ExampleDatabaseOperationsClient_Cancel() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewDatabaseOperationsClient().Cancel(ctx, "sqlcrudtest-7398", "sqlcrudtest-6661", "testdb", "f779414b-e748-4925-8cfe-c8598f7660ae", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/ListDatabaseOperations.json -func ExampleDatabaseOperationsClient_NewListByDatabasePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDatabaseOperationsClient().NewListByDatabasePager("sqlcrudtest-7398", "sqlcrudtest-4645", "testdb", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DatabaseOperationListResult = armsql.DatabaseOperationListResult{ - // Value: []*armsql.DatabaseOperation{ - // { - // Name: to.Ptr("11111111-1111-1111-1111-111111111111"), - // Type: to.Ptr("Microsoft.Sql/servers/databases/operations"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/sqlcrudtest-7398/providers/Microsoft.Sql/servers/sqlcrudtest-4645/databases/testdb/operations/11111111-1111-1111-1111-111111111111"), - // Properties: &armsql.DatabaseOperationProperties{ - // DatabaseName: to.Ptr("testdb"), - // Operation: to.Ptr("UpdateLogicalDatabase"), - // OperationFriendlyName: to.Ptr("ALTER DATABASE"), - // PercentComplete: to.Ptr[int32](100), - // ServerName: to.Ptr("sqlcrudtest-4645"), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-06-01T09:10:08.1Z"); return t}()), - // State: to.Ptr(armsql.ManagementOperationStateSucceeded), - // }, - // }, - // { - // Name: to.Ptr("55555555-5555-5555-5555-555555555555"), - // Type: to.Ptr("Microsoft.Sql/servers/databases/operations"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/sqlcrudtest-7398/providers/Microsoft.Sql/servers/sqlcrudtest-4645/databases/testdb/operations/55555555-5555-5555-5555-555555555555"), - // Properties: &armsql.DatabaseOperationProperties{ - // DatabaseName: to.Ptr("testdb"), - // Operation: to.Ptr("UpdateLogicalDatabase"), - // OperationFriendlyName: to.Ptr("ALTER DATABASE"), - // PercentComplete: to.Ptr[int32](19), - // ServerName: to.Ptr("sqlcrudtest-4645"), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-06-01T10:10:08.1Z"); return t}()), - // State: to.Ptr(armsql.ManagementOperationStateInProgress), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/sql/armsql/databaserecommendedactions_client.go b/sdk/resourcemanager/sql/armsql/databaserecommendedactions_client.go index b387e0fee677..32f516c2d484 100644 --- a/sdk/resourcemanager/sql/armsql/databaserecommendedactions_client.go +++ b/sdk/resourcemanager/sql/armsql/databaserecommendedactions_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armsql @@ -47,7 +46,7 @@ func NewDatabaseRecommendedActionsClient(subscriptionID string, credential azcor // Get - Gets a database recommended action. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -57,18 +56,21 @@ func NewDatabaseRecommendedActionsClient(subscriptionID string, credential azcor // - options - DatabaseRecommendedActionsClientGetOptions contains the optional parameters for the DatabaseRecommendedActionsClient.Get // method. func (client *DatabaseRecommendedActionsClient) Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string, advisorName string, recommendedActionName string, options *DatabaseRecommendedActionsClientGetOptions) (DatabaseRecommendedActionsClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, serverName, databaseName, advisorName, recommendedActionName, options) if err != nil { return DatabaseRecommendedActionsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return DatabaseRecommendedActionsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return DatabaseRecommendedActionsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DatabaseRecommendedActionsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -103,7 +105,7 @@ func (client *DatabaseRecommendedActionsClient) getCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -121,7 +123,7 @@ func (client *DatabaseRecommendedActionsClient) getHandleResponse(resp *http.Res // ListByDatabaseAdvisor - Gets list of Database Recommended Actions. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -130,18 +132,21 @@ func (client *DatabaseRecommendedActionsClient) getHandleResponse(resp *http.Res // - options - DatabaseRecommendedActionsClientListByDatabaseAdvisorOptions contains the optional parameters for the DatabaseRecommendedActionsClient.ListByDatabaseAdvisor // method. func (client *DatabaseRecommendedActionsClient) ListByDatabaseAdvisor(ctx context.Context, resourceGroupName string, serverName string, databaseName string, advisorName string, options *DatabaseRecommendedActionsClientListByDatabaseAdvisorOptions) (DatabaseRecommendedActionsClientListByDatabaseAdvisorResponse, error) { + var err error req, err := client.listByDatabaseAdvisorCreateRequest(ctx, resourceGroupName, serverName, databaseName, advisorName, options) if err != nil { return DatabaseRecommendedActionsClientListByDatabaseAdvisorResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return DatabaseRecommendedActionsClientListByDatabaseAdvisorResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return DatabaseRecommendedActionsClientListByDatabaseAdvisorResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DatabaseRecommendedActionsClientListByDatabaseAdvisorResponse{}, err } - return client.listByDatabaseAdvisorHandleResponse(resp) + resp, err := client.listByDatabaseAdvisorHandleResponse(httpResp) + return resp, err } // listByDatabaseAdvisorCreateRequest creates the ListByDatabaseAdvisor request. @@ -172,7 +177,7 @@ func (client *DatabaseRecommendedActionsClient) listByDatabaseAdvisorCreateReque return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -190,7 +195,7 @@ func (client *DatabaseRecommendedActionsClient) listByDatabaseAdvisorHandleRespo // Update - Updates a database recommended action. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -201,18 +206,21 @@ func (client *DatabaseRecommendedActionsClient) listByDatabaseAdvisorHandleRespo // - options - DatabaseRecommendedActionsClientUpdateOptions contains the optional parameters for the DatabaseRecommendedActionsClient.Update // method. func (client *DatabaseRecommendedActionsClient) Update(ctx context.Context, resourceGroupName string, serverName string, databaseName string, advisorName string, recommendedActionName string, parameters RecommendedAction, options *DatabaseRecommendedActionsClientUpdateOptions) (DatabaseRecommendedActionsClientUpdateResponse, error) { + var err error req, err := client.updateCreateRequest(ctx, resourceGroupName, serverName, databaseName, advisorName, recommendedActionName, parameters, options) if err != nil { return DatabaseRecommendedActionsClientUpdateResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return DatabaseRecommendedActionsClientUpdateResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return DatabaseRecommendedActionsClientUpdateResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DatabaseRecommendedActionsClientUpdateResponse{}, err } - return client.updateHandleResponse(resp) + resp, err := client.updateHandleResponse(httpResp) + return resp, err } // updateCreateRequest creates the Update request. @@ -247,10 +255,13 @@ func (client *DatabaseRecommendedActionsClient) updateCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // updateHandleResponse handles the Update response. diff --git a/sdk/resourcemanager/sql/armsql/databaserecommendedactions_client_example_test.go b/sdk/resourcemanager/sql/armsql/databaserecommendedactions_client_example_test.go deleted file mode 100644 index 085fd0367146..000000000000 --- a/sdk/resourcemanager/sql/armsql/databaserecommendedactions_client_example_test.go +++ /dev/null @@ -1,372 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsql_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sql/armsql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseRecommendedActionList.json -func ExampleDatabaseRecommendedActionsClient_ListByDatabaseAdvisor() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDatabaseRecommendedActionsClient().ListByDatabaseAdvisor(ctx, "workloadinsight-demos", "misosisvr", "IndexAdvisor_test_3", "CreateIndex", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RecommendedActionArray = []*armsql.RecommendedAction{ - // { - // Name: to.Ptr("IR_[CRM]_[DataPoints]_4821CD2F9510D98184BB"), - // Type: to.Ptr("Microsoft.Sql/servers/databases/advisors/recommendedActions"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/workloadinsight-demos/providers/Microsoft.Sql/servers/misosisvr/databases/IndexAdvisor_test_3/advisors/CreateIndex/recommendedActions/IR_[CRM]_[DataPoints]_4821CD2F9510D98184BB"), - // Kind: to.Ptr(""), - // Location: to.Ptr("East Asia"), - // Properties: &armsql.RecommendedActionProperties{ - // ErrorDetails: &armsql.RecommendedActionErrorInfo{ - // }, - // EstimatedImpact: []*armsql.RecommendedActionImpactRecord{ - // { - // AbsoluteValue: to.Ptr[float64](1440), - // DimensionName: to.Ptr("ActionDuration"), - // Unit: to.Ptr("Seconds"), - // }, - // { - // AbsoluteValue: to.Ptr[float64](209.3125), - // DimensionName: to.Ptr("SpaceChange"), - // Unit: to.Ptr("Megabytes"), - // }}, - // ImplementationDetails: &armsql.RecommendedActionImplementationInfo{ - // Method: to.Ptr(armsql.ImplementationMethodTSQL), - // Script: to.Ptr("CREATE NONCLUSTERED INDEX [nci_wi_DataPoints_B892614093BAC56295EF6018BD4CB51B] ON [CRM].[DataPoints] ([Name],[Money],[Power]) INCLUDE ([Hour], [System], [LastChanged]) WITH (ONLINE = ON)"), - // }, - // IsArchivedAction: to.Ptr(false), - // IsExecutableAction: to.Ptr(true), - // IsRevertableAction: to.Ptr(true), - // LastRefresh: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-03-01T14:38:04Z"); return t}()), - // ObservedImpact: []*armsql.RecommendedActionImpactRecord{ - // }, - // RecommendationReason: to.Ptr(""), - // Score: to.Ptr[int32](1), - // State: &armsql.RecommendedActionStateInfo{ - // CurrentValue: to.Ptr(armsql.RecommendedActionCurrentStateActive), - // LastModified: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-03-01T14:38:05Z"); return t}()), - // }, - // TimeSeries: []*armsql.RecommendedActionMetricInfo{ - // }, - // ValidSince: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-03-01T14:38:04Z"); return t}()), - // Details: map[string]any{ - // "schema": "[CRM]", - // "includedColumns": "[Hour], [System], [LastChanged]", - // "indexColumns": "[Name],[Money],[Power]", - // "indexName": "nci_wi_DataPoints_B892614093BAC56295EF6018BD4CB51B", - // "indexType": "NONCLUSTERED", - // "table": "[DataPoints]", - // }, - // }, - // }, - // { - // Name: to.Ptr("IR_[dbo]_[DataPoints]_F5D2F347AA22DB46E4CC"), - // Type: to.Ptr("Microsoft.Sql/servers/databases/advisors/recommendedActions"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/workloadinsight-demos/providers/Microsoft.Sql/servers/misosisvr/databases/IndexAdvisor_test_3/advisors/CreateIndex/recommendedActions/IR_[dbo]_[DataPoints]_F5D2F347AA22DB46E4CC"), - // Kind: to.Ptr(""), - // Location: to.Ptr("East Asia"), - // Properties: &armsql.RecommendedActionProperties{ - // ErrorDetails: &armsql.RecommendedActionErrorInfo{ - // }, - // EstimatedImpact: []*armsql.RecommendedActionImpactRecord{ - // { - // AbsoluteValue: to.Ptr[float64](5040), - // DimensionName: to.Ptr("ActionDuration"), - // Unit: to.Ptr("Seconds"), - // }, - // { - // AbsoluteValue: to.Ptr[float64](120), - // DimensionName: to.Ptr("SpaceChange"), - // Unit: to.Ptr("Megabytes"), - // }}, - // ExecuteActionDuration: to.Ptr("PT1M"), - // ExecuteActionInitiatedBy: to.Ptr(armsql.RecommendedActionInitiatedByUser), - // ExecuteActionInitiatedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-03-01T14:38:05Z"); return t}()), - // ExecuteActionStartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-03-01T14:38:05Z"); return t}()), - // ImplementationDetails: &armsql.RecommendedActionImplementationInfo{ - // Method: to.Ptr(armsql.ImplementationMethodTSQL), - // Script: to.Ptr("DROP INDEX [nci_wi_DataPoints_609E4B7D6A3813990ED44B28B340C8FC] ON [dbo].[DataPoints]"), - // }, - // IsArchivedAction: to.Ptr(false), - // IsExecutableAction: to.Ptr(true), - // IsRevertableAction: to.Ptr(true), - // LastRefresh: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-03-01T14:38:05Z"); return t}()), - // ObservedImpact: []*armsql.RecommendedActionImpactRecord{ - // { - // ChangeValueAbsolute: to.Ptr[float64](-12.7), - // ChangeValueRelative: to.Ptr[float64](-0.9), - // DimensionName: to.Ptr("AffectedQueriesCpuUtilization"), - // Unit: to.Ptr("CpuCores"), - // }, - // { - // ChangeValueAbsolute: to.Ptr[float64](-12.7), - // ChangeValueRelative: to.Ptr[float64](-0.3175), - // DimensionName: to.Ptr("CpuUtilization"), - // Unit: to.Ptr("CpuCores"), - // }, - // { - // AbsoluteValue: to.Ptr[float64](12), - // DimensionName: to.Ptr("QueriesWithImprovedPerformance"), - // Unit: to.Ptr("Count"), - // }, - // { - // AbsoluteValue: to.Ptr[float64](1), - // DimensionName: to.Ptr("QueriesWithRegressedPerformance"), - // Unit: to.Ptr("Count"), - // }, - // { - // AbsoluteValue: to.Ptr[float64](130.742187), - // DimensionName: to.Ptr("SpaceChange"), - // Unit: to.Ptr("Megabytes"), - // }, - // { - // AbsoluteValue: to.Ptr[float64](0), - // DimensionName: to.Ptr("VerificationProgress"), - // Unit: to.Ptr("Percent"), - // }}, - // RecommendationReason: to.Ptr(""), - // Score: to.Ptr[int32](3), - // State: &armsql.RecommendedActionStateInfo{ - // ActionInitiatedBy: to.Ptr(armsql.RecommendedActionInitiatedByUser), - // CurrentValue: to.Ptr(armsql.RecommendedActionCurrentStateSuccess), - // LastModified: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-03-01T14:38:05Z"); return t}()), - // }, - // TimeSeries: []*armsql.RecommendedActionMetricInfo{ - // }, - // ValidSince: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-03-01T14:38:05Z"); return t}()), - // Details: map[string]any{ - // "schema": "[dbo]", - // "includedColumns": "[Power],[Pineapple]", - // "indexActionDuration": "00:01:00", - // "indexActionStartTime": "2017-03-01T14:38:05.337", - // "indexColumns": "[Name],[Money]", - // "indexName": "nci_wi_DataPoints_609E4B7D6A3813990ED44B28B340C8FC", - // "indexType": "NONCLUSTERED", - // "table": "[DataPoints]", - // }, - // }, - // }, - // { - // Name: to.Ptr("IR_[dbo]_[Employees]_560E15A98D14CA09BDFB"), - // Type: to.Ptr("Microsoft.Sql/servers/databases/advisors/recommendedActions"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/workloadinsight-demos/providers/Microsoft.Sql/servers/misosisvr/databases/IndexAdvisor_test_3/advisors/CreateIndex/recommendedActions/IR_[dbo]_[Employees]_560E15A98D14CA09BDFB"), - // Kind: to.Ptr(""), - // Location: to.Ptr("East Asia"), - // Properties: &armsql.RecommendedActionProperties{ - // ErrorDetails: &armsql.RecommendedActionErrorInfo{ - // }, - // EstimatedImpact: []*armsql.RecommendedActionImpactRecord{ - // { - // AbsoluteValue: to.Ptr[float64](17), - // DimensionName: to.Ptr("ActionDuration"), - // Unit: to.Ptr("Seconds"), - // }, - // { - // AbsoluteValue: to.Ptr[float64](128), - // DimensionName: to.Ptr("SpaceChange"), - // Unit: to.Ptr("Megabytes"), - // }}, - // ImplementationDetails: &armsql.RecommendedActionImplementationInfo{ - // Method: to.Ptr(armsql.ImplementationMethodTSQL), - // Script: to.Ptr("CREATE NONCLUSTERED INDEX [nci_wi_Employees_8C18C2AF4267DC77793040782641CCDE] ON [dbo].[Employees] ([City], [State]) INCLUDE ([Postal]) WITH (ONLINE = ON)"), - // }, - // IsArchivedAction: to.Ptr(false), - // IsExecutableAction: to.Ptr(true), - // IsRevertableAction: to.Ptr(true), - // LastRefresh: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-03-01T14:38:05Z"); return t}()), - // ObservedImpact: []*armsql.RecommendedActionImpactRecord{ - // }, - // RecommendationReason: to.Ptr(""), - // Score: to.Ptr[int32](3), - // State: &armsql.RecommendedActionStateInfo{ - // CurrentValue: to.Ptr(armsql.RecommendedActionCurrentStateActive), - // LastModified: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-03-01T14:38:05Z"); return t}()), - // }, - // TimeSeries: []*armsql.RecommendedActionMetricInfo{ - // }, - // ValidSince: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-03-01T14:38:05Z"); return t}()), - // Details: map[string]any{ - // "schema": "[dbo]", - // "includedColumns": "[Postal]", - // "indexColumns": "[City], [State]", - // "indexName": "nci_wi_Employees_8C18C2AF4267DC77793040782641CCDE", - // "indexType": "NONCLUSTERED", - // "table": "[Employees]", - // }, - // }, - // }} -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseRecommendedActionGet.json -func ExampleDatabaseRecommendedActionsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDatabaseRecommendedActionsClient().Get(ctx, "workloadinsight-demos", "misosisvr", "IndexAdvisor_test_3", "CreateIndex", "IR_[CRM]_[DataPoints]_4821CD2F9510D98184BB", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RecommendedAction = armsql.RecommendedAction{ - // Name: to.Ptr("IR_[CRM]_[DataPoints]_4821CD2F9510D98184BB"), - // Type: to.Ptr("Microsoft.Sql/servers/databases/advisors/recommendedActions"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/workloadinsight-demos/providers/Microsoft.Sql/servers/misosisvr/databases/IndexAdvisor_test_3/advisors/CreateIndex/recommendedActions/IR_[CRM]_[DataPoints]_4821CD2F9510D98184BB"), - // Kind: to.Ptr(""), - // Location: to.Ptr("East Asia"), - // Properties: &armsql.RecommendedActionProperties{ - // ErrorDetails: &armsql.RecommendedActionErrorInfo{ - // }, - // EstimatedImpact: []*armsql.RecommendedActionImpactRecord{ - // { - // AbsoluteValue: to.Ptr[float64](1440), - // DimensionName: to.Ptr("ActionDuration"), - // Unit: to.Ptr("Seconds"), - // }, - // { - // AbsoluteValue: to.Ptr[float64](209.3125), - // DimensionName: to.Ptr("SpaceChange"), - // Unit: to.Ptr("Megabytes"), - // }}, - // ImplementationDetails: &armsql.RecommendedActionImplementationInfo{ - // Method: to.Ptr(armsql.ImplementationMethodTSQL), - // Script: to.Ptr("CREATE NONCLUSTERED INDEX [nci_wi_DataPoints_B892614093BAC56295EF6018BD4CB51B] ON [CRM].[DataPoints] ([Name],[Money],[Power]) INCLUDE ([Hour], [System], [LastChanged]) WITH (ONLINE = ON)"), - // }, - // IsArchivedAction: to.Ptr(false), - // IsExecutableAction: to.Ptr(true), - // IsRevertableAction: to.Ptr(true), - // LastRefresh: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-03-01T14:38:04Z"); return t}()), - // ObservedImpact: []*armsql.RecommendedActionImpactRecord{ - // }, - // RecommendationReason: to.Ptr(""), - // Score: to.Ptr[int32](1), - // State: &armsql.RecommendedActionStateInfo{ - // CurrentValue: to.Ptr(armsql.RecommendedActionCurrentStateActive), - // LastModified: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-03-01T14:38:05Z"); return t}()), - // }, - // TimeSeries: []*armsql.RecommendedActionMetricInfo{ - // }, - // ValidSince: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-03-01T14:38:04Z"); return t}()), - // Details: map[string]any{ - // "schema": "[CRM]", - // "includedColumns": "[Hour], [System], [LastChanged]", - // "indexColumns": "[Name],[Money],[Power]", - // "indexName": "nci_wi_DataPoints_B892614093BAC56295EF6018BD4CB51B", - // "indexType": "NONCLUSTERED", - // "table": "[DataPoints]", - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseRecommendedActionUpdate.json -func ExampleDatabaseRecommendedActionsClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDatabaseRecommendedActionsClient().Update(ctx, "workloadinsight-demos", "misosisvr", "IndexAdvisor_test_3", "CreateIndex", "IR_[CRM]_[DataPoints]_4821CD2F9510D98184BB", armsql.RecommendedAction{ - Properties: &armsql.RecommendedActionProperties{ - State: &armsql.RecommendedActionStateInfo{ - CurrentValue: to.Ptr(armsql.RecommendedActionCurrentStatePending), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RecommendedAction = armsql.RecommendedAction{ - // Name: to.Ptr("IR_[CRM]_[DataPoints]_4821CD2F9510D98184BB"), - // Type: to.Ptr("Microsoft.Sql/servers/databases/advisors/recommendedActions"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/workloadinsight-demos/providers/Microsoft.Sql/servers/misosisvr/databases/IndexAdvisor_test_3/advisors/CreateIndex/recommendedActions/IR_[CRM]_[DataPoints]_4821CD2F9510D98184BB"), - // Kind: to.Ptr(""), - // Location: to.Ptr("East Asia"), - // Properties: &armsql.RecommendedActionProperties{ - // ErrorDetails: &armsql.RecommendedActionErrorInfo{ - // }, - // EstimatedImpact: []*armsql.RecommendedActionImpactRecord{ - // { - // AbsoluteValue: to.Ptr[float64](1440), - // DimensionName: to.Ptr("ActionDuration"), - // Unit: to.Ptr("Seconds"), - // }, - // { - // AbsoluteValue: to.Ptr[float64](209.3125), - // DimensionName: to.Ptr("SpaceChange"), - // Unit: to.Ptr("Megabytes"), - // }}, - // ExecuteActionInitiatedBy: to.Ptr(armsql.RecommendedActionInitiatedByUser), - // ExecuteActionInitiatedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-06-20T15:11:15Z"); return t}()), - // ImplementationDetails: &armsql.RecommendedActionImplementationInfo{ - // Method: to.Ptr(armsql.ImplementationMethodTSQL), - // Script: to.Ptr("CREATE NONCLUSTERED INDEX [nci_wi_DataPoints_B892614093BAC56295EF6018BD4CB51B] ON [CRM].[DataPoints] ([Name],[Money],[Power]) INCLUDE ([Hour], [System], [LastChanged]) WITH (ONLINE = ON)"), - // }, - // IsArchivedAction: to.Ptr(false), - // IsExecutableAction: to.Ptr(true), - // IsRevertableAction: to.Ptr(true), - // LastRefresh: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-03-01T14:38:04Z"); return t}()), - // ObservedImpact: []*armsql.RecommendedActionImpactRecord{ - // }, - // RecommendationReason: to.Ptr(""), - // Score: to.Ptr[int32](1), - // State: &armsql.RecommendedActionStateInfo{ - // ActionInitiatedBy: to.Ptr(armsql.RecommendedActionInitiatedByUser), - // CurrentValue: to.Ptr(armsql.RecommendedActionCurrentStatePending), - // LastModified: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-06-20T15:11:15Z"); return t}()), - // }, - // TimeSeries: []*armsql.RecommendedActionMetricInfo{ - // }, - // ValidSince: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-03-01T14:38:04Z"); return t}()), - // Details: map[string]any{ - // "schema": "[CRM]", - // "includedColumns": "[Hour], [System], [LastChanged]", - // "indexColumns": "[Name],[Money],[Power]", - // "indexName": "nci_wi_DataPoints_B892614093BAC56295EF6018BD4CB51B", - // "indexType": "NONCLUSTERED", - // "table": "[DataPoints]", - // }, - // }, - // } -} diff --git a/sdk/resourcemanager/sql/armsql/databases_client.go b/sdk/resourcemanager/sql/armsql/databases_client.go index 0bb66bd3a0ed..24039dcc6862 100644 --- a/sdk/resourcemanager/sql/armsql/databases_client.go +++ b/sdk/resourcemanager/sql/armsql/databases_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armsql @@ -47,7 +46,7 @@ func NewDatabasesClient(subscriptionID string, credential azcore.TokenCredential // BeginCreateOrUpdate - Creates a new database or updates an existing database. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-05-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -61,7 +60,10 @@ func (client *DatabasesClient) BeginCreateOrUpdate(ctx context.Context, resource if err != nil { return nil, err } - return runtime.NewPoller[DatabasesClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DatabasesClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + return poller, err } else { return runtime.NewPollerFromResumeToken[DatabasesClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -70,20 +72,22 @@ func (client *DatabasesClient) BeginCreateOrUpdate(ctx context.Context, resource // CreateOrUpdate - Creates a new database or updates an existing database. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-05-01-preview +// Generated from API version 2022-11-01-preview func (client *DatabasesClient) createOrUpdate(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters Database, options *DatabasesClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, serverName, databaseName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createOrUpdateCreateRequest creates the CreateOrUpdate request. @@ -110,16 +114,19 @@ func (client *DatabasesClient) createOrUpdateCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-05-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // BeginDelete - Deletes the database. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-05-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -131,7 +138,10 @@ func (client *DatabasesClient) BeginDelete(ctx context.Context, resourceGroupNam if err != nil { return nil, err } - return runtime.NewPoller[DatabasesClientDeleteResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DatabasesClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err } else { return runtime.NewPollerFromResumeToken[DatabasesClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -140,20 +150,22 @@ func (client *DatabasesClient) BeginDelete(ctx context.Context, resourceGroupNam // Delete - Deletes the database. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-05-01-preview +// Generated from API version 2022-11-01-preview func (client *DatabasesClient) deleteOperation(ctx context.Context, resourceGroupName string, serverName string, databaseName string, options *DatabasesClientBeginDeleteOptions) (*http.Response, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, serverName, databaseName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteCreateRequest creates the Delete request. @@ -180,7 +192,7 @@ func (client *DatabasesClient) deleteCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-05-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -188,7 +200,7 @@ func (client *DatabasesClient) deleteCreateRequest(ctx context.Context, resource // BeginExport - Exports a database. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-05-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -201,7 +213,8 @@ func (client *DatabasesClient) BeginExport(ctx context.Context, resourceGroupNam if err != nil { return nil, err } - return runtime.NewPoller[DatabasesClientExportResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[DatabasesClientExportResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[DatabasesClientExportResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -210,20 +223,22 @@ func (client *DatabasesClient) BeginExport(ctx context.Context, resourceGroupNam // Export - Exports a database. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-05-01-preview +// Generated from API version 2022-11-01-preview func (client *DatabasesClient) export(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters ExportDatabaseDefinition, options *DatabasesClientBeginExportOptions) (*http.Response, error) { + var err error req, err := client.exportCreateRequest(ctx, resourceGroupName, serverName, databaseName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // exportCreateRequest creates the Export request. @@ -250,16 +265,19 @@ func (client *DatabasesClient) exportCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-05-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // BeginFailover - Failovers a database. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-05-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -271,7 +289,8 @@ func (client *DatabasesClient) BeginFailover(ctx context.Context, resourceGroupN if err != nil { return nil, err } - return runtime.NewPoller[DatabasesClientFailoverResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[DatabasesClientFailoverResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[DatabasesClientFailoverResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -280,20 +299,22 @@ func (client *DatabasesClient) BeginFailover(ctx context.Context, resourceGroupN // Failover - Failovers a database. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-05-01-preview +// Generated from API version 2022-11-01-preview func (client *DatabasesClient) failover(ctx context.Context, resourceGroupName string, serverName string, databaseName string, options *DatabasesClientBeginFailoverOptions) (*http.Response, error) { + var err error req, err := client.failoverCreateRequest(ctx, resourceGroupName, serverName, databaseName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // failoverCreateRequest creates the Failover request. @@ -323,7 +344,7 @@ func (client *DatabasesClient) failoverCreateRequest(ctx context.Context, resour if options != nil && options.ReplicaType != nil { reqQP.Set("replicaType", string(*options.ReplicaType)) } - reqQP.Set("api-version", "2021-05-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -331,25 +352,28 @@ func (client *DatabasesClient) failoverCreateRequest(ctx context.Context, resour // Get - Gets a database. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-05-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. // - databaseName - The name of the database. // - options - DatabasesClientGetOptions contains the optional parameters for the DatabasesClient.Get method. func (client *DatabasesClient) Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string, options *DatabasesClientGetOptions) (DatabasesClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, serverName, databaseName, options) if err != nil { return DatabasesClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return DatabasesClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return DatabasesClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DatabasesClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -376,7 +400,13 @@ func (client *DatabasesClient) getCreateRequest(ctx context.Context, resourceGro return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-05-01-preview") + if options != nil && options.Expand != nil { + reqQP.Set("$expand", *options.Expand) + } + if options != nil && options.Filter != nil { + reqQP.Set("$filter", *options.Filter) + } + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -394,7 +424,7 @@ func (client *DatabasesClient) getHandleResponse(resp *http.Response) (Databases // BeginImport - Imports a bacpac into a new database. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-05-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -407,7 +437,8 @@ func (client *DatabasesClient) BeginImport(ctx context.Context, resourceGroupNam if err != nil { return nil, err } - return runtime.NewPoller[DatabasesClientImportResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[DatabasesClientImportResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[DatabasesClientImportResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -416,20 +447,22 @@ func (client *DatabasesClient) BeginImport(ctx context.Context, resourceGroupNam // Import - Imports a bacpac into a new database. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-05-01-preview +// Generated from API version 2022-11-01-preview func (client *DatabasesClient) importOperation(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters ImportExistingDatabaseDefinition, options *DatabasesClientBeginImportOptions) (*http.Response, error) { + var err error req, err := client.importCreateRequest(ctx, resourceGroupName, serverName, databaseName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // importCreateRequest creates the Import request. @@ -456,15 +489,18 @@ func (client *DatabasesClient) importCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-05-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // NewListByElasticPoolPager - Gets a list of databases in an elastic pool. // -// Generated from API version 2021-05-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -523,7 +559,7 @@ func (client *DatabasesClient) listByElasticPoolCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-05-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -540,7 +576,7 @@ func (client *DatabasesClient) listByElasticPoolHandleResponse(resp *http.Respon // NewListByServerPager - Gets a list of databases. // -// Generated from API version 2021-05-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -597,7 +633,7 @@ func (client *DatabasesClient) listByServerCreateRequest(ctx context.Context, re if options != nil && options.SkipToken != nil { reqQP.Set("$skipToken", *options.SkipToken) } - reqQP.Set("api-version", "2021-05-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -614,7 +650,7 @@ func (client *DatabasesClient) listByServerHandleResponse(resp *http.Response) ( // NewListInaccessibleByServerPager - Gets a list of inaccessible databases in a logical server // -// Generated from API version 2021-05-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -668,7 +704,7 @@ func (client *DatabasesClient) listInaccessibleByServerCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-05-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -683,152 +719,10 @@ func (client *DatabasesClient) listInaccessibleByServerHandleResponse(resp *http return result, nil } -// NewListMetricDefinitionsPager - Returns database metric definitions. -// -// Generated from API version 2014-04-01 -// - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure -// Resource Manager API or the portal. -// - serverName - The name of the server. -// - databaseName - The name of the database. -// - options - DatabasesClientListMetricDefinitionsOptions contains the optional parameters for the DatabasesClient.NewListMetricDefinitionsPager -// method. -func (client *DatabasesClient) NewListMetricDefinitionsPager(resourceGroupName string, serverName string, databaseName string, options *DatabasesClientListMetricDefinitionsOptions) *runtime.Pager[DatabasesClientListMetricDefinitionsResponse] { - return runtime.NewPager(runtime.PagingHandler[DatabasesClientListMetricDefinitionsResponse]{ - More: func(page DatabasesClientListMetricDefinitionsResponse) bool { - return false - }, - Fetcher: func(ctx context.Context, page *DatabasesClientListMetricDefinitionsResponse) (DatabasesClientListMetricDefinitionsResponse, error) { - req, err := client.listMetricDefinitionsCreateRequest(ctx, resourceGroupName, serverName, databaseName, options) - if err != nil { - return DatabasesClientListMetricDefinitionsResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return DatabasesClientListMetricDefinitionsResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return DatabasesClientListMetricDefinitionsResponse{}, runtime.NewResponseError(resp) - } - return client.listMetricDefinitionsHandleResponse(resp) - }, - }) -} - -// listMetricDefinitionsCreateRequest creates the ListMetricDefinitions request. -func (client *DatabasesClient) listMetricDefinitionsCreateRequest(ctx context.Context, resourceGroupName string, serverName string, databaseName string, options *DatabasesClientListMetricDefinitionsOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/metricDefinitions" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if serverName == "" { - return nil, errors.New("parameter serverName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{serverName}", url.PathEscape(serverName)) - if databaseName == "" { - return nil, errors.New("parameter databaseName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{databaseName}", url.PathEscape(databaseName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2014-04-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listMetricDefinitionsHandleResponse handles the ListMetricDefinitions response. -func (client *DatabasesClient) listMetricDefinitionsHandleResponse(resp *http.Response) (DatabasesClientListMetricDefinitionsResponse, error) { - result := DatabasesClientListMetricDefinitionsResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.MetricDefinitionListResult); err != nil { - return DatabasesClientListMetricDefinitionsResponse{}, err - } - return result, nil -} - -// NewListMetricsPager - Returns database metrics. -// -// Generated from API version 2014-04-01 -// - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure -// Resource Manager API or the portal. -// - serverName - The name of the server. -// - databaseName - The name of the database. -// - filter - An OData filter expression that describes a subset of metrics to return. -// - options - DatabasesClientListMetricsOptions contains the optional parameters for the DatabasesClient.NewListMetricsPager -// method. -func (client *DatabasesClient) NewListMetricsPager(resourceGroupName string, serverName string, databaseName string, filter string, options *DatabasesClientListMetricsOptions) *runtime.Pager[DatabasesClientListMetricsResponse] { - return runtime.NewPager(runtime.PagingHandler[DatabasesClientListMetricsResponse]{ - More: func(page DatabasesClientListMetricsResponse) bool { - return false - }, - Fetcher: func(ctx context.Context, page *DatabasesClientListMetricsResponse) (DatabasesClientListMetricsResponse, error) { - req, err := client.listMetricsCreateRequest(ctx, resourceGroupName, serverName, databaseName, filter, options) - if err != nil { - return DatabasesClientListMetricsResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return DatabasesClientListMetricsResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return DatabasesClientListMetricsResponse{}, runtime.NewResponseError(resp) - } - return client.listMetricsHandleResponse(resp) - }, - }) -} - -// listMetricsCreateRequest creates the ListMetrics request. -func (client *DatabasesClient) listMetricsCreateRequest(ctx context.Context, resourceGroupName string, serverName string, databaseName string, filter string, options *DatabasesClientListMetricsOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/metrics" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if serverName == "" { - return nil, errors.New("parameter serverName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{serverName}", url.PathEscape(serverName)) - if databaseName == "" { - return nil, errors.New("parameter databaseName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{databaseName}", url.PathEscape(databaseName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2014-04-01") - reqQP.Set("$filter", filter) - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listMetricsHandleResponse handles the ListMetrics response. -func (client *DatabasesClient) listMetricsHandleResponse(resp *http.Response) (DatabasesClientListMetricsResponse, error) { - result := DatabasesClientListMetricsResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.MetricListResult); err != nil { - return DatabasesClientListMetricsResponse{}, err - } - return result, nil -} - // BeginPause - Pauses a database. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-05-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -840,7 +734,8 @@ func (client *DatabasesClient) BeginPause(ctx context.Context, resourceGroupName if err != nil { return nil, err } - return runtime.NewPoller[DatabasesClientPauseResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[DatabasesClientPauseResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[DatabasesClientPauseResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -849,20 +744,22 @@ func (client *DatabasesClient) BeginPause(ctx context.Context, resourceGroupName // Pause - Pauses a database. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-05-01-preview +// Generated from API version 2022-11-01-preview func (client *DatabasesClient) pause(ctx context.Context, resourceGroupName string, serverName string, databaseName string, options *DatabasesClientBeginPauseOptions) (*http.Response, error) { + var err error req, err := client.pauseCreateRequest(ctx, resourceGroupName, serverName, databaseName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // pauseCreateRequest creates the Pause request. @@ -889,7 +786,7 @@ func (client *DatabasesClient) pauseCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-05-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -898,7 +795,7 @@ func (client *DatabasesClient) pauseCreateRequest(ctx context.Context, resourceG // Rename - Renames a database. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-05-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -906,16 +803,18 @@ func (client *DatabasesClient) pauseCreateRequest(ctx context.Context, resourceG // - parameters - The resource move definition for renaming this database. // - options - DatabasesClientRenameOptions contains the optional parameters for the DatabasesClient.Rename method. func (client *DatabasesClient) Rename(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters ResourceMoveDefinition, options *DatabasesClientRenameOptions) (DatabasesClientRenameResponse, error) { + var err error req, err := client.renameCreateRequest(ctx, resourceGroupName, serverName, databaseName, parameters, options) if err != nil { return DatabasesClientRenameResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return DatabasesClientRenameResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return DatabasesClientRenameResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DatabasesClientRenameResponse{}, err } return DatabasesClientRenameResponse{}, nil } @@ -944,15 +843,18 @@ func (client *DatabasesClient) renameCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-05-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // BeginResume - Resumes a database. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-05-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -964,7 +866,8 @@ func (client *DatabasesClient) BeginResume(ctx context.Context, resourceGroupNam if err != nil { return nil, err } - return runtime.NewPoller[DatabasesClientResumeResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[DatabasesClientResumeResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[DatabasesClientResumeResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -973,20 +876,22 @@ func (client *DatabasesClient) BeginResume(ctx context.Context, resourceGroupNam // Resume - Resumes a database. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-05-01-preview +// Generated from API version 2022-11-01-preview func (client *DatabasesClient) resume(ctx context.Context, resourceGroupName string, serverName string, databaseName string, options *DatabasesClientBeginResumeOptions) (*http.Response, error) { + var err error req, err := client.resumeCreateRequest(ctx, resourceGroupName, serverName, databaseName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // resumeCreateRequest creates the Resume request. @@ -1013,7 +918,7 @@ func (client *DatabasesClient) resumeCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-05-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -1022,7 +927,7 @@ func (client *DatabasesClient) resumeCreateRequest(ctx context.Context, resource // BeginUpdate - Updates an existing database. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-05-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -1035,7 +940,10 @@ func (client *DatabasesClient) BeginUpdate(ctx context.Context, resourceGroupNam if err != nil { return nil, err } - return runtime.NewPoller[DatabasesClientUpdateResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DatabasesClientUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err } else { return runtime.NewPollerFromResumeToken[DatabasesClientUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -1044,20 +952,22 @@ func (client *DatabasesClient) BeginUpdate(ctx context.Context, resourceGroupNam // Update - Updates an existing database. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-05-01-preview +// Generated from API version 2022-11-01-preview func (client *DatabasesClient) update(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters DatabaseUpdate, options *DatabasesClientBeginUpdateOptions) (*http.Response, error) { + var err error req, err := client.updateCreateRequest(ctx, resourceGroupName, serverName, databaseName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // updateCreateRequest creates the Update request. @@ -1084,16 +994,19 @@ func (client *DatabasesClient) updateCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-05-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // BeginUpgradeDataWarehouse - Upgrades a data warehouse. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-05-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -1106,7 +1019,8 @@ func (client *DatabasesClient) BeginUpgradeDataWarehouse(ctx context.Context, re if err != nil { return nil, err } - return runtime.NewPoller[DatabasesClientUpgradeDataWarehouseResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[DatabasesClientUpgradeDataWarehouseResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[DatabasesClientUpgradeDataWarehouseResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -1115,20 +1029,22 @@ func (client *DatabasesClient) BeginUpgradeDataWarehouse(ctx context.Context, re // UpgradeDataWarehouse - Upgrades a data warehouse. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-05-01-preview +// Generated from API version 2022-11-01-preview func (client *DatabasesClient) upgradeDataWarehouse(ctx context.Context, resourceGroupName string, serverName string, databaseName string, options *DatabasesClientBeginUpgradeDataWarehouseOptions) (*http.Response, error) { + var err error req, err := client.upgradeDataWarehouseCreateRequest(ctx, resourceGroupName, serverName, databaseName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // upgradeDataWarehouseCreateRequest creates the UpgradeDataWarehouse request. @@ -1155,7 +1071,7 @@ func (client *DatabasesClient) upgradeDataWarehouseCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-05-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } diff --git a/sdk/resourcemanager/sql/armsql/databases_client_example_test.go b/sdk/resourcemanager/sql/armsql/databases_client_example_test.go deleted file mode 100644 index 55ad192566c6..000000000000 --- a/sdk/resourcemanager/sql/armsql/databases_client_example_test.go +++ /dev/null @@ -1,2258 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsql_test - -import ( - "context" - "log" - - "time" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sql/armsql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/stable/2014-04-01/examples/DatabaseMetricsListWithFilter.json -func ExampleDatabasesClient_NewListMetricsPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDatabasesClient().NewListMetricsPager("sqlcrudtest-6730", "sqlcrudtest-9007", "3481", "name/value eq 'cpu_percent' and timeGrain eq '00:10:00' and startTime eq '2017-06-02T18:35:00Z' and endTime eq '2017-06-02T18:55:00Z'", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.MetricListResult = armsql.MetricListResult{ - // Value: []*armsql.Metric{ - // { - // Name: &armsql.MetricName{ - // LocalizedValue: to.Ptr("CPU percentage"), - // Value: to.Ptr("cpu_percent"), - // }, - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-06-02T18:55:00Z"); return t}()), - // MetricValues: []*armsql.MetricValue{ - // { - // Average: to.Ptr[float64](0), - // Count: to.Ptr[int32](1), - // Maximum: to.Ptr[float64](0), - // Minimum: to.Ptr[float64](0), - // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-06-02T18:30:01Z"); return t}()), - // Total: to.Ptr[float64](0), - // }, - // { - // Average: to.Ptr[float64](0), - // Count: to.Ptr[int32](1), - // Maximum: to.Ptr[float64](0), - // Minimum: to.Ptr[float64](0), - // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-06-02T18:40:01Z"); return t}()), - // Total: to.Ptr[float64](0), - // }, - // { - // Average: to.Ptr[float64](0), - // Count: to.Ptr[int32](1), - // Maximum: to.Ptr[float64](0), - // Minimum: to.Ptr[float64](0), - // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-06-02T18:50:01Z"); return t}()), - // Total: to.Ptr[float64](0), - // }}, - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-06-02T18:35:00Z"); return t}()), - // TimeGrain: to.Ptr("00:10:00"), - // Unit: to.Ptr(armsql.UnitTypePercent), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/stable/2014-04-01/examples/DatabaseMetricsDefinitionsList.json -func ExampleDatabasesClient_NewListMetricDefinitionsPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDatabasesClient().NewListMetricDefinitionsPager("sqlcrudtest-6730", "sqlcrudtest-9007", "3481", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.MetricDefinitionListResult = armsql.MetricDefinitionListResult{ - // Value: []*armsql.MetricDefinition{ - // { - // Name: &armsql.MetricName{ - // LocalizedValue: to.Ptr("CPU percentage"), - // Value: to.Ptr("cpu_percent"), - // }, - // MetricAvailabilities: []*armsql.MetricAvailability{ - // { - // Retention: to.Ptr("PT1H"), - // TimeGrain: to.Ptr("PT15S"), - // }, - // { - // Retention: to.Ptr("PT1H"), - // TimeGrain: to.Ptr("PT60S"), - // }, - // { - // Retention: to.Ptr("P14D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P14D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P14D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // PrimaryAggregationType: to.Ptr(armsql.PrimaryAggregationTypeAverage), - // ResourceURI: to.Ptr("/subscriptions/b6a6e0c5-e79c-4c6d-a878-72eafbca4cf2/resourceGroups/QA/providers/Microsoft.Sql/servers/nafantest/databases/db1"), - // Unit: to.Ptr(armsql.UnitDefinitionTypePercent), - // }, - // { - // Name: &armsql.MetricName{ - // LocalizedValue: to.Ptr("Data IO percentage"), - // Value: to.Ptr("physical_data_read_percent"), - // }, - // MetricAvailabilities: []*armsql.MetricAvailability{ - // { - // Retention: to.Ptr("PT1H"), - // TimeGrain: to.Ptr("PT15S"), - // }, - // { - // Retention: to.Ptr("PT1H"), - // TimeGrain: to.Ptr("PT60S"), - // }, - // { - // Retention: to.Ptr("P14D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P14D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P14D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // PrimaryAggregationType: to.Ptr(armsql.PrimaryAggregationTypeAverage), - // ResourceURI: to.Ptr("/subscriptions/b6a6e0c5-e79c-4c6d-a878-72eafbca4cf2/resourceGroups/QA/providers/Microsoft.Sql/servers/nafantest/databases/db1"), - // Unit: to.Ptr(armsql.UnitDefinitionTypePercent), - // }, - // { - // Name: &armsql.MetricName{ - // LocalizedValue: to.Ptr("Log IO percentage"), - // Value: to.Ptr("log_write_percent"), - // }, - // MetricAvailabilities: []*armsql.MetricAvailability{ - // { - // Retention: to.Ptr("PT1H"), - // TimeGrain: to.Ptr("PT15S"), - // }, - // { - // Retention: to.Ptr("PT1H"), - // TimeGrain: to.Ptr("PT60S"), - // }, - // { - // Retention: to.Ptr("P14D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P14D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P14D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // PrimaryAggregationType: to.Ptr(armsql.PrimaryAggregationTypeAverage), - // ResourceURI: to.Ptr("/subscriptions/b6a6e0c5-e79c-4c6d-a878-72eafbca4cf2/resourceGroups/QA/providers/Microsoft.Sql/servers/nafantest/databases/db1"), - // Unit: to.Ptr(armsql.UnitDefinitionTypePercent), - // }, - // { - // Name: &armsql.MetricName{ - // LocalizedValue: to.Ptr("DTU percentage"), - // Value: to.Ptr("dtu_consumption_percent"), - // }, - // MetricAvailabilities: []*armsql.MetricAvailability{ - // { - // Retention: to.Ptr("PT1H"), - // TimeGrain: to.Ptr("PT15S"), - // }, - // { - // Retention: to.Ptr("PT1H"), - // TimeGrain: to.Ptr("PT60S"), - // }, - // { - // Retention: to.Ptr("P14D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P14D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P14D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // PrimaryAggregationType: to.Ptr(armsql.PrimaryAggregationTypeAverage), - // ResourceURI: to.Ptr("/subscriptions/b6a6e0c5-e79c-4c6d-a878-72eafbca4cf2/resourceGroups/QA/providers/Microsoft.Sql/servers/nafantest/databases/db1"), - // Unit: to.Ptr(armsql.UnitDefinitionTypePercent), - // }, - // { - // Name: &armsql.MetricName{ - // LocalizedValue: to.Ptr("Total database size"), - // Value: to.Ptr("storage"), - // }, - // MetricAvailabilities: []*armsql.MetricAvailability{ - // { - // Retention: to.Ptr("P14D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P14D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P14D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // PrimaryAggregationType: to.Ptr(armsql.PrimaryAggregationTypeMaximum), - // ResourceURI: to.Ptr("/subscriptions/b6a6e0c5-e79c-4c6d-a878-72eafbca4cf2/resourceGroups/QA/providers/Microsoft.Sql/servers/nafantest/databases/db1"), - // Unit: to.Ptr(armsql.UnitDefinitionTypeBytes), - // }, - // { - // Name: &armsql.MetricName{ - // LocalizedValue: to.Ptr("In-Memory OLTP storage percent"), - // Value: to.Ptr("xtp_storage_percent"), - // }, - // MetricAvailabilities: []*armsql.MetricAvailability{ - // { - // Retention: to.Ptr("PT1H"), - // TimeGrain: to.Ptr("PT15S"), - // }, - // { - // Retention: to.Ptr("PT1H"), - // TimeGrain: to.Ptr("PT60S"), - // }, - // { - // Retention: to.Ptr("P14D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P14D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P14D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // PrimaryAggregationType: to.Ptr(armsql.PrimaryAggregationTypeAverage), - // ResourceURI: to.Ptr("/subscriptions/b6a6e0c5-e79c-4c6d-a878-72eafbca4cf2/resourceGroups/QA/providers/Microsoft.Sql/servers/nafantest/databases/db1"), - // Unit: to.Ptr(armsql.UnitDefinitionTypePercent), - // }, - // { - // Name: &armsql.MetricName{ - // LocalizedValue: to.Ptr("Workers percentage"), - // Value: to.Ptr("workers_percent"), - // }, - // MetricAvailabilities: []*armsql.MetricAvailability{ - // { - // Retention: to.Ptr("P14D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P14D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P14D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // PrimaryAggregationType: to.Ptr(armsql.PrimaryAggregationTypeAverage), - // ResourceURI: to.Ptr("/subscriptions/b6a6e0c5-e79c-4c6d-a878-72eafbca4cf2/resourceGroups/QA/providers/Microsoft.Sql/servers/nafantest/databases/db1"), - // Unit: to.Ptr(armsql.UnitDefinitionTypePercent), - // }, - // { - // Name: &armsql.MetricName{ - // LocalizedValue: to.Ptr("Sessions percentage"), - // Value: to.Ptr("sessions_percent"), - // }, - // MetricAvailabilities: []*armsql.MetricAvailability{ - // { - // Retention: to.Ptr("P14D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P14D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P14D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // PrimaryAggregationType: to.Ptr(armsql.PrimaryAggregationTypeAverage), - // ResourceURI: to.Ptr("/subscriptions/b6a6e0c5-e79c-4c6d-a878-72eafbca4cf2/resourceGroups/QA/providers/Microsoft.Sql/servers/nafantest/databases/db1"), - // Unit: to.Ptr(armsql.UnitDefinitionTypePercent), - // }, - // { - // Name: &armsql.MetricName{ - // LocalizedValue: to.Ptr("DTU limit"), - // Value: to.Ptr("dtu_limit"), - // }, - // MetricAvailabilities: []*armsql.MetricAvailability{ - // { - // Retention: to.Ptr("P14D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P14D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P14D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // PrimaryAggregationType: to.Ptr(armsql.PrimaryAggregationTypeAverage), - // ResourceURI: to.Ptr("/subscriptions/b6a6e0c5-e79c-4c6d-a878-72eafbca4cf2/resourceGroups/QA/providers/Microsoft.Sql/servers/nafantest/databases/db1"), - // Unit: to.Ptr(armsql.UnitDefinitionTypeCount), - // }, - // { - // Name: &armsql.MetricName{ - // LocalizedValue: to.Ptr("DTU used"), - // Value: to.Ptr("dtu_used"), - // }, - // MetricAvailabilities: []*armsql.MetricAvailability{ - // { - // Retention: to.Ptr("P14D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P14D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P14D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // PrimaryAggregationType: to.Ptr(armsql.PrimaryAggregationTypeAverage), - // ResourceURI: to.Ptr("/subscriptions/b6a6e0c5-e79c-4c6d-a878-72eafbca4cf2/resourceGroups/QA/providers/Microsoft.Sql/servers/nafantest/databases/db1"), - // Unit: to.Ptr(armsql.UnitDefinitionTypeCount), - // }, - // { - // Name: &armsql.MetricName{ - // LocalizedValue: to.Ptr("Successful Connections"), - // Value: to.Ptr("connection_successful"), - // }, - // MetricAvailabilities: []*armsql.MetricAvailability{ - // { - // Retention: to.Ptr("P14D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P14D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P14D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // PrimaryAggregationType: to.Ptr(armsql.PrimaryAggregationTypeTotal), - // ResourceURI: to.Ptr("/subscriptions/b6a6e0c5-e79c-4c6d-a878-72eafbca4cf2/resourceGroups/QA/providers/Microsoft.Sql/servers/nafantest/databases/db1"), - // Unit: to.Ptr(armsql.UnitDefinitionTypeCount), - // }, - // { - // Name: &armsql.MetricName{ - // LocalizedValue: to.Ptr("Failed Connections"), - // Value: to.Ptr("connection_failed"), - // }, - // MetricAvailabilities: []*armsql.MetricAvailability{ - // { - // Retention: to.Ptr("P14D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P14D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P14D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // PrimaryAggregationType: to.Ptr(armsql.PrimaryAggregationTypeTotal), - // ResourceURI: to.Ptr("/subscriptions/b6a6e0c5-e79c-4c6d-a878-72eafbca4cf2/resourceGroups/QA/providers/Microsoft.Sql/servers/nafantest/databases/db1"), - // Unit: to.Ptr(armsql.UnitDefinitionTypeCount), - // }, - // { - // Name: &armsql.MetricName{ - // LocalizedValue: to.Ptr("Blocked by Firewall"), - // Value: to.Ptr("blocked_by_firewall"), - // }, - // MetricAvailabilities: []*armsql.MetricAvailability{ - // { - // Retention: to.Ptr("P14D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P14D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P14D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // PrimaryAggregationType: to.Ptr(armsql.PrimaryAggregationTypeTotal), - // ResourceURI: to.Ptr("/subscriptions/b6a6e0c5-e79c-4c6d-a878-72eafbca4cf2/resourceGroups/QA/providers/Microsoft.Sql/servers/nafantest/databases/db1"), - // Unit: to.Ptr(armsql.UnitDefinitionTypeCount), - // }, - // { - // Name: &armsql.MetricName{ - // LocalizedValue: to.Ptr("Deadlocks"), - // Value: to.Ptr("deadlock"), - // }, - // MetricAvailabilities: []*armsql.MetricAvailability{ - // { - // Retention: to.Ptr("P14D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P14D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P14D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // PrimaryAggregationType: to.Ptr(armsql.PrimaryAggregationTypeTotal), - // ResourceURI: to.Ptr("/subscriptions/b6a6e0c5-e79c-4c6d-a878-72eafbca4cf2/resourceGroups/QA/providers/Microsoft.Sql/servers/nafantest/databases/db1"), - // Unit: to.Ptr(armsql.UnitDefinitionTypeCount), - // }, - // { - // Name: &armsql.MetricName{ - // LocalizedValue: to.Ptr("Database size percentage"), - // Value: to.Ptr("storage_percent"), - // }, - // MetricAvailabilities: []*armsql.MetricAvailability{ - // { - // Retention: to.Ptr("P14D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P14D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P14D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // PrimaryAggregationType: to.Ptr(armsql.PrimaryAggregationTypeMaximum), - // ResourceURI: to.Ptr("/subscriptions/b6a6e0c5-e79c-4c6d-a878-72eafbca4cf2/resourceGroups/QA/providers/Microsoft.Sql/servers/nafantest/databases/db1"), - // Unit: to.Ptr(armsql.UnitDefinitionTypePercent), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ListVCoreDatabasesByServer.json -func ExampleDatabasesClient_NewListByServerPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDatabasesClient().NewListByServerPager("Default-SQL-SouthEastAsia", "testsvr", &armsql.DatabasesClientListByServerOptions{SkipToken: nil}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DatabaseListResult = armsql.DatabaseListResult{ - // Value: []*armsql.Database{ - // { - // Name: to.Ptr("testdb"), - // Type: to.Ptr("Microsoft.Sql/servers/databases"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/servers/testsvr/databases/testdb"), - // Location: to.Ptr("southeastasia"), - // Kind: to.Ptr("v12.0,user,vcore"), - // Properties: &armsql.DatabaseProperties{ - // CatalogCollation: to.Ptr(armsql.CatalogCollationTypeSQLLatin1GeneralCP1CIAS), - // Collation: to.Ptr("SQL_Latin1_General_CP1_CI_AS"), - // CreationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-06-07T04:41:33.937Z"); return t}()), - // CurrentBackupStorageRedundancy: to.Ptr(armsql.BackupStorageRedundancyZone), - // CurrentServiceObjectiveName: to.Ptr("BC_Gen4_2"), - // CurrentSKU: &armsql.SKU{ - // Name: to.Ptr("BC_Gen4"), - // Capacity: to.Ptr[int32](2), - // Tier: to.Ptr("BusinessCritical"), - // }, - // DatabaseID: to.Ptr("6c764297-577b-470f-9af4-96d3d41e2ba3"), - // DefaultSecondaryLocation: to.Ptr("North Europe"), - // EarliestRestoreDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-06-07T04:51:33.937Z"); return t}()), - // IsInfraEncryptionEnabled: to.Ptr(false), - // IsLedgerOn: to.Ptr(false), - // LicenseType: to.Ptr(armsql.DatabaseLicenseTypeLicenseIncluded), - // MaxLogSizeBytes: to.Ptr[int64](104857600), - // MaxSizeBytes: to.Ptr[int64](268435456000), - // ReadScale: to.Ptr(armsql.DatabaseReadScaleEnabled), - // RequestedBackupStorageRedundancy: to.Ptr(armsql.BackupStorageRedundancyZone), - // RequestedServiceObjectiveName: to.Ptr("BC_Gen4_2"), - // Status: to.Ptr(armsql.DatabaseStatusOnline), - // ZoneRedundant: to.Ptr(false), - // }, - // SKU: &armsql.SKU{ - // Name: to.Ptr("BC_Gen4"), - // Capacity: to.Ptr[int32](2), - // Tier: to.Ptr("BusinessCritical"), - // }, - // }, - // { - // Name: to.Ptr("master"), - // Type: to.Ptr("Microsoft.Sql/servers/databases"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/servers/testsvr/databases/master"), - // Location: to.Ptr("southeastasia"), - // Kind: to.Ptr("v12.0,system"), - // Properties: &armsql.DatabaseProperties{ - // CatalogCollation: to.Ptr(armsql.CatalogCollationTypeSQLLatin1GeneralCP1CIAS), - // Collation: to.Ptr("SQL_Latin1_General_CP1_CI_AS"), - // CreationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-06-07T04:23:42.537Z"); return t}()), - // CurrentBackupStorageRedundancy: to.Ptr(armsql.BackupStorageRedundancyLocal), - // CurrentServiceObjectiveName: to.Ptr("System0"), - // CurrentSKU: &armsql.SKU{ - // Name: to.Ptr("System0"), - // Capacity: to.Ptr[int32](0), - // Tier: to.Ptr("System"), - // }, - // DatabaseID: to.Ptr("e6be351f-2cc9-4604-9e52-b0b28b2710b0"), - // DefaultSecondaryLocation: to.Ptr("North Europe"), - // IsInfraEncryptionEnabled: to.Ptr(false), - // IsLedgerOn: to.Ptr(false), - // MaxSizeBytes: to.Ptr[int64](32212254720), - // ReadScale: to.Ptr(armsql.DatabaseReadScaleDisabled), - // RequestedBackupStorageRedundancy: to.Ptr(armsql.BackupStorageRedundancyLocal), - // RequestedServiceObjectiveName: to.Ptr("System0"), - // Status: to.Ptr(armsql.DatabaseStatusOnline), - // ZoneRedundant: to.Ptr(false), - // }, - // SKU: &armsql.SKU{ - // Name: to.Ptr("System0"), - // Capacity: to.Ptr[int32](0), - // Tier: to.Ptr("System"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/GetVCoreDatabase.json -func ExampleDatabasesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDatabasesClient().Get(ctx, "Default-SQL-SouthEastAsia", "testsvr", "testdb", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Database = armsql.Database{ - // Name: to.Ptr("testdb"), - // Type: to.Ptr("Microsoft.Sql/servers/databases"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/servers/testsvr/databases/testdb"), - // Location: to.Ptr("southeastasia"), - // Kind: to.Ptr("v12.0,user,vcore"), - // Properties: &armsql.DatabaseProperties{ - // CatalogCollation: to.Ptr(armsql.CatalogCollationTypeSQLLatin1GeneralCP1CIAS), - // Collation: to.Ptr("SQL_Latin1_General_CP1_CI_AS"), - // CreationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-06-07T04:41:33.937Z"); return t}()), - // CurrentBackupStorageRedundancy: to.Ptr(armsql.BackupStorageRedundancyGeo), - // CurrentServiceObjectiveName: to.Ptr("BC_Gen5_2"), - // CurrentSKU: &armsql.SKU{ - // Name: to.Ptr("BC_Gen5"), - // Capacity: to.Ptr[int32](2), - // Tier: to.Ptr("BusinessCritical"), - // }, - // DatabaseID: to.Ptr("6c764297-577b-470f-9af4-96d3d41e2ba3"), - // DefaultSecondaryLocation: to.Ptr("North Europe"), - // EarliestRestoreDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-06-07T04:51:33.937Z"); return t}()), - // IsInfraEncryptionEnabled: to.Ptr(false), - // IsLedgerOn: to.Ptr(false), - // LicenseType: to.Ptr(armsql.DatabaseLicenseTypeLicenseIncluded), - // MaintenanceConfigurationID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/providers/Microsoft.Maintenance/publicMaintenanceConfigurations/SQL_SouthEastAsia_1"), - // MaxLogSizeBytes: to.Ptr[int64](104857600), - // MaxSizeBytes: to.Ptr[int64](268435456000), - // ReadScale: to.Ptr(armsql.DatabaseReadScaleEnabled), - // RequestedBackupStorageRedundancy: to.Ptr(armsql.BackupStorageRedundancyGeo), - // RequestedServiceObjectiveName: to.Ptr("BC_Gen5_2"), - // Status: to.Ptr(armsql.DatabaseStatusOnline), - // ZoneRedundant: to.Ptr(false), - // }, - // SKU: &armsql.SKU{ - // Name: to.Ptr("BC_Gen5"), - // Capacity: to.Ptr[int32](2), - // Tier: to.Ptr("BusinessCritical"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/CreateVCoreDatabaseByServiceObjective.json -func ExampleDatabasesClient_BeginCreateOrUpdate_createsAVCoreDatabaseBySpecifyingServiceObjectiveName() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDatabasesClient().BeginCreateOrUpdate(ctx, "Default-SQL-SouthEastAsia", "testsvr", "testdb", armsql.Database{ - Location: to.Ptr("southeastasia"), - SKU: &armsql.SKU{ - Name: to.Ptr("BC"), - Capacity: to.Ptr[int32](2), - Family: to.Ptr("Gen4"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Database = armsql.Database{ - // Name: to.Ptr("testdb"), - // Type: to.Ptr("Microsoft.Sql/servers/databases"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/servers/testsvr/databases/testdb"), - // Location: to.Ptr("southeastasia"), - // Kind: to.Ptr("v12.0,user"), - // Properties: &armsql.DatabaseProperties{ - // CatalogCollation: to.Ptr(armsql.CatalogCollationTypeSQLLatin1GeneralCP1CIAS), - // Collation: to.Ptr("SQL_Latin1_General_CP1_CI_AS"), - // CreationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-06-07T04:41:33.937Z"); return t}()), - // CurrentBackupStorageRedundancy: to.Ptr(armsql.BackupStorageRedundancyGeo), - // CurrentServiceObjectiveName: to.Ptr("BC_Gen4_2"), - // CurrentSKU: &armsql.SKU{ - // Name: to.Ptr("BC_Gen4"), - // Capacity: to.Ptr[int32](2), - // Tier: to.Ptr("BusinessCritical"), - // }, - // DatabaseID: to.Ptr("6c764297-577b-470f-9af4-96d3d41e2ba3"), - // DefaultSecondaryLocation: to.Ptr("North Europe"), - // EarliestRestoreDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-06-07T04:51:33.937Z"); return t}()), - // IsInfraEncryptionEnabled: to.Ptr(false), - // IsLedgerOn: to.Ptr(false), - // LicenseType: to.Ptr(armsql.DatabaseLicenseTypeLicenseIncluded), - // MaxLogSizeBytes: to.Ptr[int64](104857600), - // MaxSizeBytes: to.Ptr[int64](1073741824), - // ReadScale: to.Ptr(armsql.DatabaseReadScaleEnabled), - // RequestedBackupStorageRedundancy: to.Ptr(armsql.BackupStorageRedundancyGeo), - // Status: to.Ptr(armsql.DatabaseStatusOnline), - // ZoneRedundant: to.Ptr(false), - // }, - // SKU: &armsql.SKU{ - // Name: to.Ptr("BC_Gen4"), - // Capacity: to.Ptr[int32](2), - // Family: to.Ptr("Gen4"), - // Tier: to.Ptr("BusinessCritical"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/CreateVCoreDatabaseBySkuNameCapacity.json -func ExampleDatabasesClient_BeginCreateOrUpdate_createsAVCoreDatabaseBySpecifyingSkuNameAndCapacity() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDatabasesClient().BeginCreateOrUpdate(ctx, "Default-SQL-SouthEastAsia", "testsvr", "testdb", armsql.Database{ - Location: to.Ptr("southeastasia"), - SKU: &armsql.SKU{ - Name: to.Ptr("BC_Gen4"), - Capacity: to.Ptr[int32](2), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Database = armsql.Database{ - // Name: to.Ptr("testdb"), - // Type: to.Ptr("Microsoft.Sql/servers/databases"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/servers/testsvr/databases/testdb"), - // Location: to.Ptr("southeastasia"), - // Kind: to.Ptr("v12.0,user"), - // Properties: &armsql.DatabaseProperties{ - // CatalogCollation: to.Ptr(armsql.CatalogCollationTypeSQLLatin1GeneralCP1CIAS), - // Collation: to.Ptr("SQL_Latin1_General_CP1_CI_AS"), - // CreationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-06-07T04:41:33.937Z"); return t}()), - // CurrentBackupStorageRedundancy: to.Ptr(armsql.BackupStorageRedundancyGeo), - // CurrentServiceObjectiveName: to.Ptr("BC_Gen4_2"), - // CurrentSKU: &armsql.SKU{ - // Name: to.Ptr("BC_Gen4"), - // Capacity: to.Ptr[int32](2), - // Tier: to.Ptr("BusinessCritical"), - // }, - // DatabaseID: to.Ptr("6c764297-577b-470f-9af4-96d3d41e2ba3"), - // DefaultSecondaryLocation: to.Ptr("North Europe"), - // EarliestRestoreDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-06-07T04:51:33.937Z"); return t}()), - // IsInfraEncryptionEnabled: to.Ptr(false), - // IsLedgerOn: to.Ptr(false), - // LicenseType: to.Ptr(armsql.DatabaseLicenseTypeLicenseIncluded), - // MaxLogSizeBytes: to.Ptr[int64](104857600), - // MaxSizeBytes: to.Ptr[int64](1073741824), - // ReadScale: to.Ptr(armsql.DatabaseReadScaleEnabled), - // RequestedBackupStorageRedundancy: to.Ptr(armsql.BackupStorageRedundancyGeo), - // Status: to.Ptr(armsql.DatabaseStatusOnline), - // ZoneRedundant: to.Ptr(false), - // }, - // SKU: &armsql.SKU{ - // Name: to.Ptr("BC_Gen4"), - // Capacity: to.Ptr[int32](2), - // Family: to.Ptr("Gen4"), - // Tier: to.Ptr("BusinessCritical"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/CreateDwDatabaseCrossSubscriptionRestore.json -func ExampleDatabasesClient_BeginCreateOrUpdate_createsADataWarehouseDatabaseAsACrossSubscriptionRestoreFromABackupOfADroppedDatabase() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDatabasesClient().BeginCreateOrUpdate(ctx, "Default-SQL-SouthEastAsia", "testsvr", "testdw", armsql.Database{ - Location: to.Ptr("southeastasia"), - Properties: &armsql.DatabaseProperties{ - CreateMode: to.Ptr(armsql.CreateModeRestore), - SourceResourceID: to.Ptr("/subscriptions/55555555-6666-7777-8888-999999999999/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/servers/srcsvr/restorableDroppedDatabases/srcdw,131403269876900000"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Database = armsql.Database{ - // Name: to.Ptr("testdw"), - // Type: to.Ptr("Microsoft.Sql/servers/databases"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/servers/testsvr/databases/testdw"), - // Location: to.Ptr("southeastasia"), - // Kind: to.Ptr("v12.0,user,datawarehouse,gen2"), - // Properties: &armsql.DatabaseProperties{ - // CatalogCollation: to.Ptr(armsql.CatalogCollationTypeSQLLatin1GeneralCP1CIAS), - // Collation: to.Ptr("SQL_Latin1_General_CP1_CI_AS"), - // CreationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-24T06:46:14.99Z"); return t}()), - // CurrentBackupStorageRedundancy: to.Ptr(armsql.BackupStorageRedundancyGeo), - // CurrentServiceObjectiveName: to.Ptr("DW1000c"), - // CurrentSKU: &armsql.SKU{ - // Name: to.Ptr("DataWarehouse"), - // Capacity: to.Ptr[int32](9000), - // Tier: to.Ptr("DataWarehouse"), - // }, - // DatabaseID: to.Ptr("188784c9-d602-4684-86cf-e67b6f03551a"), - // DefaultSecondaryLocation: to.Ptr("eastus"), - // MaxSizeBytes: to.Ptr[int64](263882790666240), - // ReadScale: to.Ptr(armsql.DatabaseReadScaleDisabled), - // RequestedServiceObjectiveName: to.Ptr("DW1000c"), - // Status: to.Ptr(armsql.DatabaseStatusOnline), - // }, - // SKU: &armsql.SKU{ - // Name: to.Ptr("DataWarehouse"), - // Capacity: to.Ptr[int32](9000), - // Tier: to.Ptr("DataWarehouse"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/CreateDwDatabaseCrossSubscriptionRecovery.json -func ExampleDatabasesClient_BeginCreateOrUpdate_createsADataWarehouseDatabaseAsACrossSubscriptionRestoreFromAGeoBackup() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDatabasesClient().BeginCreateOrUpdate(ctx, "Default-SQL-WestUS", "testsvr", "testdw", armsql.Database{ - Location: to.Ptr("westus"), - Properties: &armsql.DatabaseProperties{ - CreateMode: to.Ptr(armsql.CreateModeRecovery), - SourceResourceID: to.Ptr("/subscriptions/55555555-6666-7777-8888-999999999999/resourceGroups/Default-SQL-EastUS/providers/Microsoft.Sql/servers/srcsvr/recoverabledatabases/srcdw"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Database = armsql.Database{ - // Name: to.Ptr("testdw"), - // Type: to.Ptr("Microsoft.Sql/servers/databases"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-WestUS/providers/Microsoft.Sql/servers/testsvr/databases/testdw"), - // Location: to.Ptr("westus"), - // Kind: to.Ptr("v12.0,user,datawarehouse,gen2"), - // Properties: &armsql.DatabaseProperties{ - // CatalogCollation: to.Ptr(armsql.CatalogCollationTypeSQLLatin1GeneralCP1CIAS), - // Collation: to.Ptr("SQL_Latin1_General_CP1_CI_AS"), - // CreationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-24T06:46:14.99Z"); return t}()), - // CurrentBackupStorageRedundancy: to.Ptr(armsql.BackupStorageRedundancyGeo), - // CurrentServiceObjectiveName: to.Ptr("DW1000c"), - // CurrentSKU: &armsql.SKU{ - // Name: to.Ptr("DataWarehouse"), - // Capacity: to.Ptr[int32](9000), - // Tier: to.Ptr("DataWarehouse"), - // }, - // DatabaseID: to.Ptr("188784c9-d602-4684-86cf-e67b6f03551a"), - // DefaultSecondaryLocation: to.Ptr("eastus"), - // MaxSizeBytes: to.Ptr[int64](263882790666240), - // ReadScale: to.Ptr(armsql.DatabaseReadScaleDisabled), - // RequestedServiceObjectiveName: to.Ptr("DW1000c"), - // Status: to.Ptr(armsql.DatabaseStatusOnline), - // }, - // SKU: &armsql.SKU{ - // Name: to.Ptr("DataWarehouse"), - // Capacity: to.Ptr[int32](9000), - // Tier: to.Ptr("DataWarehouse"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/CreateDwDatabaseCrossSubscriptionPITR.json -func ExampleDatabasesClient_BeginCreateOrUpdate_createsADataWarehouseDatabaseAsACrossSubscriptionRestoreFromARestorePointOfAnExistingDatabase() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDatabasesClient().BeginCreateOrUpdate(ctx, "Default-SQL-SouthEastAsia", "testsvr", "testdw", armsql.Database{ - Location: to.Ptr("southeastasia"), - Properties: &armsql.DatabaseProperties{ - CreateMode: to.Ptr(armsql.CreateModePointInTimeRestore), - RestorePointInTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-22T05:35:31.503Z"); return t }()), - SourceResourceID: to.Ptr("/subscriptions/55555555-6666-7777-8888-999999999999/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/servers/srcsvr/databases/srcdw"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Database = armsql.Database{ - // Name: to.Ptr("testdw"), - // Type: to.Ptr("Microsoft.Sql/servers/databases"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/servers/testsvr/databases/testdw"), - // Location: to.Ptr("southeastasia"), - // Kind: to.Ptr("v12.0,user,datawarehouse,gen2"), - // Properties: &armsql.DatabaseProperties{ - // CatalogCollation: to.Ptr(armsql.CatalogCollationTypeSQLLatin1GeneralCP1CIAS), - // Collation: to.Ptr("SQL_Latin1_General_CP1_CI_AS"), - // CreationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-24T06:46:14.99Z"); return t}()), - // CurrentBackupStorageRedundancy: to.Ptr(armsql.BackupStorageRedundancyGeo), - // CurrentServiceObjectiveName: to.Ptr("DW1000c"), - // CurrentSKU: &armsql.SKU{ - // Name: to.Ptr("DataWarehouse"), - // Capacity: to.Ptr[int32](9000), - // Tier: to.Ptr("DataWarehouse"), - // }, - // DatabaseID: to.Ptr("188784c9-d602-4684-86cf-e67b6f03551a"), - // DefaultSecondaryLocation: to.Ptr("eastus"), - // MaxSizeBytes: to.Ptr[int64](263882790666240), - // ReadScale: to.Ptr(armsql.DatabaseReadScaleDisabled), - // RequestedServiceObjectiveName: to.Ptr("DW1000c"), - // Status: to.Ptr(armsql.DatabaseStatusOnline), - // }, - // SKU: &armsql.SKU{ - // Name: to.Ptr("DataWarehouse"), - // Capacity: to.Ptr[int32](9000), - // Tier: to.Ptr("DataWarehouse"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/CreateDatabaseCopyMode.json -func ExampleDatabasesClient_BeginCreateOrUpdate_createsADatabaseAsACopy() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDatabasesClient().BeginCreateOrUpdate(ctx, "Default-SQL-SouthEastAsia", "testsvr", "dbcopy", armsql.Database{ - Location: to.Ptr("southeastasia"), - Properties: &armsql.DatabaseProperties{ - CreateMode: to.Ptr(armsql.CreateModeCopy), - SourceDatabaseID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/servers/testsvr/databases/testdb"), - }, - SKU: &armsql.SKU{ - Name: to.Ptr("S0"), - Tier: to.Ptr("Standard"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Database = armsql.Database{ - // Name: to.Ptr("dbcopy"), - // Type: to.Ptr("Microsoft.Sql/servers/databases"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/servers/testsvr/databases/dbcopy"), - // Location: to.Ptr("southeastasia"), - // Kind: to.Ptr("v12.0,user"), - // Properties: &armsql.DatabaseProperties{ - // CatalogCollation: to.Ptr(armsql.CatalogCollationTypeSQLLatin1GeneralCP1CIAS), - // Collation: to.Ptr("SQL_Latin1_General_CP1_CI_AS"), - // CreationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-06-07T04:41:33.937Z"); return t}()), - // CurrentBackupStorageRedundancy: to.Ptr(armsql.BackupStorageRedundancyGeo), - // CurrentServiceObjectiveName: to.Ptr("S0"), - // CurrentSKU: &armsql.SKU{ - // Name: to.Ptr("Standard"), - // Capacity: to.Ptr[int32](10), - // Tier: to.Ptr("Standard"), - // }, - // DatabaseID: to.Ptr("6c764297-577b-470f-9af4-96d3d41e2ba3"), - // DefaultSecondaryLocation: to.Ptr("North Europe"), - // EarliestRestoreDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-06-07T04:51:33.937Z"); return t}()), - // IsInfraEncryptionEnabled: to.Ptr(false), - // IsLedgerOn: to.Ptr(false), - // MaxSizeBytes: to.Ptr[int64](268435456000), - // ReadScale: to.Ptr(armsql.DatabaseReadScaleDisabled), - // RequestedBackupStorageRedundancy: to.Ptr(armsql.BackupStorageRedundancyGeo), - // RequestedServiceObjectiveName: to.Ptr("S0"), - // Status: to.Ptr(armsql.DatabaseStatusOnline), - // ZoneRedundant: to.Ptr(false), - // }, - // SKU: &armsql.SKU{ - // Name: to.Ptr("Standard"), - // Capacity: to.Ptr[int32](10), - // Tier: to.Ptr("Standard"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/CreateDatabaseSecondaryMode.json -func ExampleDatabasesClient_BeginCreateOrUpdate_createsADatabaseAsAnOnLineSecondary() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDatabasesClient().BeginCreateOrUpdate(ctx, "Default-SQL-SouthEastAsia", "testsvr", "testdb", armsql.Database{ - Location: to.Ptr("southeastasia"), - Properties: &armsql.DatabaseProperties{ - CreateMode: to.Ptr(armsql.CreateModeSecondary), - SecondaryType: to.Ptr(armsql.SecondaryTypeGeo), - SourceDatabaseID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-NorthEurope/providers/Microsoft.Sql/servers/testsvr1/databases/testdb"), - }, - SKU: &armsql.SKU{ - Name: to.Ptr("S0"), - Tier: to.Ptr("Standard"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Database = armsql.Database{ - // Name: to.Ptr("testdb"), - // Type: to.Ptr("Microsoft.Sql/servers/databases"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/servers/testsvr/databases/testdb"), - // Location: to.Ptr("southeastasia"), - // Kind: to.Ptr("v12.0,user"), - // Properties: &armsql.DatabaseProperties{ - // CatalogCollation: to.Ptr(armsql.CatalogCollationTypeSQLLatin1GeneralCP1CIAS), - // Collation: to.Ptr("SQL_Latin1_General_CP1_CI_AS"), - // CreationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-06-07T04:41:33.937Z"); return t}()), - // CurrentBackupStorageRedundancy: to.Ptr(armsql.BackupStorageRedundancyGeo), - // CurrentServiceObjectiveName: to.Ptr("S0"), - // CurrentSKU: &armsql.SKU{ - // Name: to.Ptr("Standard"), - // Capacity: to.Ptr[int32](10), - // Tier: to.Ptr("Standard"), - // }, - // DatabaseID: to.Ptr("6c764297-577b-470f-9af4-96d3d41e2ba3"), - // DefaultSecondaryLocation: to.Ptr("North Europe"), - // EarliestRestoreDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-06-07T04:51:33.937Z"); return t}()), - // IsInfraEncryptionEnabled: to.Ptr(false), - // IsLedgerOn: to.Ptr(false), - // MaxSizeBytes: to.Ptr[int64](268435456000), - // ReadScale: to.Ptr(armsql.DatabaseReadScaleDisabled), - // RequestedBackupStorageRedundancy: to.Ptr(armsql.BackupStorageRedundancyGeo), - // RequestedServiceObjectiveName: to.Ptr("S0"), - // SecondaryType: to.Ptr(armsql.SecondaryTypeGeo), - // Status: to.Ptr(armsql.DatabaseStatusOnline), - // ZoneRedundant: to.Ptr(false), - // }, - // SKU: &armsql.SKU{ - // Name: to.Ptr("Standard"), - // Capacity: to.Ptr[int32](10), - // Tier: to.Ptr("Standard"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/CreateDatabaseNamedReplica.json -func ExampleDatabasesClient_BeginCreateOrUpdate_createsADatabaseAsNamedReplicaSecondary() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDatabasesClient().BeginCreateOrUpdate(ctx, "Default-SQL-SouthEastAsia", "testsvr", "testdb", armsql.Database{ - Location: to.Ptr("southeastasia"), - Properties: &armsql.DatabaseProperties{ - CreateMode: to.Ptr(armsql.CreateModeSecondary), - SecondaryType: to.Ptr(armsql.SecondaryTypeNamed), - SourceDatabaseID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-NorthEurope/providers/Microsoft.Sql/servers/testsvr1/databases/primarydb"), - }, - SKU: &armsql.SKU{ - Name: to.Ptr("HS_Gen4"), - Capacity: to.Ptr[int32](2), - Tier: to.Ptr("Hyperscale"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Database = armsql.Database{ - // Name: to.Ptr("testdb"), - // Type: to.Ptr("Microsoft.Sql/servers/databases"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/servers/testsvr/databases/testdb"), - // Location: to.Ptr("southeastasia"), - // Kind: to.Ptr("v12.0,user,vcore,hyperscale"), - // Properties: &armsql.DatabaseProperties{ - // CatalogCollation: to.Ptr(armsql.CatalogCollationTypeSQLLatin1GeneralCP1CIAS), - // Collation: to.Ptr("SQL_Latin1_General_CP1_CI_AS"), - // CreationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-06-07T04:41:33.937Z"); return t}()), - // CurrentBackupStorageRedundancy: to.Ptr(armsql.BackupStorageRedundancyGeo), - // CurrentServiceObjectiveName: to.Ptr("HS_Gen4_2"), - // CurrentSKU: &armsql.SKU{ - // Name: to.Ptr("HS_Gen4"), - // Capacity: to.Ptr[int32](2), - // Family: to.Ptr("Gen4"), - // Tier: to.Ptr("Hyperscale"), - // }, - // DatabaseID: to.Ptr("6c764297-577b-470f-9af4-96d3d41e2ba3"), - // DefaultSecondaryLocation: to.Ptr("North Europe"), - // EarliestRestoreDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-06-07T04:51:33.937Z"); return t}()), - // HighAvailabilityReplicaCount: to.Ptr[int32](0), - // IsInfraEncryptionEnabled: to.Ptr(false), - // IsLedgerOn: to.Ptr(false), - // LicenseType: to.Ptr(armsql.DatabaseLicenseTypeLicenseIncluded), - // MaxSizeBytes: to.Ptr[int64](-1), - // ReadScale: to.Ptr(armsql.DatabaseReadScaleDisabled), - // RequestedBackupStorageRedundancy: to.Ptr(armsql.BackupStorageRedundancyGeo), - // RequestedServiceObjectiveName: to.Ptr("HS_Gen4_2"), - // SecondaryType: to.Ptr(armsql.SecondaryTypeNamed), - // Status: to.Ptr(armsql.DatabaseStatusOnline), - // ZoneRedundant: to.Ptr(false), - // }, - // SKU: &armsql.SKU{ - // Name: to.Ptr("HS_Gen4"), - // Capacity: to.Ptr[int32](2), - // Family: to.Ptr("Gen4"), - // Tier: to.Ptr("Hyperscale"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/CreateDatabasePITRMode.json -func ExampleDatabasesClient_BeginCreateOrUpdate_createsADatabaseFromPointInTimeRestore() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDatabasesClient().BeginCreateOrUpdate(ctx, "Default-SQL-SouthEastAsia", "testsvr", "dbpitr", armsql.Database{ - Location: to.Ptr("southeastasia"), - Properties: &armsql.DatabaseProperties{ - CreateMode: to.Ptr(armsql.CreateModePointInTimeRestore), - RestorePointInTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-10-22T05:35:31.503Z"); return t }()), - SourceDatabaseID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SoutheastAsia/providers/Microsoft.Sql/servers/testsvr/databases/testdb"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Database = armsql.Database{ - // Name: to.Ptr("dbpitr"), - // Type: to.Ptr("Microsoft.Sql/servers/databases"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SoutheastAsia/providers/Microsoft.Sql/servers/testsvr/databases/dbpitr"), - // Location: to.Ptr("SoutheastAsia"), - // Kind: to.Ptr("v12.0,user"), - // Properties: &armsql.DatabaseProperties{ - // CatalogCollation: to.Ptr(armsql.CatalogCollationTypeSQLLatin1GeneralCP1CIAS), - // Collation: to.Ptr("SQL_Latin1_General_CP1_CI_AS"), - // CreationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-10-23T20:31:35.807Z"); return t}()), - // CurrentBackupStorageRedundancy: to.Ptr(armsql.BackupStorageRedundancyGeo), - // CurrentServiceObjectiveName: to.Ptr("S0"), - // CurrentSKU: &armsql.SKU{ - // Name: to.Ptr("Standard"), - // Capacity: to.Ptr[int32](10), - // Tier: to.Ptr("Standard"), - // }, - // DatabaseID: to.Ptr("2463ef48-53e2-4c26-9781-2d7138080bfd"), - // DefaultSecondaryLocation: to.Ptr("SoutheastAsia"), - // EarliestRestoreDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-10-23T20:47:37Z"); return t}()), - // IsInfraEncryptionEnabled: to.Ptr(false), - // IsLedgerOn: to.Ptr(false), - // MaxSizeBytes: to.Ptr[int64](268435456000), - // ReadScale: to.Ptr(armsql.DatabaseReadScaleDisabled), - // RequestedBackupStorageRedundancy: to.Ptr(armsql.BackupStorageRedundancyGeo), - // RequestedServiceObjectiveName: to.Ptr("S0"), - // Status: to.Ptr(armsql.DatabaseStatusOnline), - // ZoneRedundant: to.Ptr(false), - // }, - // SKU: &armsql.SKU{ - // Name: to.Ptr("Standard"), - // Capacity: to.Ptr[int32](10), - // Tier: to.Ptr("Standard"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/CreateDatabaseDefaultMode.json -func ExampleDatabasesClient_BeginCreateOrUpdate_createsADatabaseWithDefaultMode() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDatabasesClient().BeginCreateOrUpdate(ctx, "Default-SQL-SouthEastAsia", "testsvr", "testdb", armsql.Database{ - Location: to.Ptr("southeastasia"), - Properties: &armsql.DatabaseProperties{ - Collation: to.Ptr("SQL_Latin1_General_CP1_CI_AS"), - CreateMode: to.Ptr(armsql.CreateModeDefault), - MaxSizeBytes: to.Ptr[int64](1073741824), - }, - SKU: &armsql.SKU{ - Name: to.Ptr("S0"), - Tier: to.Ptr("Standard"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Database = armsql.Database{ - // Name: to.Ptr("testdb"), - // Type: to.Ptr("Microsoft.Sql/servers/databases"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/servers/testsvr/databases/testdb"), - // Location: to.Ptr("southeastasia"), - // Kind: to.Ptr("v12.0,user"), - // Properties: &armsql.DatabaseProperties{ - // CatalogCollation: to.Ptr(armsql.CatalogCollationTypeSQLLatin1GeneralCP1CIAS), - // Collation: to.Ptr("SQL_Latin1_General_CP1_CI_AS"), - // CreationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-06-07T04:41:33.937Z"); return t}()), - // CurrentBackupStorageRedundancy: to.Ptr(armsql.BackupStorageRedundancyGeo), - // CurrentServiceObjectiveName: to.Ptr("S0"), - // CurrentSKU: &armsql.SKU{ - // Name: to.Ptr("Standard"), - // Capacity: to.Ptr[int32](10), - // Tier: to.Ptr("Standard"), - // }, - // DatabaseID: to.Ptr("6c764297-577b-470f-9af4-96d3d41e2ba3"), - // DefaultSecondaryLocation: to.Ptr("North Europe"), - // EarliestRestoreDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-06-07T04:51:33.937Z"); return t}()), - // IsInfraEncryptionEnabled: to.Ptr(false), - // IsLedgerOn: to.Ptr(false), - // MaxSizeBytes: to.Ptr[int64](1073741824), - // ReadScale: to.Ptr(armsql.DatabaseReadScaleDisabled), - // RequestedBackupStorageRedundancy: to.Ptr(armsql.BackupStorageRedundancyGeo), - // RequestedServiceObjectiveName: to.Ptr("S0"), - // Status: to.Ptr(armsql.DatabaseStatusOnline), - // ZoneRedundant: to.Ptr(false), - // }, - // SKU: &armsql.SKU{ - // Name: to.Ptr("S0"), - // Capacity: to.Ptr[int32](10), - // Tier: to.Ptr("Standard"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/CreateDatabaseLedger.json -func ExampleDatabasesClient_BeginCreateOrUpdate_createsADatabaseWithLedgerOn() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDatabasesClient().BeginCreateOrUpdate(ctx, "Default-SQL-SouthEastAsia", "testsvr", "testdb", armsql.Database{ - Location: to.Ptr("southeastasia"), - Properties: &armsql.DatabaseProperties{ - IsLedgerOn: to.Ptr(true), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Database = armsql.Database{ - // Name: to.Ptr("testdb"), - // Type: to.Ptr("Microsoft.Sql/servers/databases"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/servers/testsvr/databases/testdb"), - // Location: to.Ptr("southeastasia"), - // Kind: to.Ptr("v12.0,user"), - // Properties: &armsql.DatabaseProperties{ - // CatalogCollation: to.Ptr(armsql.CatalogCollationTypeSQLLatin1GeneralCP1CIAS), - // Collation: to.Ptr("SQL_Latin1_General_CP1_CI_AS"), - // CreationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-06-07T04:41:33.937Z"); return t}()), - // CurrentBackupStorageRedundancy: to.Ptr(armsql.BackupStorageRedundancyGeo), - // CurrentServiceObjectiveName: to.Ptr("S0"), - // CurrentSKU: &armsql.SKU{ - // Name: to.Ptr("Standard"), - // Capacity: to.Ptr[int32](10), - // Tier: to.Ptr("Standard"), - // }, - // DatabaseID: to.Ptr("6c764297-577b-470f-9af4-96d3d41e2ba3"), - // DefaultSecondaryLocation: to.Ptr("North Europe"), - // EarliestRestoreDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-06-07T04:51:33.937Z"); return t}()), - // IsLedgerOn: to.Ptr(true), - // MaxSizeBytes: to.Ptr[int64](268435456000), - // ReadScale: to.Ptr(armsql.DatabaseReadScaleDisabled), - // RequestedBackupStorageRedundancy: to.Ptr(armsql.BackupStorageRedundancyGeo), - // RequestedServiceObjectiveName: to.Ptr("S0"), - // Status: to.Ptr(armsql.DatabaseStatusOnline), - // ZoneRedundant: to.Ptr(false), - // }, - // SKU: &armsql.SKU{ - // Name: to.Ptr("Standard"), - // Capacity: to.Ptr[int32](10), - // Tier: to.Ptr("Standard"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/CreateDatabaseMin.json -func ExampleDatabasesClient_BeginCreateOrUpdate_createsADatabaseWithMinimumNumberOfParameters() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDatabasesClient().BeginCreateOrUpdate(ctx, "Default-SQL-SouthEastAsia", "testsvr", "testdb", armsql.Database{ - Location: to.Ptr("southeastasia"), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Database = armsql.Database{ - // Name: to.Ptr("testdb"), - // Type: to.Ptr("Microsoft.Sql/servers/databases"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/servers/testsvr/databases/testdb"), - // Location: to.Ptr("southeastasia"), - // Kind: to.Ptr("v12.0,user"), - // Properties: &armsql.DatabaseProperties{ - // CatalogCollation: to.Ptr(armsql.CatalogCollationTypeSQLLatin1GeneralCP1CIAS), - // Collation: to.Ptr("SQL_Latin1_General_CP1_CI_AS"), - // CreationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-06-07T04:41:33.937Z"); return t}()), - // CurrentBackupStorageRedundancy: to.Ptr(armsql.BackupStorageRedundancyGeo), - // CurrentServiceObjectiveName: to.Ptr("S0"), - // CurrentSKU: &armsql.SKU{ - // Name: to.Ptr("Standard"), - // Capacity: to.Ptr[int32](10), - // Tier: to.Ptr("Standard"), - // }, - // DatabaseID: to.Ptr("6c764297-577b-470f-9af4-96d3d41e2ba3"), - // DefaultSecondaryLocation: to.Ptr("North Europe"), - // EarliestRestoreDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-06-07T04:51:33.937Z"); return t}()), - // IsInfraEncryptionEnabled: to.Ptr(false), - // IsLedgerOn: to.Ptr(false), - // MaxSizeBytes: to.Ptr[int64](268435456000), - // ReadScale: to.Ptr(armsql.DatabaseReadScaleDisabled), - // RequestedBackupStorageRedundancy: to.Ptr(armsql.BackupStorageRedundancyGeo), - // RequestedServiceObjectiveName: to.Ptr("S0"), - // Status: to.Ptr(armsql.DatabaseStatusOnline), - // ZoneRedundant: to.Ptr(false), - // }, - // SKU: &armsql.SKU{ - // Name: to.Ptr("Standard"), - // Capacity: to.Ptr[int32](10), - // Tier: to.Ptr("Standard"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/CreateDatabaseMaintenanceConfiguration.json -func ExampleDatabasesClient_BeginCreateOrUpdate_createsADatabaseWithPreferredMaintenanceWindow() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDatabasesClient().BeginCreateOrUpdate(ctx, "Default-SQL-SouthEastAsia", "testsvr", "testdb", armsql.Database{ - Location: to.Ptr("southeastasia"), - Properties: &armsql.DatabaseProperties{ - Collation: to.Ptr("SQL_Latin1_General_CP1_CI_AS"), - CreateMode: to.Ptr(armsql.CreateModeDefault), - MaintenanceConfigurationID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/providers/Microsoft.Maintenance/publicMaintenanceConfigurations/SQL_SouthEastAsia_1"), - MaxSizeBytes: to.Ptr[int64](1073741824), - }, - SKU: &armsql.SKU{ - Name: to.Ptr("S2"), - Tier: to.Ptr("Standard"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Database = armsql.Database{ - // Name: to.Ptr("testdb"), - // Type: to.Ptr("Microsoft.Sql/servers/databases"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/servers/testsvr/databases/testdb"), - // Location: to.Ptr("southeastasia"), - // Kind: to.Ptr("v12.0,user"), - // Properties: &armsql.DatabaseProperties{ - // CatalogCollation: to.Ptr(armsql.CatalogCollationTypeSQLLatin1GeneralCP1CIAS), - // Collation: to.Ptr("SQL_Latin1_General_CP1_CI_AS"), - // CreationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-06-07T04:41:33.937Z"); return t}()), - // CurrentBackupStorageRedundancy: to.Ptr(armsql.BackupStorageRedundancyGeo), - // CurrentServiceObjectiveName: to.Ptr("S2"), - // CurrentSKU: &armsql.SKU{ - // Name: to.Ptr("Standard"), - // Capacity: to.Ptr[int32](50), - // Tier: to.Ptr("Standard"), - // }, - // DatabaseID: to.Ptr("6c764297-577b-470f-9af4-96d3d41e2ba3"), - // DefaultSecondaryLocation: to.Ptr("North Europe"), - // EarliestRestoreDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-08-29T06:41:18.283Z"); return t}()), - // IsInfraEncryptionEnabled: to.Ptr(false), - // IsLedgerOn: to.Ptr(false), - // MaintenanceConfigurationID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/providers/Microsoft.Maintenance/publicMaintenanceConfigurations/SQL_SouthEastAsia_1"), - // MaxSizeBytes: to.Ptr[int64](1073741824), - // ReadScale: to.Ptr(armsql.DatabaseReadScaleDisabled), - // RequestedBackupStorageRedundancy: to.Ptr(armsql.BackupStorageRedundancyGeo), - // Status: to.Ptr(armsql.DatabaseStatusOnline), - // ZoneRedundant: to.Ptr(false), - // }, - // SKU: &armsql.SKU{ - // Name: to.Ptr("S2"), - // Tier: to.Ptr("Standard"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/CreateDatabaseConfiguredBackupStorageRedundancy.json -func ExampleDatabasesClient_BeginCreateOrUpdate_createsADatabaseWithSpecifiedBackupStorageRedundancy() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDatabasesClient().BeginCreateOrUpdate(ctx, "Default-SQL-SouthEastAsia", "testsvr", "testdb", armsql.Database{ - Location: to.Ptr("southeastasia"), - Properties: &armsql.DatabaseProperties{ - RequestedBackupStorageRedundancy: to.Ptr(armsql.BackupStorageRedundancyZone), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Database = armsql.Database{ - // Name: to.Ptr("testdb"), - // Type: to.Ptr("Microsoft.Sql/servers/databases"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/servers/testsvr/databases/testdb"), - // Location: to.Ptr("southeastasia"), - // Kind: to.Ptr("v12.0,user"), - // Properties: &armsql.DatabaseProperties{ - // CatalogCollation: to.Ptr(armsql.CatalogCollationTypeSQLLatin1GeneralCP1CIAS), - // Collation: to.Ptr("SQL_Latin1_General_CP1_CI_AS"), - // CreationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-06-07T04:41:33.937Z"); return t}()), - // CurrentBackupStorageRedundancy: to.Ptr(armsql.BackupStorageRedundancyZone), - // CurrentServiceObjectiveName: to.Ptr("S0"), - // CurrentSKU: &armsql.SKU{ - // Name: to.Ptr("Standard"), - // Capacity: to.Ptr[int32](10), - // Tier: to.Ptr("Standard"), - // }, - // DatabaseID: to.Ptr("6c764297-577b-470f-9af4-96d3d41e2ba3"), - // DefaultSecondaryLocation: to.Ptr("North Europe"), - // EarliestRestoreDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-06-07T04:51:33.937Z"); return t}()), - // IsInfraEncryptionEnabled: to.Ptr(false), - // IsLedgerOn: to.Ptr(false), - // MaxSizeBytes: to.Ptr[int64](268435456000), - // ReadScale: to.Ptr(armsql.DatabaseReadScaleDisabled), - // RequestedBackupStorageRedundancy: to.Ptr(armsql.BackupStorageRedundancyZone), - // RequestedServiceObjectiveName: to.Ptr("S0"), - // Status: to.Ptr(armsql.DatabaseStatusOnline), - // ZoneRedundant: to.Ptr(false), - // }, - // SKU: &armsql.SKU{ - // Name: to.Ptr("Standard"), - // Capacity: to.Ptr[int32](10), - // Tier: to.Ptr("Standard"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/DeleteDatabase.json -func ExampleDatabasesClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDatabasesClient().BeginDelete(ctx, "Default-SQL-SouthEastAsia", "testsvr", "testdb", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/PatchVCoreDatabaseAssignMaintenanceConfiguration.json -func ExampleDatabasesClient_BeginUpdate_assignsMaintenanceWindowToADatabase() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDatabasesClient().BeginUpdate(ctx, "Default-SQL-SouthEastAsia", "testsvr", "testdb", armsql.DatabaseUpdate{ - Properties: &armsql.DatabaseUpdateProperties{ - MaintenanceConfigurationID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/providers/Microsoft.Maintenance/publicMaintenanceConfigurations/SQL_SouthEastAsia_1"), - }, - SKU: &armsql.SKU{ - Name: to.Ptr("BC_Gen5_4"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Database = armsql.Database{ - // Name: to.Ptr("testdb"), - // Type: to.Ptr("Microsoft.Sql/servers/databases"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/servers/testsvr/databases/testdb"), - // Location: to.Ptr("southeastasia"), - // Kind: to.Ptr("v12.0,user,vcore"), - // Properties: &armsql.DatabaseProperties{ - // CatalogCollation: to.Ptr(armsql.CatalogCollationTypeSQLLatin1GeneralCP1CIAS), - // Collation: to.Ptr("SQL_Latin1_General_CP1_CI_AS"), - // CreationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-06-07T04:41:33.937Z"); return t}()), - // CurrentBackupStorageRedundancy: to.Ptr(armsql.BackupStorageRedundancyGeo), - // CurrentServiceObjectiveName: to.Ptr("BC_Gen5_2"), - // CurrentSKU: &armsql.SKU{ - // Name: to.Ptr("BC_Gen5"), - // Capacity: to.Ptr[int32](4), - // Tier: to.Ptr("BusinessCritical"), - // }, - // DatabaseID: to.Ptr("6c764297-577b-470f-9af4-96d3d41e2ba3"), - // DefaultSecondaryLocation: to.Ptr("North Europe"), - // EarliestRestoreDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-06-07T04:51:33.937Z"); return t}()), - // IsInfraEncryptionEnabled: to.Ptr(false), - // IsLedgerOn: to.Ptr(false), - // LicenseType: to.Ptr(armsql.DatabaseLicenseTypeLicenseIncluded), - // MaintenanceConfigurationID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/providers/Microsoft.Maintenance/publicMaintenanceConfigurations/SQL_SouthEastAsia_1"), - // MaxLogSizeBytes: to.Ptr[int64](104857600), - // MaxSizeBytes: to.Ptr[int64](1073741824), - // ReadScale: to.Ptr(armsql.DatabaseReadScaleEnabled), - // RequestedBackupStorageRedundancy: to.Ptr(armsql.BackupStorageRedundancyGeo), - // RequestedServiceObjectiveName: to.Ptr("BC_Gen5_2"), - // Status: to.Ptr(armsql.DatabaseStatusOnline), - // ZoneRedundant: to.Ptr(false), - // }, - // SKU: &armsql.SKU{ - // Name: to.Ptr("BC_Gen5"), - // Capacity: to.Ptr[int32](4), - // Tier: to.Ptr("BusinessCritical"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/PatchVCoreDatabaseResetMaintenanceConfiguration.json -func ExampleDatabasesClient_BeginUpdate_resetsMaintenanceWindowOfADatabaseToDefault() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDatabasesClient().BeginUpdate(ctx, "Default-SQL-SouthEastAsia", "testsvr", "testdb", armsql.DatabaseUpdate{ - Properties: &armsql.DatabaseUpdateProperties{ - MaintenanceConfigurationID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/providers/Microsoft.Maintenance/publicMaintenanceConfigurations/SQL_Default"), - }, - SKU: &armsql.SKU{ - Name: to.Ptr("BC_Gen5_4"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Database = armsql.Database{ - // Name: to.Ptr("testdb"), - // Type: to.Ptr("Microsoft.Sql/servers/databases"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/servers/testsvr/databases/testdb"), - // Location: to.Ptr("southeastasia"), - // Kind: to.Ptr("v12.0,user,vcore"), - // Properties: &armsql.DatabaseProperties{ - // CatalogCollation: to.Ptr(armsql.CatalogCollationTypeSQLLatin1GeneralCP1CIAS), - // Collation: to.Ptr("SQL_Latin1_General_CP1_CI_AS"), - // CreationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-06-07T04:41:33.937Z"); return t}()), - // CurrentBackupStorageRedundancy: to.Ptr(armsql.BackupStorageRedundancyGeo), - // CurrentServiceObjectiveName: to.Ptr("BC_Gen5_4"), - // CurrentSKU: &armsql.SKU{ - // Name: to.Ptr("BC_Gen5"), - // Capacity: to.Ptr[int32](4), - // Tier: to.Ptr("BusinessCritical"), - // }, - // DatabaseID: to.Ptr("6c764297-577b-470f-9af4-96d3d41e2ba3"), - // DefaultSecondaryLocation: to.Ptr("North Europe"), - // EarliestRestoreDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-06-07T04:51:33.937Z"); return t}()), - // IsInfraEncryptionEnabled: to.Ptr(false), - // IsLedgerOn: to.Ptr(false), - // LicenseType: to.Ptr(armsql.DatabaseLicenseTypeLicenseIncluded), - // MaxLogSizeBytes: to.Ptr[int64](104857600), - // MaxSizeBytes: to.Ptr[int64](1073741824), - // ReadScale: to.Ptr(armsql.DatabaseReadScaleEnabled), - // RequestedBackupStorageRedundancy: to.Ptr(armsql.BackupStorageRedundancyGeo), - // RequestedServiceObjectiveName: to.Ptr("BC_Gen5_4"), - // Status: to.Ptr(armsql.DatabaseStatusOnline), - // ZoneRedundant: to.Ptr(false), - // }, - // SKU: &armsql.SKU{ - // Name: to.Ptr("BC_Gen5"), - // Capacity: to.Ptr[int32](4), - // Tier: to.Ptr("BusinessCritical"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/PatchVCoreDatabase.json -func ExampleDatabasesClient_BeginUpdate_updatesADatabase() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDatabasesClient().BeginUpdate(ctx, "Default-SQL-SouthEastAsia", "testsvr", "testdb", armsql.DatabaseUpdate{ - Properties: &armsql.DatabaseUpdateProperties{ - LicenseType: to.Ptr(armsql.DatabaseLicenseTypeLicenseIncluded), - MaxSizeBytes: to.Ptr[int64](1073741824), - }, - SKU: &armsql.SKU{ - Name: to.Ptr("BC_Gen4_4"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Database = armsql.Database{ - // Name: to.Ptr("testdb"), - // Type: to.Ptr("Microsoft.Sql/servers/databases"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/servers/testsvr/databases/testdb"), - // Location: to.Ptr("southeastasia"), - // Kind: to.Ptr("v12.0,user,vcore"), - // Properties: &armsql.DatabaseProperties{ - // CatalogCollation: to.Ptr(armsql.CatalogCollationTypeSQLLatin1GeneralCP1CIAS), - // Collation: to.Ptr("SQL_Latin1_General_CP1_CI_AS"), - // CreationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-06-07T04:41:33.937Z"); return t}()), - // CurrentBackupStorageRedundancy: to.Ptr(armsql.BackupStorageRedundancyGeo), - // CurrentServiceObjectiveName: to.Ptr("BC_Gen4_2"), - // CurrentSKU: &armsql.SKU{ - // Name: to.Ptr("BC_Gen4"), - // Capacity: to.Ptr[int32](4), - // Tier: to.Ptr("BusinessCritical"), - // }, - // DatabaseID: to.Ptr("6c764297-577b-470f-9af4-96d3d41e2ba3"), - // DefaultSecondaryLocation: to.Ptr("North Europe"), - // EarliestRestoreDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-06-07T04:51:33.937Z"); return t}()), - // IsInfraEncryptionEnabled: to.Ptr(false), - // IsLedgerOn: to.Ptr(false), - // LicenseType: to.Ptr(armsql.DatabaseLicenseTypeLicenseIncluded), - // MaxLogSizeBytes: to.Ptr[int64](104857600), - // MaxSizeBytes: to.Ptr[int64](1073741824), - // ReadScale: to.Ptr(armsql.DatabaseReadScaleEnabled), - // RequestedBackupStorageRedundancy: to.Ptr(armsql.BackupStorageRedundancyLocal), - // RequestedServiceObjectiveName: to.Ptr("BC_Gen4_2"), - // Status: to.Ptr(armsql.DatabaseStatusOnline), - // ZoneRedundant: to.Ptr(false), - // }, - // SKU: &armsql.SKU{ - // Name: to.Ptr("BC_Gen4"), - // Capacity: to.Ptr[int32](4), - // Tier: to.Ptr("BusinessCritical"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ExportDatabaseWithNetworkIsolation.json -func ExampleDatabasesClient_BeginExport_exportsADatabaseUsingPrivateLinkToCommunicateWithSqlServerAndStorageAccount() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDatabasesClient().BeginExport(ctx, "Default-SQL-SouthEastAsia", "testsvr", "testdb", armsql.ExportDatabaseDefinition{ - AdministratorLogin: to.Ptr("login"), - AdministratorLoginPassword: to.Ptr("password"), - AuthenticationType: to.Ptr("Sql"), - NetworkIsolation: &armsql.NetworkIsolationSettings{ - SQLServerResourceID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/servers/testsvr"), - StorageAccountResourceID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Storage/storageAccounts/test-privatelink"), - }, - StorageKey: to.Ptr("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx=="), - StorageKeyType: to.Ptr(armsql.StorageKeyTypeStorageAccessKey), - StorageURI: to.Ptr("https://test.blob.core.windows.net/test.bacpac"), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ImportExportOperationResult = armsql.ImportExportOperationResult{ - // Name: to.Ptr("9d9a794a-5cec-4f23-af70-d29511b522a4"), - // Type: to.Ptr("Microsoft.Sql/servers/databases/importExportOperationResults"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/servers/testsvr/databases/testdb/importExportOperationResults/9d9a794a-5cec-4f23-af70-d29511b522a4"), - // Properties: &armsql.ImportExportOperationResultProperties{ - // BlobURI: to.Ptr("https://test.blob.core.windows.net/test.bacpac"), - // DatabaseName: to.Ptr("testdb"), - // LastModifiedTime: to.Ptr("2/2/2020 8:34:47 PM"), - // QueuedTime: to.Ptr("2/2/2020 8:33:27 PM"), - // RequestID: to.Ptr("9d9a794a-5cec-4f23-af70-d29511b522a4"), - // RequestType: to.Ptr("Export"), - // ServerName: to.Ptr("testsvr.database.windows.net"), - // Status: to.Ptr("Completed"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ExportDatabase.json -func ExampleDatabasesClient_BeginExport_exportsADatabase() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDatabasesClient().BeginExport(ctx, "Default-SQL-SouthEastAsia", "testsvr", "testdb", armsql.ExportDatabaseDefinition{ - AdministratorLogin: to.Ptr("login"), - AdministratorLoginPassword: to.Ptr("password"), - AuthenticationType: to.Ptr("Sql"), - StorageKey: to.Ptr("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx=="), - StorageKeyType: to.Ptr(armsql.StorageKeyTypeStorageAccessKey), - StorageURI: to.Ptr("https://test.blob.core.windows.net/test.bacpac"), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ImportExportOperationResult = armsql.ImportExportOperationResult{ - // Name: to.Ptr("9d9a794a-5cec-4f23-af70-d29511b522a4"), - // Type: to.Ptr("Microsoft.Sql/servers/databases/importExportOperationResults"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/servers/testsvr/databases/testdb/importExportOperationResults/9d9a794a-5cec-4f23-af70-d29511b522a4"), - // Properties: &armsql.ImportExportOperationResultProperties{ - // BlobURI: to.Ptr("https://test.blob.core.windows.net/test.bacpac"), - // DatabaseName: to.Ptr("testdb"), - // LastModifiedTime: to.Ptr("2/2/2020 8:34:47 PM"), - // QueuedTime: to.Ptr("2/2/2020 8:33:27 PM"), - // RequestID: to.Ptr("9d9a794a-5cec-4f23-af70-d29511b522a4"), - // RequestType: to.Ptr("Export"), - // ServerName: to.Ptr("testsvr.database.windows.net"), - // Status: to.Ptr("Completed"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/FailoverDatabase.json -func ExampleDatabasesClient_BeginFailover() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDatabasesClient().BeginFailover(ctx, "group1", "testServer", "testDatabase", &armsql.DatabasesClientBeginFailoverOptions{ReplicaType: to.Ptr(armsql.ReplicaTypePrimary)}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ImportDatabaseWithNetworkIsolation.json -func ExampleDatabasesClient_BeginImport_importsToAnExistingEmptyDatabaseUsingPrivateLinkToCommunicateWithSqlServerAndStorageAccount() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDatabasesClient().BeginImport(ctx, "Default-SQL-SouthEastAsia", "testsvr", "testdb", armsql.ImportExistingDatabaseDefinition{ - AdministratorLogin: to.Ptr("login"), - AdministratorLoginPassword: to.Ptr("password"), - AuthenticationType: to.Ptr("Sql"), - NetworkIsolation: &armsql.NetworkIsolationSettings{ - SQLServerResourceID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/servers/testsvr"), - StorageAccountResourceID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Storage/storageAccounts/test-privatelink"), - }, - StorageKey: to.Ptr("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx=="), - StorageKeyType: to.Ptr(armsql.StorageKeyTypeStorageAccessKey), - StorageURI: to.Ptr("https://test.blob.core.windows.net/test.bacpac"), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ImportExportOperationResult = armsql.ImportExportOperationResult{ - // Name: to.Ptr("9d9a794a-5cec-4f23-af70-d29511b522a4"), - // Type: to.Ptr("Microsoft.Sql/servers/databases/importExportOperationResults"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/servers/testsvr/databases/testdb/importExportOperationResults/9d9a794a-5cec-4f23-af70-d29511b522a4"), - // Properties: &armsql.ImportExportOperationResultProperties{ - // BlobURI: to.Ptr("https://test.blob.core.windows.net/test.bacpac"), - // DatabaseName: to.Ptr("testdb"), - // LastModifiedTime: to.Ptr("2/2/2020 8:34:47 PM"), - // QueuedTime: to.Ptr("2/2/2020 8:33:27 PM"), - // RequestID: to.Ptr("9d9a794a-5cec-4f23-af70-d29511b522a4"), - // RequestType: to.Ptr("Import"), - // ServerName: to.Ptr("testsvr.database.windows.net"), - // Status: to.Ptr("Completed"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ImportDatabase.json -func ExampleDatabasesClient_BeginImport_importsToAnExistingEmptyDatabase() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDatabasesClient().BeginImport(ctx, "Default-SQL-SouthEastAsia", "testsvr", "testdb", armsql.ImportExistingDatabaseDefinition{ - AdministratorLogin: to.Ptr("login"), - AdministratorLoginPassword: to.Ptr("password"), - AuthenticationType: to.Ptr("Sql"), - StorageKey: to.Ptr("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx=="), - StorageKeyType: to.Ptr(armsql.StorageKeyTypeStorageAccessKey), - StorageURI: to.Ptr("https://test.blob.core.windows.net/test.bacpac"), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ImportExportOperationResult = armsql.ImportExportOperationResult{ - // Name: to.Ptr("9d9a794a-5cec-4f23-af70-d29511b522a4"), - // Type: to.Ptr("Microsoft.Sql/servers/databases/importExportOperationResults"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/servers/testsvr/databases/testdb/importExportOperationResults/9d9a794a-5cec-4f23-af70-d29511b522a4"), - // Properties: &armsql.ImportExportOperationResultProperties{ - // BlobURI: to.Ptr("https://test.blob.core.windows.net/test.bacpac"), - // DatabaseName: to.Ptr("testdb"), - // LastModifiedTime: to.Ptr("2/2/2020 8:34:47 PM"), - // QueuedTime: to.Ptr("2/2/2020 8:33:27 PM"), - // RequestID: to.Ptr("9d9a794a-5cec-4f23-af70-d29511b522a4"), - // RequestType: to.Ptr("Import"), - // ServerName: to.Ptr("testsvr.database.windows.net"), - // Status: to.Ptr("Completed"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/RenameDatabase.json -func ExampleDatabasesClient_Rename() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewDatabasesClient().Rename(ctx, "Default-SQL-SouthEastAsia", "testsvr", "testdb", armsql.ResourceMoveDefinition{ - ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/servers/testsvr/databases/newtestdb"), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/PauseDatabase.json -func ExampleDatabasesClient_BeginPause() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDatabasesClient().BeginPause(ctx, "Default-SQL-SouthEastAsia", "testsvr", "testdwdb", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Database = armsql.Database{ - // Name: to.Ptr("testdwdb"), - // Type: to.Ptr("Microsoft.Sql/servers/databases"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/servers/testsvr/databases/testdwdb"), - // Location: to.Ptr("southeastasia"), - // Kind: to.Ptr("v12.0,user,datawarehouse"), - // Properties: &armsql.DatabaseProperties{ - // CatalogCollation: to.Ptr(armsql.CatalogCollationTypeSQLLatin1GeneralCP1CIAS), - // Collation: to.Ptr("SQL_Latin1_General_CP1_CI_AS"), - // CreationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-07-13T02:04:26.187Z"); return t}()), - // CurrentServiceObjectiveName: to.Ptr("D1"), - // DatabaseID: to.Ptr("6c764297-577b-470f-9af4-96d3d41e2ba3"), - // DefaultSecondaryLocation: to.Ptr("North Europe"), - // MaxSizeBytes: to.Ptr[int64](10995116277760), - // Status: to.Ptr(armsql.DatabaseStatusPaused), - // }, - // SKU: &armsql.SKU{ - // Name: to.Ptr("DataWarehouse"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ResumeDatabase.json -func ExampleDatabasesClient_BeginResume() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDatabasesClient().BeginResume(ctx, "Default-SQL-SouthEastAsia", "testsvr", "testdwdb", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Database = armsql.Database{ - // Name: to.Ptr("testdwdb"), - // Type: to.Ptr("Microsoft.Sql/servers/databases"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/servers/testsvr/databases/testdwdb"), - // Location: to.Ptr("southeastasia"), - // Kind: to.Ptr("v12.0,user,datawarehouse"), - // Properties: &armsql.DatabaseProperties{ - // CatalogCollation: to.Ptr(armsql.CatalogCollationTypeSQLLatin1GeneralCP1CIAS), - // Collation: to.Ptr("SQL_Latin1_General_CP1_CI_AS"), - // CreationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-07-13T02:04:26.187Z"); return t}()), - // CurrentServiceObjectiveName: to.Ptr("D1"), - // DatabaseID: to.Ptr("6c764297-577b-470f-9af4-96d3d41e2ba3"), - // DefaultSecondaryLocation: to.Ptr("North Europe"), - // MaxSizeBytes: to.Ptr[int64](10995116277760), - // Status: to.Ptr(armsql.DatabaseStatusOnline), - // }, - // SKU: &armsql.SKU{ - // Name: to.Ptr("DataWarehouse"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/UpgradeDataWarehouse.json -func ExampleDatabasesClient_BeginUpgradeDataWarehouse() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDatabasesClient().BeginUpgradeDataWarehouse(ctx, "Default-SQL-SouthEastAsia", "testsvr", "testdwdb", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ListDatabasesByElasticPool.json -func ExampleDatabasesClient_NewListByElasticPoolPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDatabasesClient().NewListByElasticPoolPager("Default-SQL-SouthEastAsia", "testsvr", "pool1", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DatabaseListResult = armsql.DatabaseListResult{ - // Value: []*armsql.Database{ - // { - // Name: to.Ptr("DB001"), - // Type: to.Ptr("Microsoft.Sql/servers/databases"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/servers/testsvr/databases/DB001"), - // Location: to.Ptr("southeastasia"), - // Kind: to.Ptr("v12.0,user"), - // Properties: &armsql.DatabaseProperties{ - // CatalogCollation: to.Ptr(armsql.CatalogCollationTypeSQLLatin1GeneralCP1CIAS), - // Collation: to.Ptr("SQL_Latin1_General_CP1_CI_AS"), - // CreationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-07-12T22:08:39.163Z"); return t}()), - // CurrentServiceObjectiveName: to.Ptr("ElasticPool"), - // DatabaseID: to.Ptr("bfe0735f-bc87-447f-b2c2-481f4b100614"), - // DefaultSecondaryLocation: to.Ptr("North Europe"), - // ElasticPoolID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/servers/testsvr/elasticPools/Pool1"), - // MaxSizeBytes: to.Ptr[int64](268435456000), - // Status: to.Ptr(armsql.DatabaseStatusOnline), - // }, - // SKU: &armsql.SKU{ - // Name: to.Ptr("ElasticPool"), - // Tier: to.Ptr("Standard"), - // }, - // }, - // { - // Name: to.Ptr("DB002"), - // Type: to.Ptr("Microsoft.Sql/servers/databases"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/servers/testsvr/databases/DB002"), - // Location: to.Ptr("southeastasia"), - // Kind: to.Ptr("v12.0,user"), - // Properties: &armsql.DatabaseProperties{ - // CatalogCollation: to.Ptr(armsql.CatalogCollationTypeSQLLatin1GeneralCP1CIAS), - // Collation: to.Ptr("SQL_Latin1_General_CP1_CI_AS"), - // CreationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-07-12T22:10:10.773Z"); return t}()), - // CurrentServiceObjectiveName: to.Ptr("ElasticPool"), - // DatabaseID: to.Ptr("82246152-3177-4357-b81c-a16d87ce3593"), - // DefaultSecondaryLocation: to.Ptr("North Europe"), - // ElasticPoolID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/servers/testsvr/elasticPools/Pool1"), - // MaxSizeBytes: to.Ptr[int64](268435456000), - // Status: to.Ptr(armsql.DatabaseStatusOnline), - // }, - // SKU: &armsql.SKU{ - // Name: to.Ptr("ElasticPool"), - // Tier: to.Ptr("Standard"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ListVCoreInaccessibleDatabasesByServer.json -func ExampleDatabasesClient_NewListInaccessibleByServerPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDatabasesClient().NewListInaccessibleByServerPager("Default-SQL-SouthEastAsia", "testsvr", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DatabaseListResult = armsql.DatabaseListResult{ - // Value: []*armsql.Database{ - // { - // Name: to.Ptr("testdb"), - // Type: to.Ptr("Microsoft.Sql/servers/databases"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/servers/testsvr/databases/testdb"), - // Location: to.Ptr("southeastasia"), - // Kind: to.Ptr("v12.0,user,vcore"), - // Properties: &armsql.DatabaseProperties{ - // CatalogCollation: to.Ptr(armsql.CatalogCollationTypeSQLLatin1GeneralCP1CIAS), - // Collation: to.Ptr("SQL_Latin1_General_CP1_CI_AS"), - // CreationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-06-07T04:41:33.937Z"); return t}()), - // CurrentServiceObjectiveName: to.Ptr("BC_Gen4_2"), - // DatabaseID: to.Ptr("6c764297-577b-470f-9af4-96d3d41e2ba3"), - // DefaultSecondaryLocation: to.Ptr("North Europe"), - // LicenseType: to.Ptr(armsql.DatabaseLicenseTypeLicenseIncluded), - // MaxLogSizeBytes: to.Ptr[int64](104857600), - // MaxSizeBytes: to.Ptr[int64](268435456000), - // ReadScale: to.Ptr(armsql.DatabaseReadScaleEnabled), - // Status: to.Ptr(armsql.DatabaseStatusInaccessible), - // }, - // SKU: &armsql.SKU{ - // Name: to.Ptr("BC_Gen4"), - // Capacity: to.Ptr[int32](2), - // Tier: to.Ptr("BusinessCritical"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/sql/armsql/databaseschemas_client.go b/sdk/resourcemanager/sql/armsql/databaseschemas_client.go index a928250857e8..25ba982e596d 100644 --- a/sdk/resourcemanager/sql/armsql/databaseschemas_client.go +++ b/sdk/resourcemanager/sql/armsql/databaseschemas_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armsql @@ -47,7 +46,7 @@ func NewDatabaseSchemasClient(subscriptionID string, credential azcore.TokenCred // Get - Get database schema // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -55,18 +54,21 @@ func NewDatabaseSchemasClient(subscriptionID string, credential azcore.TokenCred // - schemaName - The name of the schema. // - options - DatabaseSchemasClientGetOptions contains the optional parameters for the DatabaseSchemasClient.Get method. func (client *DatabaseSchemasClient) Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string, schemaName string, options *DatabaseSchemasClientGetOptions) (DatabaseSchemasClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, serverName, databaseName, schemaName, options) if err != nil { return DatabaseSchemasClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return DatabaseSchemasClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return DatabaseSchemasClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DatabaseSchemasClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -97,7 +99,7 @@ func (client *DatabaseSchemasClient) getCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -114,7 +116,7 @@ func (client *DatabaseSchemasClient) getHandleResponse(resp *http.Response) (Dat // NewListByDatabasePager - List database schemas // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -176,7 +178,7 @@ func (client *DatabaseSchemasClient) listByDatabaseCreateRequest(ctx context.Con if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/sql/armsql/databaseschemas_client_example_test.go b/sdk/resourcemanager/sql/armsql/databaseschemas_client_example_test.go deleted file mode 100644 index 47af2a422e72..000000000000 --- a/sdk/resourcemanager/sql/armsql/databaseschemas_client_example_test.go +++ /dev/null @@ -1,81 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsql_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sql/armsql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseSchemaListByDatabase.json -func ExampleDatabaseSchemasClient_NewListByDatabasePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDatabaseSchemasClient().NewListByDatabasePager("myRG", "serverName", "myDatabase", &armsql.DatabaseSchemasClientListByDatabaseOptions{Filter: nil}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DatabaseSchemaListResult = armsql.DatabaseSchemaListResult{ - // Value: []*armsql.DatabaseSchema{ - // { - // Name: to.Ptr("dbo"), - // Type: to.Ptr("Microsoft.Sql/servers/databases/schemas"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/myRG/providers/Microsoft.Sql/servers/serverName/databases/myDatabase/schemas/dbo"), - // }, - // { - // Name: to.Ptr("schema2"), - // Type: to.Ptr("Microsoft.Sql/servers/databases/schemas"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/myRG/providers/Microsoft.Sql/servers/serverName/databases/myDatabase/schemas/schema2"), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseSchemaGet.json -func ExampleDatabaseSchemasClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDatabaseSchemasClient().Get(ctx, "myRG", "serverName", "myDatabase", "dbo", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DatabaseSchema = armsql.DatabaseSchema{ - // Name: to.Ptr("dbo"), - // Type: to.Ptr("Microsoft.Sql/servers/databases/schemas"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/myRG/providers/Microsoft.Sql/servers/serverName/databases/myDatabase/schemas/dbo"), - // } -} diff --git a/sdk/resourcemanager/sql/armsql/databasesecurityalertpolicies_client.go b/sdk/resourcemanager/sql/armsql/databasesecurityalertpolicies_client.go index 796f62fe8352..cc197bd3eb5d 100644 --- a/sdk/resourcemanager/sql/armsql/databasesecurityalertpolicies_client.go +++ b/sdk/resourcemanager/sql/armsql/databasesecurityalertpolicies_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armsql @@ -47,7 +46,7 @@ func NewDatabaseSecurityAlertPoliciesClient(subscriptionID string, credential az // CreateOrUpdate - Creates or updates a database's security alert policy. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -57,18 +56,21 @@ func NewDatabaseSecurityAlertPoliciesClient(subscriptionID string, credential az // - options - DatabaseSecurityAlertPoliciesClientCreateOrUpdateOptions contains the optional parameters for the DatabaseSecurityAlertPoliciesClient.CreateOrUpdate // method. func (client *DatabaseSecurityAlertPoliciesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, databaseName string, securityAlertPolicyName SecurityAlertPolicyName, parameters DatabaseSecurityAlertPolicy, options *DatabaseSecurityAlertPoliciesClientCreateOrUpdateOptions) (DatabaseSecurityAlertPoliciesClientCreateOrUpdateResponse, error) { + var err error req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, serverName, databaseName, securityAlertPolicyName, parameters, options) if err != nil { return DatabaseSecurityAlertPoliciesClientCreateOrUpdateResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return DatabaseSecurityAlertPoliciesClientCreateOrUpdateResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { - return DatabaseSecurityAlertPoliciesClientCreateOrUpdateResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return DatabaseSecurityAlertPoliciesClientCreateOrUpdateResponse{}, err } - return client.createOrUpdateHandleResponse(resp) + resp, err := client.createOrUpdateHandleResponse(httpResp) + return resp, err } // createOrUpdateCreateRequest creates the CreateOrUpdate request. @@ -99,10 +101,13 @@ func (client *DatabaseSecurityAlertPoliciesClient) createOrUpdateCreateRequest(c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // createOrUpdateHandleResponse handles the CreateOrUpdate response. @@ -117,7 +122,7 @@ func (client *DatabaseSecurityAlertPoliciesClient) createOrUpdateHandleResponse( // Get - Gets a database's security alert policy. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -126,18 +131,21 @@ func (client *DatabaseSecurityAlertPoliciesClient) createOrUpdateHandleResponse( // - options - DatabaseSecurityAlertPoliciesClientGetOptions contains the optional parameters for the DatabaseSecurityAlertPoliciesClient.Get // method. func (client *DatabaseSecurityAlertPoliciesClient) Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string, securityAlertPolicyName SecurityAlertPolicyName, options *DatabaseSecurityAlertPoliciesClientGetOptions) (DatabaseSecurityAlertPoliciesClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, serverName, databaseName, securityAlertPolicyName, options) if err != nil { return DatabaseSecurityAlertPoliciesClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return DatabaseSecurityAlertPoliciesClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return DatabaseSecurityAlertPoliciesClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DatabaseSecurityAlertPoliciesClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -168,7 +176,7 @@ func (client *DatabaseSecurityAlertPoliciesClient) getCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -185,7 +193,7 @@ func (client *DatabaseSecurityAlertPoliciesClient) getHandleResponse(resp *http. // NewListByDatabasePager - Gets a list of database's security alert policies. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -244,7 +252,7 @@ func (client *DatabaseSecurityAlertPoliciesClient) listByDatabaseCreateRequest(c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/sql/armsql/databasesecurityalertpolicies_client_example_test.go b/sdk/resourcemanager/sql/armsql/databasesecurityalertpolicies_client_example_test.go deleted file mode 100644 index 09ae18053ada..000000000000 --- a/sdk/resourcemanager/sql/armsql/databasesecurityalertpolicies_client_example_test.go +++ /dev/null @@ -1,226 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsql_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sql/armsql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseSecurityAlertGet.json -func ExampleDatabaseSecurityAlertPoliciesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDatabaseSecurityAlertPoliciesClient().Get(ctx, "securityalert-6852", "securityalert-2080", "testdb", armsql.SecurityAlertPolicyNameDefault, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DatabaseSecurityAlertPolicy = armsql.DatabaseSecurityAlertPolicy{ - // Name: to.Ptr("Default"), - // Type: to.Ptr("Microsoft.Sql/servers/databases/securityAlertPolicies"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/securityalert-6852/providers/Microsoft.Sql/servers/securityalert-2080/databases/testdb"), - // Properties: &armsql.SecurityAlertsPolicyProperties{ - // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-04-03T04:41:33.937Z"); return t}()), - // DisabledAlerts: []*string{ - // to.Ptr("Usage_Anomaly")}, - // EmailAccountAdmins: to.Ptr(true), - // EmailAddresses: []*string{ - // to.Ptr("test@consoto.com"), - // to.Ptr("user@consoto.com")}, - // RetentionDays: to.Ptr[int32](0), - // State: to.Ptr(armsql.SecurityAlertsPolicyStateEnabled), - // StorageAccountAccessKey: to.Ptr(""), - // }, - // SystemData: &armsql.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-04-03T04:41:33.937Z"); return t}()), - // CreatedBy: to.Ptr("string"), - // CreatedByType: to.Ptr(armsql.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-04-03T04:41:33.937Z"); return t}()), - // LastModifiedBy: to.Ptr("string"), - // LastModifiedByType: to.Ptr(armsql.CreatedByTypeUser), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseSecurityAlertCreateMax.json -func ExampleDatabaseSecurityAlertPoliciesClient_CreateOrUpdate_updateADatabasesThreatDetectionPolicyWithAllParameters() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDatabaseSecurityAlertPoliciesClient().CreateOrUpdate(ctx, "securityalert-4799", "securityalert-6440", "testdb", armsql.SecurityAlertPolicyNameDefault, armsql.DatabaseSecurityAlertPolicy{ - Properties: &armsql.SecurityAlertsPolicyProperties{ - DisabledAlerts: []*string{ - to.Ptr("Sql_Injection"), - to.Ptr("Usage_Anomaly")}, - EmailAccountAdmins: to.Ptr(true), - EmailAddresses: []*string{ - to.Ptr("test@microsoft.com"), - to.Ptr("user@microsoft.com")}, - RetentionDays: to.Ptr[int32](6), - State: to.Ptr(armsql.SecurityAlertsPolicyStateEnabled), - StorageAccountAccessKey: to.Ptr("sdlfkjabc+sdlfkjsdlkfsjdfLDKFTERLKFDFKLjsdfksjdflsdkfD2342309432849328476458/3RSD=="), - StorageEndpoint: to.Ptr("https://mystorage.blob.core.windows.net"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DatabaseSecurityAlertPolicy = armsql.DatabaseSecurityAlertPolicy{ - // Name: to.Ptr("Default"), - // Type: to.Ptr("Microsoft.Sql/servers/databases/securityAlertPolicies"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/securityalert-4799/providers/Microsoft.Sql/servers/securityalert-6440/databases/testdb"), - // Properties: &armsql.SecurityAlertsPolicyProperties{ - // DisabledAlerts: []*string{ - // to.Ptr("Sql_Injection"), - // to.Ptr("Usage_Anomaly")}, - // EmailAccountAdmins: to.Ptr(true), - // EmailAddresses: []*string{ - // to.Ptr("test@microsoft.com"), - // to.Ptr("user@microsoft.com")}, - // RetentionDays: to.Ptr[int32](6), - // State: to.Ptr(armsql.SecurityAlertsPolicyStateEnabled), - // StorageAccountAccessKey: to.Ptr(""), - // StorageEndpoint: to.Ptr("https://mystorage.blob.core.windows.net"), - // }, - // SystemData: &armsql.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-04-03T04:41:33.937Z"); return t}()), - // CreatedBy: to.Ptr("string"), - // CreatedByType: to.Ptr(armsql.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-04-03T04:41:33.937Z"); return t}()), - // LastModifiedBy: to.Ptr("string"), - // LastModifiedByType: to.Ptr(armsql.CreatedByTypeUser), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseSecurityAlertCreateMin.json -func ExampleDatabaseSecurityAlertPoliciesClient_CreateOrUpdate_updateADatabasesThreatDetectionPolicyWithMinimalParameters() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDatabaseSecurityAlertPoliciesClient().CreateOrUpdate(ctx, "securityalert-4799", "securityalert-6440", "testdb", armsql.SecurityAlertPolicyNameDefault, armsql.DatabaseSecurityAlertPolicy{ - Properties: &armsql.SecurityAlertsPolicyProperties{ - State: to.Ptr(armsql.SecurityAlertsPolicyStateEnabled), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DatabaseSecurityAlertPolicy = armsql.DatabaseSecurityAlertPolicy{ - // Name: to.Ptr("Default"), - // Type: to.Ptr("Microsoft.Sql/servers/databases/securityAlertPolicies"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/securityalert-4799/providers/Microsoft.Sql/servers/securityalert-6440/databases/testdb"), - // Properties: &armsql.SecurityAlertsPolicyProperties{ - // DisabledAlerts: []*string{ - // }, - // EmailAccountAdmins: to.Ptr(true), - // EmailAddresses: []*string{ - // }, - // RetentionDays: to.Ptr[int32](0), - // State: to.Ptr(armsql.SecurityAlertsPolicyStateEnabled), - // StorageAccountAccessKey: to.Ptr(""), - // StorageEndpoint: to.Ptr(""), - // }, - // SystemData: &armsql.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-04-03T04:41:33.937Z"); return t}()), - // CreatedBy: to.Ptr("string"), - // CreatedByType: to.Ptr(armsql.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-04-03T04:41:33.937Z"); return t}()), - // LastModifiedBy: to.Ptr("string"), - // LastModifiedByType: to.Ptr(armsql.CreatedByTypeUser), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseSecurityAlertListByDatabase.json -func ExampleDatabaseSecurityAlertPoliciesClient_NewListByDatabasePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDatabaseSecurityAlertPoliciesClient().NewListByDatabasePager("securityalert-6852", "securityalert-2080", "testdb", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DatabaseSecurityAlertListResult = armsql.DatabaseSecurityAlertListResult{ - // Value: []*armsql.DatabaseSecurityAlertPolicy{ - // { - // Name: to.Ptr("Default"), - // Type: to.Ptr("Microsoft.Sql/servers/databases/securityAlertPolicies"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/securityalert-6852/providers/Microsoft.Sql/servers/securityalert-2080/databases/testdb"), - // Properties: &armsql.SecurityAlertsPolicyProperties{ - // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-04-03T04:41:33.937Z"); return t}()), - // DisabledAlerts: []*string{ - // to.Ptr("Usage_Anomaly")}, - // EmailAccountAdmins: to.Ptr(true), - // EmailAddresses: []*string{ - // to.Ptr("test@consoto.com"), - // to.Ptr("user@consoto.com")}, - // RetentionDays: to.Ptr[int32](0), - // State: to.Ptr(armsql.SecurityAlertsPolicyStateEnabled), - // StorageAccountAccessKey: to.Ptr(""), - // StorageEndpoint: to.Ptr(""), - // }, - // SystemData: &armsql.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-04-03T04:41:33.937Z"); return t}()), - // CreatedBy: to.Ptr("string"), - // CreatedByType: to.Ptr(armsql.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-04-03T04:41:33.937Z"); return t}()), - // LastModifiedBy: to.Ptr("string"), - // LastModifiedByType: to.Ptr(armsql.CreatedByTypeUser), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/sql/armsql/databasesqlvulnerabilityassessmentbaselines_client.go b/sdk/resourcemanager/sql/armsql/databasesqlvulnerabilityassessmentbaselines_client.go new file mode 100644 index 000000000000..4c574f9a4714 --- /dev/null +++ b/sdk/resourcemanager/sql/armsql/databasesqlvulnerabilityassessmentbaselines_client.go @@ -0,0 +1,281 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armsql + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// DatabaseSQLVulnerabilityAssessmentBaselinesClient contains the methods for the DatabaseSQLVulnerabilityAssessmentBaselines group. +// Don't use this type directly, use NewDatabaseSQLVulnerabilityAssessmentBaselinesClient() instead. +type DatabaseSQLVulnerabilityAssessmentBaselinesClient struct { + internal *arm.Client + subscriptionID string +} + +// NewDatabaseSQLVulnerabilityAssessmentBaselinesClient creates a new instance of DatabaseSQLVulnerabilityAssessmentBaselinesClient with the specified values. +// - subscriptionID - The subscription ID that identifies an Azure subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewDatabaseSQLVulnerabilityAssessmentBaselinesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*DatabaseSQLVulnerabilityAssessmentBaselinesClient, error) { + cl, err := arm.NewClient(moduleName+".DatabaseSQLVulnerabilityAssessmentBaselinesClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &DatabaseSQLVulnerabilityAssessmentBaselinesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// CreateOrUpdate - Add a database's vulnerability assessment rule baseline list. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-11-01-preview +// - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure +// Resource Manager API or the portal. +// - serverName - The name of the server. +// - databaseName - The name of the database. +// - vulnerabilityAssessmentName - The name of the vulnerability assessment. +// - parameters - The requested rule baseline resource. +// - options - DatabaseSQLVulnerabilityAssessmentBaselinesClientCreateOrUpdateOptions contains the optional parameters for the +// DatabaseSQLVulnerabilityAssessmentBaselinesClient.CreateOrUpdate method. +func (client *DatabaseSQLVulnerabilityAssessmentBaselinesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, databaseName string, vulnerabilityAssessmentName VulnerabilityAssessmentName, baselineName BaselineName, parameters DatabaseSQLVulnerabilityAssessmentRuleBaselineListInput, options *DatabaseSQLVulnerabilityAssessmentBaselinesClientCreateOrUpdateOptions) (DatabaseSQLVulnerabilityAssessmentBaselinesClientCreateOrUpdateResponse, error) { + var err error + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, baselineName, parameters, options) + if err != nil { + return DatabaseSQLVulnerabilityAssessmentBaselinesClientCreateOrUpdateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return DatabaseSQLVulnerabilityAssessmentBaselinesClientCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DatabaseSQLVulnerabilityAssessmentBaselinesClientCreateOrUpdateResponse{}, err + } + resp, err := client.createOrUpdateHandleResponse(httpResp) + return resp, err +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *DatabaseSQLVulnerabilityAssessmentBaselinesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, serverName string, databaseName string, vulnerabilityAssessmentName VulnerabilityAssessmentName, baselineName BaselineName, parameters DatabaseSQLVulnerabilityAssessmentRuleBaselineListInput, options *DatabaseSQLVulnerabilityAssessmentBaselinesClientCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/sqlVulnerabilityAssessments/{vulnerabilityAssessmentName}/baselines/{baselineName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serverName == "" { + return nil, errors.New("parameter serverName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serverName}", url.PathEscape(serverName)) + if databaseName == "" { + return nil, errors.New("parameter databaseName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{databaseName}", url.PathEscape(databaseName)) + if vulnerabilityAssessmentName == "" { + return nil, errors.New("parameter vulnerabilityAssessmentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vulnerabilityAssessmentName}", url.PathEscape(string(vulnerabilityAssessmentName))) + if baselineName == "" { + return nil, errors.New("parameter baselineName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{baselineName}", url.PathEscape(string(baselineName))) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// createOrUpdateHandleResponse handles the CreateOrUpdate response. +func (client *DatabaseSQLVulnerabilityAssessmentBaselinesClient) createOrUpdateHandleResponse(resp *http.Response) (DatabaseSQLVulnerabilityAssessmentBaselinesClientCreateOrUpdateResponse, error) { + result := DatabaseSQLVulnerabilityAssessmentBaselinesClientCreateOrUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DatabaseSQLVulnerabilityAssessmentBaselineSet); err != nil { + return DatabaseSQLVulnerabilityAssessmentBaselinesClientCreateOrUpdateResponse{}, err + } + return result, nil +} + +// Get - Gets a list of database's sql vulnerability assessment rule baselines. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-11-01-preview +// - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure +// Resource Manager API or the portal. +// - serverName - The name of the server. +// - databaseName - The name of the database. +// - vulnerabilityAssessmentName - The name of the vulnerability assessment. +// - options - DatabaseSQLVulnerabilityAssessmentBaselinesClientGetOptions contains the optional parameters for the DatabaseSQLVulnerabilityAssessmentBaselinesClient.Get +// method. +func (client *DatabaseSQLVulnerabilityAssessmentBaselinesClient) Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string, vulnerabilityAssessmentName VulnerabilityAssessmentName, baselineName BaselineName, options *DatabaseSQLVulnerabilityAssessmentBaselinesClientGetOptions) (DatabaseSQLVulnerabilityAssessmentBaselinesClientGetResponse, error) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, baselineName, options) + if err != nil { + return DatabaseSQLVulnerabilityAssessmentBaselinesClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return DatabaseSQLVulnerabilityAssessmentBaselinesClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DatabaseSQLVulnerabilityAssessmentBaselinesClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *DatabaseSQLVulnerabilityAssessmentBaselinesClient) getCreateRequest(ctx context.Context, resourceGroupName string, serverName string, databaseName string, vulnerabilityAssessmentName VulnerabilityAssessmentName, baselineName BaselineName, options *DatabaseSQLVulnerabilityAssessmentBaselinesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/sqlVulnerabilityAssessments/{vulnerabilityAssessmentName}/baselines/{baselineName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serverName == "" { + return nil, errors.New("parameter serverName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serverName}", url.PathEscape(serverName)) + if databaseName == "" { + return nil, errors.New("parameter databaseName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{databaseName}", url.PathEscape(databaseName)) + if vulnerabilityAssessmentName == "" { + return nil, errors.New("parameter vulnerabilityAssessmentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vulnerabilityAssessmentName}", url.PathEscape(string(vulnerabilityAssessmentName))) + if baselineName == "" { + return nil, errors.New("parameter baselineName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{baselineName}", url.PathEscape(string(baselineName))) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *DatabaseSQLVulnerabilityAssessmentBaselinesClient) getHandleResponse(resp *http.Response) (DatabaseSQLVulnerabilityAssessmentBaselinesClientGetResponse, error) { + result := DatabaseSQLVulnerabilityAssessmentBaselinesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DatabaseSQLVulnerabilityAssessmentBaselineSet); err != nil { + return DatabaseSQLVulnerabilityAssessmentBaselinesClientGetResponse{}, err + } + return result, nil +} + +// NewListBySQLVulnerabilityAssessmentPager - Gets a list of database's sql vulnerability assessment rule baselines. +// +// Generated from API version 2022-11-01-preview +// - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure +// Resource Manager API or the portal. +// - serverName - The name of the server. +// - databaseName - The name of the database. +// - vulnerabilityAssessmentName - The name of the vulnerability assessment. +// - options - DatabaseSQLVulnerabilityAssessmentBaselinesClientListBySQLVulnerabilityAssessmentOptions contains the optional +// parameters for the DatabaseSQLVulnerabilityAssessmentBaselinesClient.NewListBySQLVulnerabilityAssessmentPager method. +func (client *DatabaseSQLVulnerabilityAssessmentBaselinesClient) NewListBySQLVulnerabilityAssessmentPager(resourceGroupName string, serverName string, databaseName string, vulnerabilityAssessmentName VulnerabilityAssessmentName, options *DatabaseSQLVulnerabilityAssessmentBaselinesClientListBySQLVulnerabilityAssessmentOptions) *runtime.Pager[DatabaseSQLVulnerabilityAssessmentBaselinesClientListBySQLVulnerabilityAssessmentResponse] { + return runtime.NewPager(runtime.PagingHandler[DatabaseSQLVulnerabilityAssessmentBaselinesClientListBySQLVulnerabilityAssessmentResponse]{ + More: func(page DatabaseSQLVulnerabilityAssessmentBaselinesClientListBySQLVulnerabilityAssessmentResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *DatabaseSQLVulnerabilityAssessmentBaselinesClientListBySQLVulnerabilityAssessmentResponse) (DatabaseSQLVulnerabilityAssessmentBaselinesClientListBySQLVulnerabilityAssessmentResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listBySQLVulnerabilityAssessmentCreateRequest(ctx, resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return DatabaseSQLVulnerabilityAssessmentBaselinesClientListBySQLVulnerabilityAssessmentResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return DatabaseSQLVulnerabilityAssessmentBaselinesClientListBySQLVulnerabilityAssessmentResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return DatabaseSQLVulnerabilityAssessmentBaselinesClientListBySQLVulnerabilityAssessmentResponse{}, runtime.NewResponseError(resp) + } + return client.listBySQLVulnerabilityAssessmentHandleResponse(resp) + }, + }) +} + +// listBySQLVulnerabilityAssessmentCreateRequest creates the ListBySQLVulnerabilityAssessment request. +func (client *DatabaseSQLVulnerabilityAssessmentBaselinesClient) listBySQLVulnerabilityAssessmentCreateRequest(ctx context.Context, resourceGroupName string, serverName string, databaseName string, vulnerabilityAssessmentName VulnerabilityAssessmentName, options *DatabaseSQLVulnerabilityAssessmentBaselinesClientListBySQLVulnerabilityAssessmentOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/sqlVulnerabilityAssessments/{vulnerabilityAssessmentName}/baselines" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serverName == "" { + return nil, errors.New("parameter serverName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serverName}", url.PathEscape(serverName)) + if databaseName == "" { + return nil, errors.New("parameter databaseName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{databaseName}", url.PathEscape(databaseName)) + if vulnerabilityAssessmentName == "" { + return nil, errors.New("parameter vulnerabilityAssessmentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vulnerabilityAssessmentName}", url.PathEscape(string(vulnerabilityAssessmentName))) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listBySQLVulnerabilityAssessmentHandleResponse handles the ListBySQLVulnerabilityAssessment response. +func (client *DatabaseSQLVulnerabilityAssessmentBaselinesClient) listBySQLVulnerabilityAssessmentHandleResponse(resp *http.Response) (DatabaseSQLVulnerabilityAssessmentBaselinesClientListBySQLVulnerabilityAssessmentResponse, error) { + result := DatabaseSQLVulnerabilityAssessmentBaselinesClientListBySQLVulnerabilityAssessmentResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DatabaseSQLVulnerabilityAssessmentBaselineSetListResult); err != nil { + return DatabaseSQLVulnerabilityAssessmentBaselinesClientListBySQLVulnerabilityAssessmentResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/sql/armsql/databasesqlvulnerabilityassessmentexecutescan_client.go b/sdk/resourcemanager/sql/armsql/databasesqlvulnerabilityassessmentexecutescan_client.go new file mode 100644 index 000000000000..ae489769ccfb --- /dev/null +++ b/sdk/resourcemanager/sql/armsql/databasesqlvulnerabilityassessmentexecutescan_client.go @@ -0,0 +1,122 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armsql + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// DatabaseSQLVulnerabilityAssessmentExecuteScanClient contains the methods for the DatabaseSQLVulnerabilityAssessmentExecuteScan group. +// Don't use this type directly, use NewDatabaseSQLVulnerabilityAssessmentExecuteScanClient() instead. +type DatabaseSQLVulnerabilityAssessmentExecuteScanClient struct { + internal *arm.Client + subscriptionID string +} + +// NewDatabaseSQLVulnerabilityAssessmentExecuteScanClient creates a new instance of DatabaseSQLVulnerabilityAssessmentExecuteScanClient with the specified values. +// - subscriptionID - The subscription ID that identifies an Azure subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewDatabaseSQLVulnerabilityAssessmentExecuteScanClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*DatabaseSQLVulnerabilityAssessmentExecuteScanClient, error) { + cl, err := arm.NewClient(moduleName+".DatabaseSQLVulnerabilityAssessmentExecuteScanClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &DatabaseSQLVulnerabilityAssessmentExecuteScanClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginExecute - Executes a Vulnerability Assessment database scan. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-11-01-preview +// - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure +// Resource Manager API or the portal. +// - serverName - The name of the server. +// - databaseName - The name of the database. +// - vulnerabilityAssessmentName - The name of the vulnerability assessment. +// - options - DatabaseSQLVulnerabilityAssessmentExecuteScanClientBeginExecuteOptions contains the optional parameters for the +// DatabaseSQLVulnerabilityAssessmentExecuteScanClient.BeginExecute method. +func (client *DatabaseSQLVulnerabilityAssessmentExecuteScanClient) BeginExecute(ctx context.Context, resourceGroupName string, serverName string, databaseName string, vulnerabilityAssessmentName VulnerabilityAssessmentName, options *DatabaseSQLVulnerabilityAssessmentExecuteScanClientBeginExecuteOptions) (*runtime.Poller[DatabaseSQLVulnerabilityAssessmentExecuteScanClientExecuteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.execute(ctx, resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller[DatabaseSQLVulnerabilityAssessmentExecuteScanClientExecuteResponse](resp, client.internal.Pipeline(), nil) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[DatabaseSQLVulnerabilityAssessmentExecuteScanClientExecuteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Execute - Executes a Vulnerability Assessment database scan. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-11-01-preview +func (client *DatabaseSQLVulnerabilityAssessmentExecuteScanClient) execute(ctx context.Context, resourceGroupName string, serverName string, databaseName string, vulnerabilityAssessmentName VulnerabilityAssessmentName, options *DatabaseSQLVulnerabilityAssessmentExecuteScanClientBeginExecuteOptions) (*http.Response, error) { + var err error + req, err := client.executeCreateRequest(ctx, resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// executeCreateRequest creates the Execute request. +func (client *DatabaseSQLVulnerabilityAssessmentExecuteScanClient) executeCreateRequest(ctx context.Context, resourceGroupName string, serverName string, databaseName string, vulnerabilityAssessmentName VulnerabilityAssessmentName, options *DatabaseSQLVulnerabilityAssessmentExecuteScanClientBeginExecuteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/sqlVulnerabilityAssessments/{vulnerabilityAssessmentName}/initiateScan" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serverName == "" { + return nil, errors.New("parameter serverName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serverName}", url.PathEscape(serverName)) + if databaseName == "" { + return nil, errors.New("parameter databaseName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{databaseName}", url.PathEscape(databaseName)) + if vulnerabilityAssessmentName == "" { + return nil, errors.New("parameter vulnerabilityAssessmentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vulnerabilityAssessmentName}", url.PathEscape(string(vulnerabilityAssessmentName))) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + return req, nil +} diff --git a/sdk/resourcemanager/sql/armsql/databasesqlvulnerabilityassessmentrulebaselines_client.go b/sdk/resourcemanager/sql/armsql/databasesqlvulnerabilityassessmentrulebaselines_client.go new file mode 100644 index 000000000000..f49c8efcb321 --- /dev/null +++ b/sdk/resourcemanager/sql/armsql/databasesqlvulnerabilityassessmentrulebaselines_client.go @@ -0,0 +1,365 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armsql + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// DatabaseSQLVulnerabilityAssessmentRuleBaselinesClient contains the methods for the DatabaseSQLVulnerabilityAssessmentRuleBaselines group. +// Don't use this type directly, use NewDatabaseSQLVulnerabilityAssessmentRuleBaselinesClient() instead. +type DatabaseSQLVulnerabilityAssessmentRuleBaselinesClient struct { + internal *arm.Client + subscriptionID string +} + +// NewDatabaseSQLVulnerabilityAssessmentRuleBaselinesClient creates a new instance of DatabaseSQLVulnerabilityAssessmentRuleBaselinesClient with the specified values. +// - subscriptionID - The subscription ID that identifies an Azure subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewDatabaseSQLVulnerabilityAssessmentRuleBaselinesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*DatabaseSQLVulnerabilityAssessmentRuleBaselinesClient, error) { + cl, err := arm.NewClient(moduleName+".DatabaseSQLVulnerabilityAssessmentRuleBaselinesClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &DatabaseSQLVulnerabilityAssessmentRuleBaselinesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// CreateOrUpdate - Creates or updates a database's vulnerability assessment rule baseline. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-11-01-preview +// - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure +// Resource Manager API or the portal. +// - serverName - The name of the server. +// - databaseName - The name of the database. +// - vulnerabilityAssessmentName - The name of the vulnerability assessment. +// - ruleID - The vulnerability assessment rule ID. +// - parameters - The requested rule baseline resource. +// - options - DatabaseSQLVulnerabilityAssessmentRuleBaselinesClientCreateOrUpdateOptions contains the optional parameters for +// the DatabaseSQLVulnerabilityAssessmentRuleBaselinesClient.CreateOrUpdate method. +func (client *DatabaseSQLVulnerabilityAssessmentRuleBaselinesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, databaseName string, vulnerabilityAssessmentName VulnerabilityAssessmentName, baselineName BaselineName, ruleID string, parameters DatabaseSQLVulnerabilityAssessmentRuleBaselineInput, options *DatabaseSQLVulnerabilityAssessmentRuleBaselinesClientCreateOrUpdateOptions) (DatabaseSQLVulnerabilityAssessmentRuleBaselinesClientCreateOrUpdateResponse, error) { + var err error + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, baselineName, ruleID, parameters, options) + if err != nil { + return DatabaseSQLVulnerabilityAssessmentRuleBaselinesClientCreateOrUpdateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return DatabaseSQLVulnerabilityAssessmentRuleBaselinesClientCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DatabaseSQLVulnerabilityAssessmentRuleBaselinesClientCreateOrUpdateResponse{}, err + } + resp, err := client.createOrUpdateHandleResponse(httpResp) + return resp, err +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *DatabaseSQLVulnerabilityAssessmentRuleBaselinesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, serverName string, databaseName string, vulnerabilityAssessmentName VulnerabilityAssessmentName, baselineName BaselineName, ruleID string, parameters DatabaseSQLVulnerabilityAssessmentRuleBaselineInput, options *DatabaseSQLVulnerabilityAssessmentRuleBaselinesClientCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/sqlVulnerabilityAssessments/{vulnerabilityAssessmentName}/baselines/{baselineName}/rules/{ruleId}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serverName == "" { + return nil, errors.New("parameter serverName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serverName}", url.PathEscape(serverName)) + if databaseName == "" { + return nil, errors.New("parameter databaseName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{databaseName}", url.PathEscape(databaseName)) + if vulnerabilityAssessmentName == "" { + return nil, errors.New("parameter vulnerabilityAssessmentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vulnerabilityAssessmentName}", url.PathEscape(string(vulnerabilityAssessmentName))) + if baselineName == "" { + return nil, errors.New("parameter baselineName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{baselineName}", url.PathEscape(string(baselineName))) + if ruleID == "" { + return nil, errors.New("parameter ruleID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{ruleId}", url.PathEscape(ruleID)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// createOrUpdateHandleResponse handles the CreateOrUpdate response. +func (client *DatabaseSQLVulnerabilityAssessmentRuleBaselinesClient) createOrUpdateHandleResponse(resp *http.Response) (DatabaseSQLVulnerabilityAssessmentRuleBaselinesClientCreateOrUpdateResponse, error) { + result := DatabaseSQLVulnerabilityAssessmentRuleBaselinesClientCreateOrUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DatabaseSQLVulnerabilityAssessmentRuleBaseline); err != nil { + return DatabaseSQLVulnerabilityAssessmentRuleBaselinesClientCreateOrUpdateResponse{}, err + } + return result, nil +} + +// Delete - Removes the database's vulnerability assessment rule baseline. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-11-01-preview +// - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure +// Resource Manager API or the portal. +// - serverName - The name of the server. +// - databaseName - The name of the database. +// - vulnerabilityAssessmentName - The name of the vulnerability assessment. +// - ruleID - The vulnerability assessment rule ID. +// - options - DatabaseSQLVulnerabilityAssessmentRuleBaselinesClientDeleteOptions contains the optional parameters for the DatabaseSQLVulnerabilityAssessmentRuleBaselinesClient.Delete +// method. +func (client *DatabaseSQLVulnerabilityAssessmentRuleBaselinesClient) Delete(ctx context.Context, resourceGroupName string, serverName string, databaseName string, vulnerabilityAssessmentName VulnerabilityAssessmentName, baselineName BaselineName, ruleID string, options *DatabaseSQLVulnerabilityAssessmentRuleBaselinesClientDeleteOptions) (DatabaseSQLVulnerabilityAssessmentRuleBaselinesClientDeleteResponse, error) { + var err error + req, err := client.deleteCreateRequest(ctx, resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, baselineName, ruleID, options) + if err != nil { + return DatabaseSQLVulnerabilityAssessmentRuleBaselinesClientDeleteResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return DatabaseSQLVulnerabilityAssessmentRuleBaselinesClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return DatabaseSQLVulnerabilityAssessmentRuleBaselinesClientDeleteResponse{}, err + } + return DatabaseSQLVulnerabilityAssessmentRuleBaselinesClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *DatabaseSQLVulnerabilityAssessmentRuleBaselinesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, serverName string, databaseName string, vulnerabilityAssessmentName VulnerabilityAssessmentName, baselineName BaselineName, ruleID string, options *DatabaseSQLVulnerabilityAssessmentRuleBaselinesClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/sqlVulnerabilityAssessments/{vulnerabilityAssessmentName}/baselines/{baselineName}/rules/{ruleId}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serverName == "" { + return nil, errors.New("parameter serverName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serverName}", url.PathEscape(serverName)) + if databaseName == "" { + return nil, errors.New("parameter databaseName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{databaseName}", url.PathEscape(databaseName)) + if vulnerabilityAssessmentName == "" { + return nil, errors.New("parameter vulnerabilityAssessmentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vulnerabilityAssessmentName}", url.PathEscape(string(vulnerabilityAssessmentName))) + if baselineName == "" { + return nil, errors.New("parameter baselineName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{baselineName}", url.PathEscape(string(baselineName))) + if ruleID == "" { + return nil, errors.New("parameter ruleID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{ruleId}", url.PathEscape(ruleID)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + return req, nil +} + +// Get - Gets a database's sql vulnerability assessment rule baseline. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-11-01-preview +// - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure +// Resource Manager API or the portal. +// - serverName - The name of the server. +// - databaseName - The name of the database. +// - vulnerabilityAssessmentName - The name of the vulnerability assessment. +// - ruleID - The vulnerability assessment rule ID. +// - options - DatabaseSQLVulnerabilityAssessmentRuleBaselinesClientGetOptions contains the optional parameters for the DatabaseSQLVulnerabilityAssessmentRuleBaselinesClient.Get +// method. +func (client *DatabaseSQLVulnerabilityAssessmentRuleBaselinesClient) Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string, vulnerabilityAssessmentName VulnerabilityAssessmentName, baselineName BaselineName, ruleID string, options *DatabaseSQLVulnerabilityAssessmentRuleBaselinesClientGetOptions) (DatabaseSQLVulnerabilityAssessmentRuleBaselinesClientGetResponse, error) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, baselineName, ruleID, options) + if err != nil { + return DatabaseSQLVulnerabilityAssessmentRuleBaselinesClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return DatabaseSQLVulnerabilityAssessmentRuleBaselinesClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DatabaseSQLVulnerabilityAssessmentRuleBaselinesClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *DatabaseSQLVulnerabilityAssessmentRuleBaselinesClient) getCreateRequest(ctx context.Context, resourceGroupName string, serverName string, databaseName string, vulnerabilityAssessmentName VulnerabilityAssessmentName, baselineName BaselineName, ruleID string, options *DatabaseSQLVulnerabilityAssessmentRuleBaselinesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/sqlVulnerabilityAssessments/{vulnerabilityAssessmentName}/baselines/{baselineName}/rules/{ruleId}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serverName == "" { + return nil, errors.New("parameter serverName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serverName}", url.PathEscape(serverName)) + if databaseName == "" { + return nil, errors.New("parameter databaseName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{databaseName}", url.PathEscape(databaseName)) + if vulnerabilityAssessmentName == "" { + return nil, errors.New("parameter vulnerabilityAssessmentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vulnerabilityAssessmentName}", url.PathEscape(string(vulnerabilityAssessmentName))) + if baselineName == "" { + return nil, errors.New("parameter baselineName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{baselineName}", url.PathEscape(string(baselineName))) + if ruleID == "" { + return nil, errors.New("parameter ruleID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{ruleId}", url.PathEscape(ruleID)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *DatabaseSQLVulnerabilityAssessmentRuleBaselinesClient) getHandleResponse(resp *http.Response) (DatabaseSQLVulnerabilityAssessmentRuleBaselinesClientGetResponse, error) { + result := DatabaseSQLVulnerabilityAssessmentRuleBaselinesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DatabaseSQLVulnerabilityAssessmentRuleBaseline); err != nil { + return DatabaseSQLVulnerabilityAssessmentRuleBaselinesClientGetResponse{}, err + } + return result, nil +} + +// NewListByBaselinePager - Gets a list of database's sql vulnerability assessment rule baselines. +// +// Generated from API version 2022-11-01-preview +// - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure +// Resource Manager API or the portal. +// - serverName - The name of the server. +// - databaseName - The name of the database. +// - vulnerabilityAssessmentName - The name of the vulnerability assessment. +// - options - DatabaseSQLVulnerabilityAssessmentRuleBaselinesClientListByBaselineOptions contains the optional parameters for +// the DatabaseSQLVulnerabilityAssessmentRuleBaselinesClient.NewListByBaselinePager method. +func (client *DatabaseSQLVulnerabilityAssessmentRuleBaselinesClient) NewListByBaselinePager(resourceGroupName string, serverName string, databaseName string, vulnerabilityAssessmentName VulnerabilityAssessmentName, baselineName BaselineName, options *DatabaseSQLVulnerabilityAssessmentRuleBaselinesClientListByBaselineOptions) *runtime.Pager[DatabaseSQLVulnerabilityAssessmentRuleBaselinesClientListByBaselineResponse] { + return runtime.NewPager(runtime.PagingHandler[DatabaseSQLVulnerabilityAssessmentRuleBaselinesClientListByBaselineResponse]{ + More: func(page DatabaseSQLVulnerabilityAssessmentRuleBaselinesClientListByBaselineResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *DatabaseSQLVulnerabilityAssessmentRuleBaselinesClientListByBaselineResponse) (DatabaseSQLVulnerabilityAssessmentRuleBaselinesClientListByBaselineResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByBaselineCreateRequest(ctx, resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, baselineName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return DatabaseSQLVulnerabilityAssessmentRuleBaselinesClientListByBaselineResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return DatabaseSQLVulnerabilityAssessmentRuleBaselinesClientListByBaselineResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return DatabaseSQLVulnerabilityAssessmentRuleBaselinesClientListByBaselineResponse{}, runtime.NewResponseError(resp) + } + return client.listByBaselineHandleResponse(resp) + }, + }) +} + +// listByBaselineCreateRequest creates the ListByBaseline request. +func (client *DatabaseSQLVulnerabilityAssessmentRuleBaselinesClient) listByBaselineCreateRequest(ctx context.Context, resourceGroupName string, serverName string, databaseName string, vulnerabilityAssessmentName VulnerabilityAssessmentName, baselineName BaselineName, options *DatabaseSQLVulnerabilityAssessmentRuleBaselinesClientListByBaselineOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/sqlVulnerabilityAssessments/{vulnerabilityAssessmentName}/baselines/{baselineName}/rules" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serverName == "" { + return nil, errors.New("parameter serverName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serverName}", url.PathEscape(serverName)) + if databaseName == "" { + return nil, errors.New("parameter databaseName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{databaseName}", url.PathEscape(databaseName)) + if vulnerabilityAssessmentName == "" { + return nil, errors.New("parameter vulnerabilityAssessmentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vulnerabilityAssessmentName}", url.PathEscape(string(vulnerabilityAssessmentName))) + if baselineName == "" { + return nil, errors.New("parameter baselineName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{baselineName}", url.PathEscape(string(baselineName))) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByBaselineHandleResponse handles the ListByBaseline response. +func (client *DatabaseSQLVulnerabilityAssessmentRuleBaselinesClient) listByBaselineHandleResponse(resp *http.Response) (DatabaseSQLVulnerabilityAssessmentRuleBaselinesClientListByBaselineResponse, error) { + result := DatabaseSQLVulnerabilityAssessmentRuleBaselinesClientListByBaselineResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DatabaseSQLVulnerabilityAssessmentRuleBaselineListResult); err != nil { + return DatabaseSQLVulnerabilityAssessmentRuleBaselinesClientListByBaselineResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/sql/armsql/databasesqlvulnerabilityassessmentscanresult_client.go b/sdk/resourcemanager/sql/armsql/databasesqlvulnerabilityassessmentscanresult_client.go new file mode 100644 index 000000000000..3918cddf2389 --- /dev/null +++ b/sdk/resourcemanager/sql/armsql/databasesqlvulnerabilityassessmentscanresult_client.go @@ -0,0 +1,212 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armsql + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// DatabaseSQLVulnerabilityAssessmentScanResultClient contains the methods for the DatabaseSQLVulnerabilityAssessmentScanResult group. +// Don't use this type directly, use NewDatabaseSQLVulnerabilityAssessmentScanResultClient() instead. +type DatabaseSQLVulnerabilityAssessmentScanResultClient struct { + internal *arm.Client + subscriptionID string +} + +// NewDatabaseSQLVulnerabilityAssessmentScanResultClient creates a new instance of DatabaseSQLVulnerabilityAssessmentScanResultClient with the specified values. +// - subscriptionID - The subscription ID that identifies an Azure subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewDatabaseSQLVulnerabilityAssessmentScanResultClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*DatabaseSQLVulnerabilityAssessmentScanResultClient, error) { + cl, err := arm.NewClient(moduleName+".DatabaseSQLVulnerabilityAssessmentScanResultClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &DatabaseSQLVulnerabilityAssessmentScanResultClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Get - Gets a vulnerability assessment scan record of a database. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-11-01-preview +// - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure +// Resource Manager API or the portal. +// - serverName - The name of the server. +// - databaseName - The name of the database. +// - vulnerabilityAssessmentName - The name of the SQL Vulnerability Assessment. +// - scanID - The scan id of the SQL Vulnerability Assessment scan to retrieve result from. +// - scanResultID - The scan result id of the specific result to retrieve. +// - options - DatabaseSQLVulnerabilityAssessmentScanResultClientGetOptions contains the optional parameters for the DatabaseSQLVulnerabilityAssessmentScanResultClient.Get +// method. +func (client *DatabaseSQLVulnerabilityAssessmentScanResultClient) Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string, vulnerabilityAssessmentName SQLVulnerabilityAssessmentName, scanID string, scanResultID string, options *DatabaseSQLVulnerabilityAssessmentScanResultClientGetOptions) (DatabaseSQLVulnerabilityAssessmentScanResultClientGetResponse, error) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, scanID, scanResultID, options) + if err != nil { + return DatabaseSQLVulnerabilityAssessmentScanResultClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return DatabaseSQLVulnerabilityAssessmentScanResultClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DatabaseSQLVulnerabilityAssessmentScanResultClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *DatabaseSQLVulnerabilityAssessmentScanResultClient) getCreateRequest(ctx context.Context, resourceGroupName string, serverName string, databaseName string, vulnerabilityAssessmentName SQLVulnerabilityAssessmentName, scanID string, scanResultID string, options *DatabaseSQLVulnerabilityAssessmentScanResultClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/sqlVulnerabilityAssessments/{vulnerabilityAssessmentName}/scans/{scanId}/scanResults/{scanResultId}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serverName == "" { + return nil, errors.New("parameter serverName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serverName}", url.PathEscape(serverName)) + if databaseName == "" { + return nil, errors.New("parameter databaseName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{databaseName}", url.PathEscape(databaseName)) + if vulnerabilityAssessmentName == "" { + return nil, errors.New("parameter vulnerabilityAssessmentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vulnerabilityAssessmentName}", url.PathEscape(string(vulnerabilityAssessmentName))) + if scanID == "" { + return nil, errors.New("parameter scanID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{scanId}", url.PathEscape(scanID)) + if scanResultID == "" { + return nil, errors.New("parameter scanResultID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{scanResultId}", url.PathEscape(scanResultID)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *DatabaseSQLVulnerabilityAssessmentScanResultClient) getHandleResponse(resp *http.Response) (DatabaseSQLVulnerabilityAssessmentScanResultClientGetResponse, error) { + result := DatabaseSQLVulnerabilityAssessmentScanResultClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.VulnerabilityAssessmentScanResults); err != nil { + return DatabaseSQLVulnerabilityAssessmentScanResultClientGetResponse{}, err + } + return result, nil +} + +// NewListByScanPager - Gets a vulnerability assessment scan record of a database. +// +// Generated from API version 2022-11-01-preview +// - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure +// Resource Manager API or the portal. +// - serverName - The name of the server. +// - databaseName - The name of the database. +// - vulnerabilityAssessmentName - The name of the SQL Vulnerability Assessment. +// - scanID - The scan id of the SQL Vulnerability Assessment scan to retrieve result from. +// - options - DatabaseSQLVulnerabilityAssessmentScanResultClientListByScanOptions contains the optional parameters for the +// DatabaseSQLVulnerabilityAssessmentScanResultClient.NewListByScanPager method. +func (client *DatabaseSQLVulnerabilityAssessmentScanResultClient) NewListByScanPager(resourceGroupName string, serverName string, databaseName string, vulnerabilityAssessmentName SQLVulnerabilityAssessmentName, scanID string, options *DatabaseSQLVulnerabilityAssessmentScanResultClientListByScanOptions) *runtime.Pager[DatabaseSQLVulnerabilityAssessmentScanResultClientListByScanResponse] { + return runtime.NewPager(runtime.PagingHandler[DatabaseSQLVulnerabilityAssessmentScanResultClientListByScanResponse]{ + More: func(page DatabaseSQLVulnerabilityAssessmentScanResultClientListByScanResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *DatabaseSQLVulnerabilityAssessmentScanResultClientListByScanResponse) (DatabaseSQLVulnerabilityAssessmentScanResultClientListByScanResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByScanCreateRequest(ctx, resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, scanID, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return DatabaseSQLVulnerabilityAssessmentScanResultClientListByScanResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return DatabaseSQLVulnerabilityAssessmentScanResultClientListByScanResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return DatabaseSQLVulnerabilityAssessmentScanResultClientListByScanResponse{}, runtime.NewResponseError(resp) + } + return client.listByScanHandleResponse(resp) + }, + }) +} + +// listByScanCreateRequest creates the ListByScan request. +func (client *DatabaseSQLVulnerabilityAssessmentScanResultClient) listByScanCreateRequest(ctx context.Context, resourceGroupName string, serverName string, databaseName string, vulnerabilityAssessmentName SQLVulnerabilityAssessmentName, scanID string, options *DatabaseSQLVulnerabilityAssessmentScanResultClientListByScanOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/sqlVulnerabilityAssessments/{vulnerabilityAssessmentName}/scans/{scanId}/scanResults" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serverName == "" { + return nil, errors.New("parameter serverName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serverName}", url.PathEscape(serverName)) + if databaseName == "" { + return nil, errors.New("parameter databaseName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{databaseName}", url.PathEscape(databaseName)) + if vulnerabilityAssessmentName == "" { + return nil, errors.New("parameter vulnerabilityAssessmentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vulnerabilityAssessmentName}", url.PathEscape(string(vulnerabilityAssessmentName))) + if scanID == "" { + return nil, errors.New("parameter scanID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{scanId}", url.PathEscape(scanID)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByScanHandleResponse handles the ListByScan response. +func (client *DatabaseSQLVulnerabilityAssessmentScanResultClient) listByScanHandleResponse(resp *http.Response) (DatabaseSQLVulnerabilityAssessmentScanResultClientListByScanResponse, error) { + result := DatabaseSQLVulnerabilityAssessmentScanResultClientListByScanResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.VulnerabilityAssessmentScanListResult); err != nil { + return DatabaseSQLVulnerabilityAssessmentScanResultClientListByScanResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/sql/armsql/databasesqlvulnerabilityassessmentscans_client.go b/sdk/resourcemanager/sql/armsql/databasesqlvulnerabilityassessmentscans_client.go new file mode 100644 index 000000000000..e2ba3f484684 --- /dev/null +++ b/sdk/resourcemanager/sql/armsql/databasesqlvulnerabilityassessmentscans_client.go @@ -0,0 +1,202 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armsql + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// DatabaseSQLVulnerabilityAssessmentScansClient contains the methods for the DatabaseSQLVulnerabilityAssessmentScans group. +// Don't use this type directly, use NewDatabaseSQLVulnerabilityAssessmentScansClient() instead. +type DatabaseSQLVulnerabilityAssessmentScansClient struct { + internal *arm.Client + subscriptionID string +} + +// NewDatabaseSQLVulnerabilityAssessmentScansClient creates a new instance of DatabaseSQLVulnerabilityAssessmentScansClient with the specified values. +// - subscriptionID - The subscription ID that identifies an Azure subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewDatabaseSQLVulnerabilityAssessmentScansClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*DatabaseSQLVulnerabilityAssessmentScansClient, error) { + cl, err := arm.NewClient(moduleName+".DatabaseSQLVulnerabilityAssessmentScansClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &DatabaseSQLVulnerabilityAssessmentScansClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Get - Get a database vulnerability assessment scan result. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-11-01-preview +// - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure +// Resource Manager API or the portal. +// - serverName - The name of the server. +// - databaseName - The name of the database. +// - vulnerabilityAssessmentName - The name of the vulnerability assessment. +// - scanID - The vulnerability assessment scan Id of the scan to retrieve. +// - options - DatabaseSQLVulnerabilityAssessmentScansClientGetOptions contains the optional parameters for the DatabaseSQLVulnerabilityAssessmentScansClient.Get +// method. +func (client *DatabaseSQLVulnerabilityAssessmentScansClient) Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string, vulnerabilityAssessmentName VulnerabilityAssessmentName, scanID string, options *DatabaseSQLVulnerabilityAssessmentScansClientGetOptions) (DatabaseSQLVulnerabilityAssessmentScansClientGetResponse, error) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, scanID, options) + if err != nil { + return DatabaseSQLVulnerabilityAssessmentScansClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return DatabaseSQLVulnerabilityAssessmentScansClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DatabaseSQLVulnerabilityAssessmentScansClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *DatabaseSQLVulnerabilityAssessmentScansClient) getCreateRequest(ctx context.Context, resourceGroupName string, serverName string, databaseName string, vulnerabilityAssessmentName VulnerabilityAssessmentName, scanID string, options *DatabaseSQLVulnerabilityAssessmentScansClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/sqlVulnerabilityAssessments/{vulnerabilityAssessmentName}/scans/{scanId}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serverName == "" { + return nil, errors.New("parameter serverName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serverName}", url.PathEscape(serverName)) + if databaseName == "" { + return nil, errors.New("parameter databaseName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{databaseName}", url.PathEscape(databaseName)) + if vulnerabilityAssessmentName == "" { + return nil, errors.New("parameter vulnerabilityAssessmentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vulnerabilityAssessmentName}", url.PathEscape(string(vulnerabilityAssessmentName))) + if scanID == "" { + return nil, errors.New("parameter scanID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{scanId}", url.PathEscape(scanID)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *DatabaseSQLVulnerabilityAssessmentScansClient) getHandleResponse(resp *http.Response) (DatabaseSQLVulnerabilityAssessmentScansClientGetResponse, error) { + result := DatabaseSQLVulnerabilityAssessmentScansClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.VulnerabilityAssessmentScanRecordForSQL); err != nil { + return DatabaseSQLVulnerabilityAssessmentScansClientGetResponse{}, err + } + return result, nil +} + +// NewListBySQLVulnerabilityAssessmentsPager - Lists the vulnerability assessment scans of a database. +// +// Generated from API version 2022-11-01-preview +// - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure +// Resource Manager API or the portal. +// - serverName - The name of the server. +// - databaseName - The name of the database. +// - vulnerabilityAssessmentName - The name of the vulnerability assessment. +// - options - DatabaseSQLVulnerabilityAssessmentScansClientListBySQLVulnerabilityAssessmentsOptions contains the optional parameters +// for the DatabaseSQLVulnerabilityAssessmentScansClient.NewListBySQLVulnerabilityAssessmentsPager method. +func (client *DatabaseSQLVulnerabilityAssessmentScansClient) NewListBySQLVulnerabilityAssessmentsPager(resourceGroupName string, serverName string, databaseName string, vulnerabilityAssessmentName VulnerabilityAssessmentName, options *DatabaseSQLVulnerabilityAssessmentScansClientListBySQLVulnerabilityAssessmentsOptions) *runtime.Pager[DatabaseSQLVulnerabilityAssessmentScansClientListBySQLVulnerabilityAssessmentsResponse] { + return runtime.NewPager(runtime.PagingHandler[DatabaseSQLVulnerabilityAssessmentScansClientListBySQLVulnerabilityAssessmentsResponse]{ + More: func(page DatabaseSQLVulnerabilityAssessmentScansClientListBySQLVulnerabilityAssessmentsResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *DatabaseSQLVulnerabilityAssessmentScansClientListBySQLVulnerabilityAssessmentsResponse) (DatabaseSQLVulnerabilityAssessmentScansClientListBySQLVulnerabilityAssessmentsResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listBySQLVulnerabilityAssessmentsCreateRequest(ctx, resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return DatabaseSQLVulnerabilityAssessmentScansClientListBySQLVulnerabilityAssessmentsResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return DatabaseSQLVulnerabilityAssessmentScansClientListBySQLVulnerabilityAssessmentsResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return DatabaseSQLVulnerabilityAssessmentScansClientListBySQLVulnerabilityAssessmentsResponse{}, runtime.NewResponseError(resp) + } + return client.listBySQLVulnerabilityAssessmentsHandleResponse(resp) + }, + }) +} + +// listBySQLVulnerabilityAssessmentsCreateRequest creates the ListBySQLVulnerabilityAssessments request. +func (client *DatabaseSQLVulnerabilityAssessmentScansClient) listBySQLVulnerabilityAssessmentsCreateRequest(ctx context.Context, resourceGroupName string, serverName string, databaseName string, vulnerabilityAssessmentName VulnerabilityAssessmentName, options *DatabaseSQLVulnerabilityAssessmentScansClientListBySQLVulnerabilityAssessmentsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/sqlVulnerabilityAssessments/{vulnerabilityAssessmentName}/scans" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serverName == "" { + return nil, errors.New("parameter serverName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serverName}", url.PathEscape(serverName)) + if databaseName == "" { + return nil, errors.New("parameter databaseName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{databaseName}", url.PathEscape(databaseName)) + if vulnerabilityAssessmentName == "" { + return nil, errors.New("parameter vulnerabilityAssessmentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vulnerabilityAssessmentName}", url.PathEscape(string(vulnerabilityAssessmentName))) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listBySQLVulnerabilityAssessmentsHandleResponse handles the ListBySQLVulnerabilityAssessments response. +func (client *DatabaseSQLVulnerabilityAssessmentScansClient) listBySQLVulnerabilityAssessmentsHandleResponse(resp *http.Response) (DatabaseSQLVulnerabilityAssessmentScansClientListBySQLVulnerabilityAssessmentsResponse, error) { + result := DatabaseSQLVulnerabilityAssessmentScansClientListBySQLVulnerabilityAssessmentsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.VulnerabilityAssessmentScanRecordForSQLListResult); err != nil { + return DatabaseSQLVulnerabilityAssessmentScansClientListBySQLVulnerabilityAssessmentsResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/sql/armsql/databasesqlvulnerabilityassessmentssettings_client.go b/sdk/resourcemanager/sql/armsql/databasesqlvulnerabilityassessmentssettings_client.go new file mode 100644 index 000000000000..437aa17d02dc --- /dev/null +++ b/sdk/resourcemanager/sql/armsql/databasesqlvulnerabilityassessmentssettings_client.go @@ -0,0 +1,192 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armsql + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// DatabaseSQLVulnerabilityAssessmentsSettingsClient contains the methods for the DatabaseSQLVulnerabilityAssessmentsSettings group. +// Don't use this type directly, use NewDatabaseSQLVulnerabilityAssessmentsSettingsClient() instead. +type DatabaseSQLVulnerabilityAssessmentsSettingsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewDatabaseSQLVulnerabilityAssessmentsSettingsClient creates a new instance of DatabaseSQLVulnerabilityAssessmentsSettingsClient with the specified values. +// - subscriptionID - The subscription ID that identifies an Azure subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewDatabaseSQLVulnerabilityAssessmentsSettingsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*DatabaseSQLVulnerabilityAssessmentsSettingsClient, error) { + cl, err := arm.NewClient(moduleName+".DatabaseSQLVulnerabilityAssessmentsSettingsClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &DatabaseSQLVulnerabilityAssessmentsSettingsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Get - Gets SQL Vulnerability Assessment policy for database. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-11-01-preview +// - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure +// Resource Manager API or the portal. +// - serverName - The name of the server. +// - databaseName - The name of the database. +// - vulnerabilityAssessmentName - The name of the SQL Vulnerability Assessment. +// - options - DatabaseSQLVulnerabilityAssessmentsSettingsClientGetOptions contains the optional parameters for the DatabaseSQLVulnerabilityAssessmentsSettingsClient.Get +// method. +func (client *DatabaseSQLVulnerabilityAssessmentsSettingsClient) Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string, vulnerabilityAssessmentName SQLVulnerabilityAssessmentName, options *DatabaseSQLVulnerabilityAssessmentsSettingsClientGetOptions) (DatabaseSQLVulnerabilityAssessmentsSettingsClientGetResponse, error) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, options) + if err != nil { + return DatabaseSQLVulnerabilityAssessmentsSettingsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return DatabaseSQLVulnerabilityAssessmentsSettingsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DatabaseSQLVulnerabilityAssessmentsSettingsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *DatabaseSQLVulnerabilityAssessmentsSettingsClient) getCreateRequest(ctx context.Context, resourceGroupName string, serverName string, databaseName string, vulnerabilityAssessmentName SQLVulnerabilityAssessmentName, options *DatabaseSQLVulnerabilityAssessmentsSettingsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/sqlVulnerabilityAssessments/{vulnerabilityAssessmentName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serverName == "" { + return nil, errors.New("parameter serverName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serverName}", url.PathEscape(serverName)) + if databaseName == "" { + return nil, errors.New("parameter databaseName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{databaseName}", url.PathEscape(databaseName)) + if vulnerabilityAssessmentName == "" { + return nil, errors.New("parameter vulnerabilityAssessmentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vulnerabilityAssessmentName}", url.PathEscape(string(vulnerabilityAssessmentName))) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *DatabaseSQLVulnerabilityAssessmentsSettingsClient) getHandleResponse(resp *http.Response) (DatabaseSQLVulnerabilityAssessmentsSettingsClientGetResponse, error) { + result := DatabaseSQLVulnerabilityAssessmentsSettingsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.VulnerabilityAssessment); err != nil { + return DatabaseSQLVulnerabilityAssessmentsSettingsClientGetResponse{}, err + } + return result, nil +} + +// NewListByDatabasePager - Lists SQL Vulnerability Assessment policies associated with a database. +// +// Generated from API version 2022-11-01-preview +// - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure +// Resource Manager API or the portal. +// - serverName - The name of the server. +// - databaseName - The name of the database. +// - options - DatabaseSQLVulnerabilityAssessmentsSettingsClientListByDatabaseOptions contains the optional parameters for the +// DatabaseSQLVulnerabilityAssessmentsSettingsClient.NewListByDatabasePager method. +func (client *DatabaseSQLVulnerabilityAssessmentsSettingsClient) NewListByDatabasePager(resourceGroupName string, serverName string, databaseName string, options *DatabaseSQLVulnerabilityAssessmentsSettingsClientListByDatabaseOptions) *runtime.Pager[DatabaseSQLVulnerabilityAssessmentsSettingsClientListByDatabaseResponse] { + return runtime.NewPager(runtime.PagingHandler[DatabaseSQLVulnerabilityAssessmentsSettingsClientListByDatabaseResponse]{ + More: func(page DatabaseSQLVulnerabilityAssessmentsSettingsClientListByDatabaseResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *DatabaseSQLVulnerabilityAssessmentsSettingsClientListByDatabaseResponse) (DatabaseSQLVulnerabilityAssessmentsSettingsClientListByDatabaseResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByDatabaseCreateRequest(ctx, resourceGroupName, serverName, databaseName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return DatabaseSQLVulnerabilityAssessmentsSettingsClientListByDatabaseResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return DatabaseSQLVulnerabilityAssessmentsSettingsClientListByDatabaseResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return DatabaseSQLVulnerabilityAssessmentsSettingsClientListByDatabaseResponse{}, runtime.NewResponseError(resp) + } + return client.listByDatabaseHandleResponse(resp) + }, + }) +} + +// listByDatabaseCreateRequest creates the ListByDatabase request. +func (client *DatabaseSQLVulnerabilityAssessmentsSettingsClient) listByDatabaseCreateRequest(ctx context.Context, resourceGroupName string, serverName string, databaseName string, options *DatabaseSQLVulnerabilityAssessmentsSettingsClientListByDatabaseOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/sqlVulnerabilityAssessments" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serverName == "" { + return nil, errors.New("parameter serverName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serverName}", url.PathEscape(serverName)) + if databaseName == "" { + return nil, errors.New("parameter databaseName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{databaseName}", url.PathEscape(databaseName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByDatabaseHandleResponse handles the ListByDatabase response. +func (client *DatabaseSQLVulnerabilityAssessmentsSettingsClient) listByDatabaseHandleResponse(resp *http.Response) (DatabaseSQLVulnerabilityAssessmentsSettingsClientListByDatabaseResponse, error) { + result := DatabaseSQLVulnerabilityAssessmentsSettingsClientListByDatabaseResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.VulnerabilityAssessmentListResult); err != nil { + return DatabaseSQLVulnerabilityAssessmentsSettingsClientListByDatabaseResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/sql/armsql/databasetables_client.go b/sdk/resourcemanager/sql/armsql/databasetables_client.go index dd0b78b97ea6..7d53c4824929 100644 --- a/sdk/resourcemanager/sql/armsql/databasetables_client.go +++ b/sdk/resourcemanager/sql/armsql/databasetables_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armsql @@ -47,7 +46,7 @@ func NewDatabaseTablesClient(subscriptionID string, credential azcore.TokenCrede // Get - Get database table // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -56,18 +55,21 @@ func NewDatabaseTablesClient(subscriptionID string, credential azcore.TokenCrede // - tableName - The name of the table. // - options - DatabaseTablesClientGetOptions contains the optional parameters for the DatabaseTablesClient.Get method. func (client *DatabaseTablesClient) Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string, schemaName string, tableName string, options *DatabaseTablesClientGetOptions) (DatabaseTablesClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, serverName, databaseName, schemaName, tableName, options) if err != nil { return DatabaseTablesClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return DatabaseTablesClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return DatabaseTablesClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DatabaseTablesClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -102,7 +104,7 @@ func (client *DatabaseTablesClient) getCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -119,7 +121,7 @@ func (client *DatabaseTablesClient) getHandleResponse(resp *http.Response) (Data // NewListBySchemaPager - List database tables // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -186,7 +188,7 @@ func (client *DatabaseTablesClient) listBySchemaCreateRequest(ctx context.Contex if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/sql/armsql/databasetables_client_example_test.go b/sdk/resourcemanager/sql/armsql/databasetables_client_example_test.go deleted file mode 100644 index bfbba8449322..000000000000 --- a/sdk/resourcemanager/sql/armsql/databasetables_client_example_test.go +++ /dev/null @@ -1,81 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsql_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sql/armsql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseTableListBySchema.json -func ExampleDatabaseTablesClient_NewListBySchemaPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDatabaseTablesClient().NewListBySchemaPager("myRG", "serverName", "myDatabase", "dbo", &armsql.DatabaseTablesClientListBySchemaOptions{Filter: nil}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DatabaseTableListResult = armsql.DatabaseTableListResult{ - // Value: []*armsql.DatabaseTable{ - // { - // Name: to.Ptr("table1"), - // Type: to.Ptr("Microsoft.Sql/servers/databases/schemas/tables"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/myRG/providers/Microsoft.Sql/servers/serverName/databases/myDatabase/schemas/dbo/tables/table1"), - // }, - // { - // Name: to.Ptr("table2"), - // Type: to.Ptr("Microsoft.Sql/servers/databases/schemas/tables"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/myRG/providers/Microsoft.Sql/servers/serverName/databases/myDatabase/schemas/dbo/tables/table2"), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseTableGet.json -func ExampleDatabaseTablesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDatabaseTablesClient().Get(ctx, "myRG", "serverName", "myDatabase", "dbo", "table1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DatabaseTable = armsql.DatabaseTable{ - // Name: to.Ptr("table1"), - // Type: to.Ptr("Microsoft.Sql/servers/databases/schemas/tables"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/myRG/providers/Microsoft.Sql/servers/serverName/databases/myDatabase/schemas/dbo/tables/table1"), - // } -} diff --git a/sdk/resourcemanager/sql/armsql/databaseusages_client.go b/sdk/resourcemanager/sql/armsql/databaseusages_client.go index 0d0b4090cdf0..92e6b0064ff9 100644 --- a/sdk/resourcemanager/sql/armsql/databaseusages_client.go +++ b/sdk/resourcemanager/sql/armsql/databaseusages_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armsql @@ -46,7 +45,7 @@ func NewDatabaseUsagesClient(subscriptionID string, credential azcore.TokenCrede // NewListByDatabasePager - Gets database usages. // -// Generated from API version 2021-02-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -105,7 +104,7 @@ func (client *DatabaseUsagesClient) listByDatabaseCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-02-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/sql/armsql/databaseusages_client_example_test.go b/sdk/resourcemanager/sql/armsql/databaseusages_client_example_test.go deleted file mode 100644 index d7b42588deaa..000000000000 --- a/sdk/resourcemanager/sql/armsql/databaseusages_client_example_test.go +++ /dev/null @@ -1,57 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsql_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sql/armsql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/GetDatabaseUsages.json -func ExampleDatabaseUsagesClient_NewListByDatabasePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDatabaseUsagesClient().NewListByDatabasePager("Default-SQL-SouthEastAsia", "testsvr", "testdb", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DatabaseUsageListResult = armsql.DatabaseUsageListResult{ - // Value: []*armsql.DatabaseUsage{ - // { - // Name: to.Ptr("database_size"), - // Type: to.Ptr("Microsoft.Sql/servers/databases/usages"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/servers/testsvr/databases/testdb/usages/database_size"), - // Properties: &armsql.DatabaseUsageProperties{ - // CurrentValue: to.Ptr[float64](4194304), - // DisplayName: to.Ptr("Database Size"), - // Limit: to.Ptr[float64](268435456000), - // Unit: to.Ptr("Bytes"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/sql/armsql/databasevulnerabilityassessmentrulebaselines_client.go b/sdk/resourcemanager/sql/armsql/databasevulnerabilityassessmentrulebaselines_client.go index 2a907952975c..3774a8c95b53 100644 --- a/sdk/resourcemanager/sql/armsql/databasevulnerabilityassessmentrulebaselines_client.go +++ b/sdk/resourcemanager/sql/armsql/databasevulnerabilityassessmentrulebaselines_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armsql @@ -47,7 +46,7 @@ func NewDatabaseVulnerabilityAssessmentRuleBaselinesClient(subscriptionID string // CreateOrUpdate - Creates or updates a database's vulnerability assessment rule baseline. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -60,18 +59,21 @@ func NewDatabaseVulnerabilityAssessmentRuleBaselinesClient(subscriptionID string // - options - DatabaseVulnerabilityAssessmentRuleBaselinesClientCreateOrUpdateOptions contains the optional parameters for // the DatabaseVulnerabilityAssessmentRuleBaselinesClient.CreateOrUpdate method. func (client *DatabaseVulnerabilityAssessmentRuleBaselinesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, databaseName string, vulnerabilityAssessmentName VulnerabilityAssessmentName, ruleID string, baselineName VulnerabilityAssessmentPolicyBaselineName, parameters DatabaseVulnerabilityAssessmentRuleBaseline, options *DatabaseVulnerabilityAssessmentRuleBaselinesClientCreateOrUpdateOptions) (DatabaseVulnerabilityAssessmentRuleBaselinesClientCreateOrUpdateResponse, error) { + var err error req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, ruleID, baselineName, parameters, options) if err != nil { return DatabaseVulnerabilityAssessmentRuleBaselinesClientCreateOrUpdateResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return DatabaseVulnerabilityAssessmentRuleBaselinesClientCreateOrUpdateResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return DatabaseVulnerabilityAssessmentRuleBaselinesClientCreateOrUpdateResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DatabaseVulnerabilityAssessmentRuleBaselinesClientCreateOrUpdateResponse{}, err } - return client.createOrUpdateHandleResponse(resp) + resp, err := client.createOrUpdateHandleResponse(httpResp) + return resp, err } // createOrUpdateCreateRequest creates the CreateOrUpdate request. @@ -110,10 +112,13 @@ func (client *DatabaseVulnerabilityAssessmentRuleBaselinesClient) createOrUpdate return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // createOrUpdateHandleResponse handles the CreateOrUpdate response. @@ -128,7 +133,7 @@ func (client *DatabaseVulnerabilityAssessmentRuleBaselinesClient) createOrUpdate // Delete - Removes the database's vulnerability assessment rule baseline. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -140,16 +145,18 @@ func (client *DatabaseVulnerabilityAssessmentRuleBaselinesClient) createOrUpdate // - options - DatabaseVulnerabilityAssessmentRuleBaselinesClientDeleteOptions contains the optional parameters for the DatabaseVulnerabilityAssessmentRuleBaselinesClient.Delete // method. func (client *DatabaseVulnerabilityAssessmentRuleBaselinesClient) Delete(ctx context.Context, resourceGroupName string, serverName string, databaseName string, vulnerabilityAssessmentName VulnerabilityAssessmentName, ruleID string, baselineName VulnerabilityAssessmentPolicyBaselineName, options *DatabaseVulnerabilityAssessmentRuleBaselinesClientDeleteOptions) (DatabaseVulnerabilityAssessmentRuleBaselinesClientDeleteResponse, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, ruleID, baselineName, options) if err != nil { return DatabaseVulnerabilityAssessmentRuleBaselinesClientDeleteResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return DatabaseVulnerabilityAssessmentRuleBaselinesClientDeleteResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return DatabaseVulnerabilityAssessmentRuleBaselinesClientDeleteResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DatabaseVulnerabilityAssessmentRuleBaselinesClientDeleteResponse{}, err } return DatabaseVulnerabilityAssessmentRuleBaselinesClientDeleteResponse{}, nil } @@ -190,7 +197,7 @@ func (client *DatabaseVulnerabilityAssessmentRuleBaselinesClient) deleteCreateRe return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -198,7 +205,7 @@ func (client *DatabaseVulnerabilityAssessmentRuleBaselinesClient) deleteCreateRe // Get - Gets a database's vulnerability assessment rule baseline. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -210,18 +217,21 @@ func (client *DatabaseVulnerabilityAssessmentRuleBaselinesClient) deleteCreateRe // - options - DatabaseVulnerabilityAssessmentRuleBaselinesClientGetOptions contains the optional parameters for the DatabaseVulnerabilityAssessmentRuleBaselinesClient.Get // method. func (client *DatabaseVulnerabilityAssessmentRuleBaselinesClient) Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string, vulnerabilityAssessmentName VulnerabilityAssessmentName, ruleID string, baselineName VulnerabilityAssessmentPolicyBaselineName, options *DatabaseVulnerabilityAssessmentRuleBaselinesClientGetOptions) (DatabaseVulnerabilityAssessmentRuleBaselinesClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, ruleID, baselineName, options) if err != nil { return DatabaseVulnerabilityAssessmentRuleBaselinesClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return DatabaseVulnerabilityAssessmentRuleBaselinesClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return DatabaseVulnerabilityAssessmentRuleBaselinesClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DatabaseVulnerabilityAssessmentRuleBaselinesClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -260,7 +270,7 @@ func (client *DatabaseVulnerabilityAssessmentRuleBaselinesClient) getCreateReque return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/sql/armsql/databasevulnerabilityassessmentrulebaselines_client_example_test.go b/sdk/resourcemanager/sql/armsql/databasevulnerabilityassessmentrulebaselines_client_example_test.go deleted file mode 100644 index 7f5955bfefc8..000000000000 --- a/sdk/resourcemanager/sql/armsql/databasevulnerabilityassessmentrulebaselines_client_example_test.go +++ /dev/null @@ -1,144 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsql_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sql/armsql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseVulnerabilityAssessmentRuleBaselineGet.json -func ExampleDatabaseVulnerabilityAssessmentRuleBaselinesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDatabaseVulnerabilityAssessmentRuleBaselinesClient().Get(ctx, "vulnerabilityaseessmenttest-4711", "vulnerabilityaseessmenttest-6411", "testdb", armsql.VulnerabilityAssessmentNameDefault, "VA1001", armsql.VulnerabilityAssessmentPolicyBaselineNameMaster, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DatabaseVulnerabilityAssessmentRuleBaseline = armsql.DatabaseVulnerabilityAssessmentRuleBaseline{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.Sql/servers/databases/vulnerabilityAssessments/rules/baselines"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/vulnerabilityaseessmenttest-4799/providers/Microsoft.Sql/servers/vulnerabilityaseessmenttest-6440/databases/testdb/vulnerabilityAssessments/default/rules/VA1001/baselines/default"), - // Properties: &armsql.DatabaseVulnerabilityAssessmentRuleBaselineProperties{ - // BaselineResults: []*armsql.DatabaseVulnerabilityAssessmentRuleBaselineItem{ - // { - // Result: []*string{ - // to.Ptr("userA"), - // to.Ptr("SELECT")}, - // }, - // { - // Result: []*string{ - // to.Ptr("userB"), - // to.Ptr("SELECT")}, - // }, - // { - // Result: []*string{ - // to.Ptr("userC"), - // to.Ptr("SELECT"), - // to.Ptr("tableId_4")}, - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseVulnerabilityAssessmentRuleBaselineCreate.json -func ExampleDatabaseVulnerabilityAssessmentRuleBaselinesClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDatabaseVulnerabilityAssessmentRuleBaselinesClient().CreateOrUpdate(ctx, "vulnerabilityaseessmenttest-4799", "vulnerabilityaseessmenttest-6440", "testdb", armsql.VulnerabilityAssessmentNameDefault, "VA1001", armsql.VulnerabilityAssessmentPolicyBaselineNameDefault, armsql.DatabaseVulnerabilityAssessmentRuleBaseline{ - Properties: &armsql.DatabaseVulnerabilityAssessmentRuleBaselineProperties{ - BaselineResults: []*armsql.DatabaseVulnerabilityAssessmentRuleBaselineItem{ - { - Result: []*string{ - to.Ptr("userA"), - to.Ptr("SELECT")}, - }, - { - Result: []*string{ - to.Ptr("userB"), - to.Ptr("SELECT")}, - }, - { - Result: []*string{ - to.Ptr("userC"), - to.Ptr("SELECT"), - to.Ptr("tableId_4")}, - }}, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DatabaseVulnerabilityAssessmentRuleBaseline = armsql.DatabaseVulnerabilityAssessmentRuleBaseline{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.Sql/servers/databases/vulnerabilityAssessments/rules/baselines"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/vulnerabilityaseessmenttest-4799/providers/Microsoft.Sql/servers/vulnerabilityaseessmenttest-6440/databases/testdb/vulnerabilityAssessments/default/rules/VA1001/baselines/default"), - // Properties: &armsql.DatabaseVulnerabilityAssessmentRuleBaselineProperties{ - // BaselineResults: []*armsql.DatabaseVulnerabilityAssessmentRuleBaselineItem{ - // { - // Result: []*string{ - // to.Ptr("userA"), - // to.Ptr("SELECT")}, - // }, - // { - // Result: []*string{ - // to.Ptr("userB"), - // to.Ptr("SELECT")}, - // }, - // { - // Result: []*string{ - // to.Ptr("userC"), - // to.Ptr("SELECT"), - // to.Ptr("tableId_4")}, - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseVulnerabilityAssessmentRuleBaselineDelete.json -func ExampleDatabaseVulnerabilityAssessmentRuleBaselinesClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewDatabaseVulnerabilityAssessmentRuleBaselinesClient().Delete(ctx, "vulnerabilityaseessmenttest-4799", "vulnerabilityaseessmenttest-6440", "testdb", armsql.VulnerabilityAssessmentNameDefault, "VA1001", armsql.VulnerabilityAssessmentPolicyBaselineNameDefault, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/sql/armsql/databasevulnerabilityassessments_client.go b/sdk/resourcemanager/sql/armsql/databasevulnerabilityassessments_client.go index 226b78d50b8e..b9bdb72c8013 100644 --- a/sdk/resourcemanager/sql/armsql/databasevulnerabilityassessments_client.go +++ b/sdk/resourcemanager/sql/armsql/databasevulnerabilityassessments_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armsql @@ -47,7 +46,7 @@ func NewDatabaseVulnerabilityAssessmentsClient(subscriptionID string, credential // CreateOrUpdate - Creates or updates the database's vulnerability assessment. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -57,18 +56,21 @@ func NewDatabaseVulnerabilityAssessmentsClient(subscriptionID string, credential // - options - DatabaseVulnerabilityAssessmentsClientCreateOrUpdateOptions contains the optional parameters for the DatabaseVulnerabilityAssessmentsClient.CreateOrUpdate // method. func (client *DatabaseVulnerabilityAssessmentsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, databaseName string, vulnerabilityAssessmentName VulnerabilityAssessmentName, parameters DatabaseVulnerabilityAssessment, options *DatabaseVulnerabilityAssessmentsClientCreateOrUpdateOptions) (DatabaseVulnerabilityAssessmentsClientCreateOrUpdateResponse, error) { + var err error req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, parameters, options) if err != nil { return DatabaseVulnerabilityAssessmentsClientCreateOrUpdateResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return DatabaseVulnerabilityAssessmentsClientCreateOrUpdateResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { - return DatabaseVulnerabilityAssessmentsClientCreateOrUpdateResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return DatabaseVulnerabilityAssessmentsClientCreateOrUpdateResponse{}, err } - return client.createOrUpdateHandleResponse(resp) + resp, err := client.createOrUpdateHandleResponse(httpResp) + return resp, err } // createOrUpdateCreateRequest creates the CreateOrUpdate request. @@ -99,10 +101,13 @@ func (client *DatabaseVulnerabilityAssessmentsClient) createOrUpdateCreateReques return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // createOrUpdateHandleResponse handles the CreateOrUpdate response. @@ -117,7 +122,7 @@ func (client *DatabaseVulnerabilityAssessmentsClient) createOrUpdateHandleRespon // Delete - Removes the database's vulnerability assessment. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -126,16 +131,18 @@ func (client *DatabaseVulnerabilityAssessmentsClient) createOrUpdateHandleRespon // - options - DatabaseVulnerabilityAssessmentsClientDeleteOptions contains the optional parameters for the DatabaseVulnerabilityAssessmentsClient.Delete // method. func (client *DatabaseVulnerabilityAssessmentsClient) Delete(ctx context.Context, resourceGroupName string, serverName string, databaseName string, vulnerabilityAssessmentName VulnerabilityAssessmentName, options *DatabaseVulnerabilityAssessmentsClientDeleteOptions) (DatabaseVulnerabilityAssessmentsClientDeleteResponse, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, options) if err != nil { return DatabaseVulnerabilityAssessmentsClientDeleteResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return DatabaseVulnerabilityAssessmentsClientDeleteResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return DatabaseVulnerabilityAssessmentsClientDeleteResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DatabaseVulnerabilityAssessmentsClientDeleteResponse{}, err } return DatabaseVulnerabilityAssessmentsClientDeleteResponse{}, nil } @@ -168,7 +175,7 @@ func (client *DatabaseVulnerabilityAssessmentsClient) deleteCreateRequest(ctx co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -176,7 +183,7 @@ func (client *DatabaseVulnerabilityAssessmentsClient) deleteCreateRequest(ctx co // Get - Gets the database's vulnerability assessment. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -185,18 +192,21 @@ func (client *DatabaseVulnerabilityAssessmentsClient) deleteCreateRequest(ctx co // - options - DatabaseVulnerabilityAssessmentsClientGetOptions contains the optional parameters for the DatabaseVulnerabilityAssessmentsClient.Get // method. func (client *DatabaseVulnerabilityAssessmentsClient) Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string, vulnerabilityAssessmentName VulnerabilityAssessmentName, options *DatabaseVulnerabilityAssessmentsClientGetOptions) (DatabaseVulnerabilityAssessmentsClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, options) if err != nil { return DatabaseVulnerabilityAssessmentsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return DatabaseVulnerabilityAssessmentsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return DatabaseVulnerabilityAssessmentsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DatabaseVulnerabilityAssessmentsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -227,7 +237,7 @@ func (client *DatabaseVulnerabilityAssessmentsClient) getCreateRequest(ctx conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -244,7 +254,7 @@ func (client *DatabaseVulnerabilityAssessmentsClient) getHandleResponse(resp *ht // NewListByDatabasePager - Lists the vulnerability assessment policies associated with a database. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -303,7 +313,7 @@ func (client *DatabaseVulnerabilityAssessmentsClient) listByDatabaseCreateReques return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/sql/armsql/databasevulnerabilityassessments_client_example_test.go b/sdk/resourcemanager/sql/armsql/databasevulnerabilityassessments_client_example_test.go deleted file mode 100644 index 1dc8da8d1ad2..000000000000 --- a/sdk/resourcemanager/sql/armsql/databasevulnerabilityassessments_client_example_test.go +++ /dev/null @@ -1,235 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsql_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sql/armsql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseVulnerabilityAssessmentGet.json -func ExampleDatabaseVulnerabilityAssessmentsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDatabaseVulnerabilityAssessmentsClient().Get(ctx, "vulnerabilityaseessmenttest-4799", "vulnerabilityaseessmenttest-6440", "testdb", armsql.VulnerabilityAssessmentNameDefault, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DatabaseVulnerabilityAssessment = armsql.DatabaseVulnerabilityAssessment{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.Sql/servers/databases/vulnerabilityAssessments"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/vulnerabilityaseessmenttest-4799/providers/Microsoft.Sql/servers/vulnerabilityaseessmenttest-6440/databases/testdb/vulnerabilityAssessments/default"), - // Properties: &armsql.DatabaseVulnerabilityAssessmentProperties{ - // RecurringScans: &armsql.VulnerabilityAssessmentRecurringScansProperties{ - // EmailSubscriptionAdmins: to.Ptr(true), - // Emails: []*string{ - // to.Ptr("email1@mail.com"), - // to.Ptr("email2@mail.com")}, - // IsEnabled: to.Ptr(true), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseVulnerabilityAssessmentCreateMax.json -func ExampleDatabaseVulnerabilityAssessmentsClient_CreateOrUpdate_createADatabasesVulnerabilityAssessmentWithAllParameters() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDatabaseVulnerabilityAssessmentsClient().CreateOrUpdate(ctx, "vulnerabilityaseessmenttest-4799", "vulnerabilityaseessmenttest-6440", "testdb", armsql.VulnerabilityAssessmentNameDefault, armsql.DatabaseVulnerabilityAssessment{ - Properties: &armsql.DatabaseVulnerabilityAssessmentProperties{ - RecurringScans: &armsql.VulnerabilityAssessmentRecurringScansProperties{ - EmailSubscriptionAdmins: to.Ptr(true), - Emails: []*string{ - to.Ptr("email1@mail.com"), - to.Ptr("email2@mail.com")}, - IsEnabled: to.Ptr(true), - }, - StorageAccountAccessKey: to.Ptr("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"), - StorageContainerPath: to.Ptr("https://myStorage.blob.core.windows.net/vulnerability-assessment/"), - StorageContainerSasKey: to.Ptr("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DatabaseVulnerabilityAssessment = armsql.DatabaseVulnerabilityAssessment{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.Sql/servers/databases/vulnerabilityAssessments"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/vulnerabilityaseessmenttest-4799/providers/Microsoft.Sql/servers/vulnerabilityaseessmenttest-6440/databases/testdb/vulnerabilityAssessments/default"), - // Properties: &armsql.DatabaseVulnerabilityAssessmentProperties{ - // RecurringScans: &armsql.VulnerabilityAssessmentRecurringScansProperties{ - // EmailSubscriptionAdmins: to.Ptr(true), - // Emails: []*string{ - // to.Ptr("email1@mail.com"), - // to.Ptr("email2@mail.com")}, - // IsEnabled: to.Ptr(true), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseVulnerabilityAssessmentCreateStorageAccessKeyMin.json -func ExampleDatabaseVulnerabilityAssessmentsClient_CreateOrUpdate_createADatabasesVulnerabilityAssessmentWithMinimalParametersWhenStorageAccountAccessKeyIsSpecified() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDatabaseVulnerabilityAssessmentsClient().CreateOrUpdate(ctx, "vulnerabilityaseessmenttest-4799", "vulnerabilityaseessmenttest-6440", "testdb", armsql.VulnerabilityAssessmentNameDefault, armsql.DatabaseVulnerabilityAssessment{ - Properties: &armsql.DatabaseVulnerabilityAssessmentProperties{ - StorageAccountAccessKey: to.Ptr("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"), - StorageContainerPath: to.Ptr("https://myStorage.blob.core.windows.net/vulnerability-assessment/"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DatabaseVulnerabilityAssessment = armsql.DatabaseVulnerabilityAssessment{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.Sql/servers/databases/vulnerabilityAssessments"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/vulnerabilityaseessmenttest-4799/providers/Microsoft.Sql/servers/vulnerabilityaseessmenttest-6440/databases/testdb/vulnerabilityAssessments/default"), - // Properties: &armsql.DatabaseVulnerabilityAssessmentProperties{ - // RecurringScans: &armsql.VulnerabilityAssessmentRecurringScansProperties{ - // EmailSubscriptionAdmins: to.Ptr(false), - // Emails: []*string{ - // }, - // IsEnabled: to.Ptr(true), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseVulnerabilityAssessmentCreateContainerSasKeyMin.json -func ExampleDatabaseVulnerabilityAssessmentsClient_CreateOrUpdate_createADatabasesVulnerabilityAssessmentWithMinimalParametersWhenStorageContainerSasKeyIsSpecified() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDatabaseVulnerabilityAssessmentsClient().CreateOrUpdate(ctx, "vulnerabilityaseessmenttest-4799", "vulnerabilityaseessmenttest-6440", "testdb", armsql.VulnerabilityAssessmentNameDefault, armsql.DatabaseVulnerabilityAssessment{ - Properties: &armsql.DatabaseVulnerabilityAssessmentProperties{ - StorageContainerPath: to.Ptr("https://myStorage.blob.core.windows.net/vulnerability-assessment/"), - StorageContainerSasKey: to.Ptr("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DatabaseVulnerabilityAssessment = armsql.DatabaseVulnerabilityAssessment{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.Sql/servers/databases/vulnerabilityAssessments"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/vulnerabilityaseessmenttest-4799/providers/Microsoft.Sql/servers/vulnerabilityaseessmenttest-6440/databases/testdb/vulnerabilityAssessments/default"), - // Properties: &armsql.DatabaseVulnerabilityAssessmentProperties{ - // RecurringScans: &armsql.VulnerabilityAssessmentRecurringScansProperties{ - // EmailSubscriptionAdmins: to.Ptr(false), - // Emails: []*string{ - // }, - // IsEnabled: to.Ptr(true), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseVulnerabilityAssessmentDelete.json -func ExampleDatabaseVulnerabilityAssessmentsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewDatabaseVulnerabilityAssessmentsClient().Delete(ctx, "vulnerabilityaseessmenttest-4799", "vulnerabilityaseessmenttest-6440", "testdb", armsql.VulnerabilityAssessmentNameDefault, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseVulnerabilityAssessmentListByDatabase.json -func ExampleDatabaseVulnerabilityAssessmentsClient_NewListByDatabasePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDatabaseVulnerabilityAssessmentsClient().NewListByDatabasePager("vulnerabilityaseessmenttest-4799", "vulnerabilityaseessmenttest-6440", "testdb", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DatabaseVulnerabilityAssessmentListResult = armsql.DatabaseVulnerabilityAssessmentListResult{ - // Value: []*armsql.DatabaseVulnerabilityAssessment{ - // { - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.Sql/servers/databases/vulnerabilityAssessments"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/vulnerabilityaseessmenttest-4799/providers/Microsoft.Sql/servers/vulnerabilityaseessmenttest-6440/databases/testdb/vulnerabilityAssessments/default"), - // Properties: &armsql.DatabaseVulnerabilityAssessmentProperties{ - // RecurringScans: &armsql.VulnerabilityAssessmentRecurringScansProperties{ - // EmailSubscriptionAdmins: to.Ptr(true), - // Emails: []*string{ - // to.Ptr("email1@mail.com"), - // to.Ptr("email2@mail.com")}, - // IsEnabled: to.Ptr(true), - // }, - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/sql/armsql/databasevulnerabilityassessmentscans_client.go b/sdk/resourcemanager/sql/armsql/databasevulnerabilityassessmentscans_client.go index 79bd9727158e..3e2415accb77 100644 --- a/sdk/resourcemanager/sql/armsql/databasevulnerabilityassessmentscans_client.go +++ b/sdk/resourcemanager/sql/armsql/databasevulnerabilityassessmentscans_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armsql @@ -47,7 +46,7 @@ func NewDatabaseVulnerabilityAssessmentScansClient(subscriptionID string, creden // Export - Convert an existing scan result to a human readable format. If already exists nothing happens // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -57,18 +56,21 @@ func NewDatabaseVulnerabilityAssessmentScansClient(subscriptionID string, creden // - options - DatabaseVulnerabilityAssessmentScansClientExportOptions contains the optional parameters for the DatabaseVulnerabilityAssessmentScansClient.Export // method. func (client *DatabaseVulnerabilityAssessmentScansClient) Export(ctx context.Context, resourceGroupName string, serverName string, databaseName string, vulnerabilityAssessmentName VulnerabilityAssessmentName, scanID string, options *DatabaseVulnerabilityAssessmentScansClientExportOptions) (DatabaseVulnerabilityAssessmentScansClientExportResponse, error) { + var err error req, err := client.exportCreateRequest(ctx, resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, scanID, options) if err != nil { return DatabaseVulnerabilityAssessmentScansClientExportResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return DatabaseVulnerabilityAssessmentScansClientExportResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { - return DatabaseVulnerabilityAssessmentScansClientExportResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return DatabaseVulnerabilityAssessmentScansClientExportResponse{}, err } - return client.exportHandleResponse(resp) + resp, err := client.exportHandleResponse(httpResp) + return resp, err } // exportCreateRequest creates the Export request. @@ -103,7 +105,7 @@ func (client *DatabaseVulnerabilityAssessmentScansClient) exportCreateRequest(ct return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -121,7 +123,7 @@ func (client *DatabaseVulnerabilityAssessmentScansClient) exportHandleResponse(r // Get - Gets a vulnerability assessment scan record of a database. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -131,18 +133,21 @@ func (client *DatabaseVulnerabilityAssessmentScansClient) exportHandleResponse(r // - options - DatabaseVulnerabilityAssessmentScansClientGetOptions contains the optional parameters for the DatabaseVulnerabilityAssessmentScansClient.Get // method. func (client *DatabaseVulnerabilityAssessmentScansClient) Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string, vulnerabilityAssessmentName VulnerabilityAssessmentName, scanID string, options *DatabaseVulnerabilityAssessmentScansClientGetOptions) (DatabaseVulnerabilityAssessmentScansClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, scanID, options) if err != nil { return DatabaseVulnerabilityAssessmentScansClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return DatabaseVulnerabilityAssessmentScansClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return DatabaseVulnerabilityAssessmentScansClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DatabaseVulnerabilityAssessmentScansClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -177,7 +182,7 @@ func (client *DatabaseVulnerabilityAssessmentScansClient) getCreateRequest(ctx c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -195,7 +200,7 @@ func (client *DatabaseVulnerabilityAssessmentScansClient) getHandleResponse(resp // BeginInitiateScan - Executes a Vulnerability Assessment database scan. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -210,7 +215,8 @@ func (client *DatabaseVulnerabilityAssessmentScansClient) BeginInitiateScan(ctx if err != nil { return nil, err } - return runtime.NewPoller[DatabaseVulnerabilityAssessmentScansClientInitiateScanResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[DatabaseVulnerabilityAssessmentScansClientInitiateScanResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[DatabaseVulnerabilityAssessmentScansClientInitiateScanResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -219,20 +225,22 @@ func (client *DatabaseVulnerabilityAssessmentScansClient) BeginInitiateScan(ctx // InitiateScan - Executes a Vulnerability Assessment database scan. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview func (client *DatabaseVulnerabilityAssessmentScansClient) initiateScan(ctx context.Context, resourceGroupName string, serverName string, databaseName string, vulnerabilityAssessmentName VulnerabilityAssessmentName, scanID string, options *DatabaseVulnerabilityAssessmentScansClientBeginInitiateScanOptions) (*http.Response, error) { + var err error req, err := client.initiateScanCreateRequest(ctx, resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, scanID, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // initiateScanCreateRequest creates the InitiateScan request. @@ -267,14 +275,14 @@ func (client *DatabaseVulnerabilityAssessmentScansClient) initiateScanCreateRequ return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } // NewListByDatabasePager - Lists the vulnerability assessment scans of a database. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -338,7 +346,7 @@ func (client *DatabaseVulnerabilityAssessmentScansClient) listByDatabaseCreateRe return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/sql/armsql/databasevulnerabilityassessmentscans_client_example_test.go b/sdk/resourcemanager/sql/armsql/databasevulnerabilityassessmentscans_client_example_test.go deleted file mode 100644 index 82a1e6798863..000000000000 --- a/sdk/resourcemanager/sql/armsql/databasevulnerabilityassessmentscans_client_example_test.go +++ /dev/null @@ -1,182 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsql_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sql/armsql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseVulnerabilityAssessmentScansExecute.json -func ExampleDatabaseVulnerabilityAssessmentScansClient_BeginInitiateScan() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDatabaseVulnerabilityAssessmentScansClient().BeginInitiateScan(ctx, "vulnerabilityassessmenttest-4711", "vulnerabilityassessmenttest-6411", "testdb", armsql.VulnerabilityAssessmentNameDefault, "scan01", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseVulnerabilityAssessmentScanRecordsListByDatabase.json -func ExampleDatabaseVulnerabilityAssessmentScansClient_NewListByDatabasePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDatabaseVulnerabilityAssessmentScansClient().NewListByDatabasePager("vulnerabilityassessmenttest-4711", "vulnerabilityassessmenttest-6411", "testdb", armsql.VulnerabilityAssessmentNameDefault, nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.VulnerabilityAssessmentScanRecordListResult = armsql.VulnerabilityAssessmentScanRecordListResult{ - // Value: []*armsql.VulnerabilityAssessmentScanRecord{ - // { - // Name: to.Ptr("scan001"), - // Type: to.Ptr("Microsoft.Sql/servers/databases/vulnerabilityAssessments/scans"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/vulnerabilityassessmenttest-4799/providers/Microsoft.Sql/servers/vulnerabilityassessmenttest-6440/databases/testdb/vulnerabilityAssessments/default/scans/scan001"), - // Properties: &armsql.VulnerabilityAssessmentScanRecordProperties{ - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-12-12T17:47:06Z"); return t}()), - // Errors: []*armsql.VulnerabilityAssessmentScanError{ - // }, - // NumberOfFailedSecurityChecks: to.Ptr[int32](9), - // ScanID: to.Ptr("scan001"), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-12-12T17:45:06Z"); return t}()), - // State: to.Ptr(armsql.VulnerabilityAssessmentScanStatePassed), - // StorageContainerPath: to.Ptr("https://myaccount.blob.core.windows.net/vulnerability-assessment"), - // TriggerType: to.Ptr(armsql.VulnerabilityAssessmentScanTriggerTypeOnDemand), - // }, - // }, - // { - // Name: to.Ptr("scan002"), - // Type: to.Ptr("Microsoft.Sql/servers/databases/vulnerabilityAssessments/scans"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/vulnerabilityassessmenttest-4799/providers/Microsoft.Sql/servers/vulnerabilityassessmenttest-6440/databases/testdb/vulnerabilityAssessments/default/scans/scan002"), - // Properties: &armsql.VulnerabilityAssessmentScanRecordProperties{ - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-12-12T17:47:06Z"); return t}()), - // Errors: []*armsql.VulnerabilityAssessmentScanError{ - // }, - // NumberOfFailedSecurityChecks: to.Ptr[int32](9), - // ScanID: to.Ptr("scan002"), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-12-12T17:45:06Z"); return t}()), - // State: to.Ptr(armsql.VulnerabilityAssessmentScanStateFailed), - // StorageContainerPath: to.Ptr("https://myaccount.blob.core.windows.net/vulnerability-assessment"), - // TriggerType: to.Ptr(armsql.VulnerabilityAssessmentScanTriggerTypeRecurring), - // }, - // }, - // { - // Name: to.Ptr("scan003"), - // Type: to.Ptr("Microsoft.Sql/servers/databases/vulnerabilityAssessments/scans"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/vulnerabilityassessmenttest-4799/providers/Microsoft.Sql/servers/vulnerabilityassessmenttest-6440/databases/testdb/vulnerabilityAssessments/default/scans/scan003"), - // Properties: &armsql.VulnerabilityAssessmentScanRecordProperties{ - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-12-12T17:47:06Z"); return t}()), - // Errors: []*armsql.VulnerabilityAssessmentScanError{ - // { - // Code: to.Ptr("StorageNotFound"), - // Message: to.Ptr("Storage not found"), - // }}, - // NumberOfFailedSecurityChecks: to.Ptr[int32](0), - // ScanID: to.Ptr("scan003"), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-12-12T17:45:06Z"); return t}()), - // State: to.Ptr(armsql.VulnerabilityAssessmentScanStateFailedToRun), - // StorageContainerPath: to.Ptr("https://myaccount.blob.core.windows.net/vulnerability-assessment"), - // TriggerType: to.Ptr(armsql.VulnerabilityAssessmentScanTriggerTypeRecurring), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseVulnerabilityAssessmentScanRecordsGet.json -func ExampleDatabaseVulnerabilityAssessmentScansClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDatabaseVulnerabilityAssessmentScansClient().Get(ctx, "vulnerabilityassessmenttest-4711", "vulnerabilityassessmenttest-6411", "testdb", armsql.VulnerabilityAssessmentNameDefault, "scan001", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VulnerabilityAssessmentScanRecord = armsql.VulnerabilityAssessmentScanRecord{ - // Name: to.Ptr("scan001"), - // Type: to.Ptr("Microsoft.Sql/servers/databases/vulnerabilityAssessments/scans"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/vulnerabilityassessmenttest-4799/providers/Microsoft.Sql/servers/vulnerabilityassessmenttest-6440/databases/testdb/vulnerabilityAssessments/default/scans/scan001"), - // Properties: &armsql.VulnerabilityAssessmentScanRecordProperties{ - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-12-12T17:47:06Z"); return t}()), - // Errors: []*armsql.VulnerabilityAssessmentScanError{ - // }, - // NumberOfFailedSecurityChecks: to.Ptr[int32](9), - // ScanID: to.Ptr("scan001"), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-12-12T17:45:06Z"); return t}()), - // State: to.Ptr(armsql.VulnerabilityAssessmentScanStatePassed), - // StorageContainerPath: to.Ptr("https://myaccount.blob.core.windows.net/vulnerability-assessment"), - // TriggerType: to.Ptr(armsql.VulnerabilityAssessmentScanTriggerTypeOnDemand), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseVulnerabilityAssessmentScanExport.json -func ExampleDatabaseVulnerabilityAssessmentScansClient_Export() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDatabaseVulnerabilityAssessmentScansClient().Export(ctx, "vulnerabilityassessmenttest-4799", "vulnerabilityassessmenttest-6440", "testdb", armsql.VulnerabilityAssessmentNameDefault, "scan001", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DatabaseVulnerabilityAssessmentScansExport = armsql.DatabaseVulnerabilityAssessmentScansExport{ - // Name: to.Ptr("scan001"), - // Type: to.Ptr("Microsoft.Sql/servers/databases/vulnerabilityAssessments/scans/export"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/vulnerabilityassessmenttest-4799/providers/Microsoft.Sql/servers/vulnerabilityassessmenttest-6440/databases/testdb/vulnerabilityAssessments/default/scans/scan001/export"), - // Properties: &armsql.DatabaseVulnerabilityAssessmentScanExportProperties{ - // ExportedReportLocation: to.Ptr("https://myaccount.blob.core.windows.net/vulnerabilityAssessment/vulnerabilityassessmenttest-6440/testdb/scan001.xlsx"), - // }, - // } -} diff --git a/sdk/resourcemanager/sql/armsql/datamaskingpolicies_client.go b/sdk/resourcemanager/sql/armsql/datamaskingpolicies_client.go index 8f4a5acbd7ce..cb2cec58b019 100644 --- a/sdk/resourcemanager/sql/armsql/datamaskingpolicies_client.go +++ b/sdk/resourcemanager/sql/armsql/datamaskingpolicies_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armsql @@ -44,39 +43,39 @@ func NewDataMaskingPoliciesClient(subscriptionID string, credential azcore.Token return client, nil } -// CreateOrUpdate - Creates or updates a database data masking policy +// CreateOrUpdate - Creates or updates a database data masking policy. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2014-04-01 +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. // - databaseName - The name of the database. +// - dataMaskingPolicyName - The name of the database for which the data masking policy applies. // - parameters - Parameters for creating or updating a data masking policy. // - options - DataMaskingPoliciesClientCreateOrUpdateOptions contains the optional parameters for the DataMaskingPoliciesClient.CreateOrUpdate // method. -func (client *DataMaskingPoliciesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters DataMaskingPolicy, options *DataMaskingPoliciesClientCreateOrUpdateOptions) (DataMaskingPoliciesClientCreateOrUpdateResponse, error) { - req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, serverName, databaseName, parameters, options) +func (client *DataMaskingPoliciesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, databaseName string, dataMaskingPolicyName DataMaskingPolicyName, parameters DataMaskingPolicy, options *DataMaskingPoliciesClientCreateOrUpdateOptions) (DataMaskingPoliciesClientCreateOrUpdateResponse, error) { + var err error + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, serverName, databaseName, dataMaskingPolicyName, parameters, options) if err != nil { return DataMaskingPoliciesClientCreateOrUpdateResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return DataMaskingPoliciesClientCreateOrUpdateResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return DataMaskingPoliciesClientCreateOrUpdateResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return DataMaskingPoliciesClientCreateOrUpdateResponse{}, err } - return client.createOrUpdateHandleResponse(resp) + resp, err := client.createOrUpdateHandleResponse(httpResp) + return resp, err } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *DataMaskingPoliciesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters DataMaskingPolicy, options *DataMaskingPoliciesClientCreateOrUpdateOptions) (*policy.Request, error) { +func (client *DataMaskingPoliciesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, serverName string, databaseName string, dataMaskingPolicyName DataMaskingPolicyName, parameters DataMaskingPolicy, options *DataMaskingPoliciesClientCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/dataMaskingPolicies/{dataMaskingPolicyName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") } @@ -89,16 +88,26 @@ func (client *DataMaskingPoliciesClient) createOrUpdateCreateRequest(ctx context return nil, errors.New("parameter databaseName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{databaseName}", url.PathEscape(databaseName)) - urlPath = strings.ReplaceAll(urlPath, "{dataMaskingPolicyName}", url.PathEscape("Default")) + if dataMaskingPolicyName == "" { + return nil, errors.New("parameter dataMaskingPolicyName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{dataMaskingPolicyName}", url.PathEscape(string(dataMaskingPolicyName))) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2014-04-01") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // createOrUpdateHandleResponse handles the CreateOrUpdate response. @@ -110,37 +119,37 @@ func (client *DataMaskingPoliciesClient) createOrUpdateHandleResponse(resp *http return result, nil } -// Get - Gets a database data masking policy. +// Get - Gets the database data masking policy. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2014-04-01 +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. // - databaseName - The name of the database. +// - dataMaskingPolicyName - The name of the database for which the data masking policy applies. // - options - DataMaskingPoliciesClientGetOptions contains the optional parameters for the DataMaskingPoliciesClient.Get method. -func (client *DataMaskingPoliciesClient) Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string, options *DataMaskingPoliciesClientGetOptions) (DataMaskingPoliciesClientGetResponse, error) { - req, err := client.getCreateRequest(ctx, resourceGroupName, serverName, databaseName, options) +func (client *DataMaskingPoliciesClient) Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string, dataMaskingPolicyName DataMaskingPolicyName, options *DataMaskingPoliciesClientGetOptions) (DataMaskingPoliciesClientGetResponse, error) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, serverName, databaseName, dataMaskingPolicyName, options) if err != nil { return DataMaskingPoliciesClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return DataMaskingPoliciesClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return DataMaskingPoliciesClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DataMaskingPoliciesClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. -func (client *DataMaskingPoliciesClient) getCreateRequest(ctx context.Context, resourceGroupName string, serverName string, databaseName string, options *DataMaskingPoliciesClientGetOptions) (*policy.Request, error) { +func (client *DataMaskingPoliciesClient) getCreateRequest(ctx context.Context, resourceGroupName string, serverName string, databaseName string, dataMaskingPolicyName DataMaskingPolicyName, options *DataMaskingPoliciesClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/dataMaskingPolicies/{dataMaskingPolicyName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") } @@ -153,13 +162,20 @@ func (client *DataMaskingPoliciesClient) getCreateRequest(ctx context.Context, r return nil, errors.New("parameter databaseName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{databaseName}", url.PathEscape(databaseName)) - urlPath = strings.ReplaceAll(urlPath, "{dataMaskingPolicyName}", url.PathEscape("Default")) + if dataMaskingPolicyName == "" { + return nil, errors.New("parameter dataMaskingPolicyName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{dataMaskingPolicyName}", url.PathEscape(string(dataMaskingPolicyName))) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2014-04-01") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/sql/armsql/datamaskingpolicies_client_example_test.go b/sdk/resourcemanager/sql/armsql/datamaskingpolicies_client_example_test.go deleted file mode 100644 index 155510f76192..000000000000 --- a/sdk/resourcemanager/sql/armsql/datamaskingpolicies_client_example_test.go +++ /dev/null @@ -1,124 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsql_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sql/armsql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/stable/2014-04-01/examples/DataMaskingPolicyCreateOrUpdateMax.json -func ExampleDataMaskingPoliciesClient_CreateOrUpdate_createOrUpdateDataMaskingPolicyMax() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDataMaskingPoliciesClient().CreateOrUpdate(ctx, "sqlcrudtest-6852", "sqlcrudtest-2080", "sqlcrudtest-331", armsql.DataMaskingPolicy{ - Properties: &armsql.DataMaskingPolicyProperties{ - DataMaskingState: to.Ptr(armsql.DataMaskingStateEnabled), - ExemptPrincipals: to.Ptr("testuser;"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DataMaskingPolicy = armsql.DataMaskingPolicy{ - // Name: to.Ptr("Default"), - // Type: to.Ptr("Microsoft.Sql/servers/databases/dataMaskingPolicies"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/sqlcrudtest-6852/providers/Microsoft.Sql/servers/sqlcrudtest-2080/databases/sqlcrudtest-331/dataMaskingPolicies/Default"), - // Location: to.Ptr("Central US"), - // Properties: &armsql.DataMaskingPolicyProperties{ - // ApplicationPrincipals: to.Ptr(""), - // DataMaskingState: to.Ptr(armsql.DataMaskingStateEnabled), - // ExemptPrincipals: to.Ptr("testuser;"), - // MaskingLevel: to.Ptr(""), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/stable/2014-04-01/examples/DataMaskingPolicyCreateOrUpdateMin.json -func ExampleDataMaskingPoliciesClient_CreateOrUpdate_createOrUpdateDataMaskingPolicyMin() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDataMaskingPoliciesClient().CreateOrUpdate(ctx, "sqlcrudtest-6852", "sqlcrudtest-2080", "sqlcrudtest-331", armsql.DataMaskingPolicy{ - Properties: &armsql.DataMaskingPolicyProperties{ - DataMaskingState: to.Ptr(armsql.DataMaskingStateEnabled), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DataMaskingPolicy = armsql.DataMaskingPolicy{ - // Name: to.Ptr("Default"), - // Type: to.Ptr("Microsoft.Sql/servers/databases/dataMaskingPolicies"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/sqlcrudtest-6852/providers/Microsoft.Sql/servers/sqlcrudtest-2080/databases/sqlcrudtest-331/dataMaskingPolicies/Default"), - // Location: to.Ptr("Central US"), - // Properties: &armsql.DataMaskingPolicyProperties{ - // ApplicationPrincipals: to.Ptr(""), - // DataMaskingState: to.Ptr(armsql.DataMaskingStateEnabled), - // ExemptPrincipals: to.Ptr(""), - // MaskingLevel: to.Ptr(""), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/stable/2014-04-01/examples/DataMaskingPolicyGet.json -func ExampleDataMaskingPoliciesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDataMaskingPoliciesClient().Get(ctx, "sqlcrudtest-6852", "sqlcrudtest-2080", "sqlcrudtest-331", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DataMaskingPolicy = armsql.DataMaskingPolicy{ - // Name: to.Ptr("Default"), - // Type: to.Ptr("Microsoft.Sql/servers/databases/dataMaskingPolicies"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/sqlcrudtest-6852/providers/Microsoft.Sql/servers/sqlcrudtest-2080/databases/sqlcrudtest-331/dataMaskingPolicies/Default"), - // Location: to.Ptr("Central US"), - // Properties: &armsql.DataMaskingPolicyProperties{ - // ApplicationPrincipals: to.Ptr(""), - // DataMaskingState: to.Ptr(armsql.DataMaskingStateEnabled), - // ExemptPrincipals: to.Ptr(""), - // MaskingLevel: to.Ptr(""), - // }, - // } -} diff --git a/sdk/resourcemanager/sql/armsql/datamaskingrules_client.go b/sdk/resourcemanager/sql/armsql/datamaskingrules_client.go index 01e0c459ff41..273c2606f63e 100644 --- a/sdk/resourcemanager/sql/armsql/datamaskingrules_client.go +++ b/sdk/resourcemanager/sql/armsql/datamaskingrules_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armsql @@ -47,37 +46,37 @@ func NewDataMaskingRulesClient(subscriptionID string, credential azcore.TokenCre // CreateOrUpdate - Creates or updates a database data masking rule. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2014-04-01 +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. // - databaseName - The name of the database. +// - dataMaskingPolicyName - The name of the database for which the data masking policy applies. // - dataMaskingRuleName - The name of the data masking rule. // - parameters - The required parameters for creating or updating a data masking rule. // - options - DataMaskingRulesClientCreateOrUpdateOptions contains the optional parameters for the DataMaskingRulesClient.CreateOrUpdate // method. -func (client *DataMaskingRulesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, databaseName string, dataMaskingRuleName string, parameters DataMaskingRule, options *DataMaskingRulesClientCreateOrUpdateOptions) (DataMaskingRulesClientCreateOrUpdateResponse, error) { - req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, serverName, databaseName, dataMaskingRuleName, parameters, options) +func (client *DataMaskingRulesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, databaseName string, dataMaskingPolicyName DataMaskingPolicyName, dataMaskingRuleName string, parameters DataMaskingRule, options *DataMaskingRulesClientCreateOrUpdateOptions) (DataMaskingRulesClientCreateOrUpdateResponse, error) { + var err error + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, serverName, databaseName, dataMaskingPolicyName, dataMaskingRuleName, parameters, options) if err != nil { return DataMaskingRulesClientCreateOrUpdateResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return DataMaskingRulesClientCreateOrUpdateResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { - return DataMaskingRulesClientCreateOrUpdateResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return DataMaskingRulesClientCreateOrUpdateResponse{}, err } - return client.createOrUpdateHandleResponse(resp) + resp, err := client.createOrUpdateHandleResponse(httpResp) + return resp, err } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *DataMaskingRulesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, serverName string, databaseName string, dataMaskingRuleName string, parameters DataMaskingRule, options *DataMaskingRulesClientCreateOrUpdateOptions) (*policy.Request, error) { +func (client *DataMaskingRulesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, serverName string, databaseName string, dataMaskingPolicyName DataMaskingPolicyName, dataMaskingRuleName string, parameters DataMaskingRule, options *DataMaskingRulesClientCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/dataMaskingPolicies/{dataMaskingPolicyName}/rules/{dataMaskingRuleName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") } @@ -90,20 +89,30 @@ func (client *DataMaskingRulesClient) createOrUpdateCreateRequest(ctx context.Co return nil, errors.New("parameter databaseName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{databaseName}", url.PathEscape(databaseName)) - urlPath = strings.ReplaceAll(urlPath, "{dataMaskingPolicyName}", url.PathEscape("Default")) + if dataMaskingPolicyName == "" { + return nil, errors.New("parameter dataMaskingPolicyName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{dataMaskingPolicyName}", url.PathEscape(string(dataMaskingPolicyName))) if dataMaskingRuleName == "" { return nil, errors.New("parameter dataMaskingRuleName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{dataMaskingRuleName}", url.PathEscape(dataMaskingRuleName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2014-04-01") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // createOrUpdateHandleResponse handles the CreateOrUpdate response. @@ -117,20 +126,27 @@ func (client *DataMaskingRulesClient) createOrUpdateHandleResponse(resp *http.Re // NewListByDatabasePager - Gets a list of database data masking rules. // -// Generated from API version 2014-04-01 +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. // - databaseName - The name of the database. +// - dataMaskingPolicyName - The name of the database for which the data masking rule applies. // - options - DataMaskingRulesClientListByDatabaseOptions contains the optional parameters for the DataMaskingRulesClient.NewListByDatabasePager // method. -func (client *DataMaskingRulesClient) NewListByDatabasePager(resourceGroupName string, serverName string, databaseName string, options *DataMaskingRulesClientListByDatabaseOptions) *runtime.Pager[DataMaskingRulesClientListByDatabaseResponse] { +func (client *DataMaskingRulesClient) NewListByDatabasePager(resourceGroupName string, serverName string, databaseName string, dataMaskingPolicyName DataMaskingPolicyName, options *DataMaskingRulesClientListByDatabaseOptions) *runtime.Pager[DataMaskingRulesClientListByDatabaseResponse] { return runtime.NewPager(runtime.PagingHandler[DataMaskingRulesClientListByDatabaseResponse]{ More: func(page DataMaskingRulesClientListByDatabaseResponse) bool { - return false + return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *DataMaskingRulesClientListByDatabaseResponse) (DataMaskingRulesClientListByDatabaseResponse, error) { - req, err := client.listByDatabaseCreateRequest(ctx, resourceGroupName, serverName, databaseName, options) + var req *policy.Request + var err error + if page == nil { + req, err = client.listByDatabaseCreateRequest(ctx, resourceGroupName, serverName, databaseName, dataMaskingPolicyName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } if err != nil { return DataMaskingRulesClientListByDatabaseResponse{}, err } @@ -147,12 +163,8 @@ func (client *DataMaskingRulesClient) NewListByDatabasePager(resourceGroupName s } // listByDatabaseCreateRequest creates the ListByDatabase request. -func (client *DataMaskingRulesClient) listByDatabaseCreateRequest(ctx context.Context, resourceGroupName string, serverName string, databaseName string, options *DataMaskingRulesClientListByDatabaseOptions) (*policy.Request, error) { +func (client *DataMaskingRulesClient) listByDatabaseCreateRequest(ctx context.Context, resourceGroupName string, serverName string, databaseName string, dataMaskingPolicyName DataMaskingPolicyName, options *DataMaskingRulesClientListByDatabaseOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/dataMaskingPolicies/{dataMaskingPolicyName}/rules" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") } @@ -165,13 +177,20 @@ func (client *DataMaskingRulesClient) listByDatabaseCreateRequest(ctx context.Co return nil, errors.New("parameter databaseName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{databaseName}", url.PathEscape(databaseName)) - urlPath = strings.ReplaceAll(urlPath, "{dataMaskingPolicyName}", url.PathEscape("Default")) + if dataMaskingPolicyName == "" { + return nil, errors.New("parameter dataMaskingPolicyName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{dataMaskingPolicyName}", url.PathEscape(string(dataMaskingPolicyName))) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2014-04-01") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/sql/armsql/datamaskingrules_client_example_test.go b/sdk/resourcemanager/sql/armsql/datamaskingrules_client_example_test.go deleted file mode 100644 index 00819454bfdf..000000000000 --- a/sdk/resourcemanager/sql/armsql/datamaskingrules_client_example_test.go +++ /dev/null @@ -1,251 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsql_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sql/armsql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/stable/2014-04-01/examples/DataMaskingRuleCreateOrUpdateDefaultMax.json -func ExampleDataMaskingRulesClient_CreateOrUpdate_createUpdateDataMaskingRuleForDefaultMax() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDataMaskingRulesClient().CreateOrUpdate(ctx, "sqlcrudtest-6852", "sqlcrudtest-2080", "sqlcrudtest-331", "rule1", armsql.DataMaskingRule{ - Properties: &armsql.DataMaskingRuleProperties{ - AliasName: to.Ptr("nickname"), - ColumnName: to.Ptr("test1"), - MaskingFunction: to.Ptr(armsql.DataMaskingFunctionDefault), - RuleState: to.Ptr(armsql.DataMaskingRuleStateEnabled), - SchemaName: to.Ptr("dbo"), - TableName: to.Ptr("Table_1"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DataMaskingRule = armsql.DataMaskingRule{ - // Type: to.Ptr("Microsoft.Sql/servers/databases/dataMaskingPolicies/rules"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/sqlcrudtest-6852/providers/Microsoft.Sql/servers/sqlcrudtest-6852/databases/sqlcrudtest-331/dataMaskingPolicies/Default/rules/"), - // Location: to.Ptr("Central US"), - // Properties: &armsql.DataMaskingRuleProperties{ - // AliasName: to.Ptr("nickname"), - // ColumnName: to.Ptr("test1"), - // ID: to.Ptr("dbo_Table_1_test1"), - // MaskingFunction: to.Ptr(armsql.DataMaskingFunctionDefault), - // RuleState: to.Ptr(armsql.DataMaskingRuleStateEnabled), - // SchemaName: to.Ptr("dbo"), - // TableName: to.Ptr("Table_1"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/stable/2014-04-01/examples/DataMaskingRuleCreateOrUpdateDefaultMin.json -func ExampleDataMaskingRulesClient_CreateOrUpdate_createUpdateDataMaskingRuleForDefaultMin() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDataMaskingRulesClient().CreateOrUpdate(ctx, "sqlcrudtest-6852", "sqlcrudtest-2080", "sqlcrudtest-331", "rule1", armsql.DataMaskingRule{ - Properties: &armsql.DataMaskingRuleProperties{ - ColumnName: to.Ptr("test1"), - MaskingFunction: to.Ptr(armsql.DataMaskingFunctionDefault), - SchemaName: to.Ptr("dbo"), - TableName: to.Ptr("Table_1"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DataMaskingRule = armsql.DataMaskingRule{ - // Type: to.Ptr("Microsoft.Sql/servers/databases/dataMaskingPolicies/rules"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/sqlcrudtest-6852/providers/Microsoft.Sql/servers/sqlcrudtest-6852/databases/sqlcrudtest-331/dataMaskingPolicies/Default/rules/"), - // Location: to.Ptr("Central US"), - // Properties: &armsql.DataMaskingRuleProperties{ - // ColumnName: to.Ptr("test1"), - // ID: to.Ptr("dbo_Table_1_test1"), - // MaskingFunction: to.Ptr(armsql.DataMaskingFunctionDefault), - // RuleState: to.Ptr(armsql.DataMaskingRuleStateEnabled), - // SchemaName: to.Ptr("dbo"), - // TableName: to.Ptr("Table_1"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/stable/2014-04-01/examples/DataMaskingRuleCreateOrUpdateNumber.json -func ExampleDataMaskingRulesClient_CreateOrUpdate_createUpdateDataMaskingRuleForNumbers() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDataMaskingRulesClient().CreateOrUpdate(ctx, "sqlcrudtest-6852", "sqlcrudtest-2080", "sqlcrudtest-331", "rule1", armsql.DataMaskingRule{ - Properties: &armsql.DataMaskingRuleProperties{ - ColumnName: to.Ptr("test1"), - MaskingFunction: to.Ptr(armsql.DataMaskingFunctionNumber), - NumberFrom: to.Ptr("0"), - NumberTo: to.Ptr("2"), - SchemaName: to.Ptr("dbo"), - TableName: to.Ptr("Table_1"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DataMaskingRule = armsql.DataMaskingRule{ - // Type: to.Ptr("Microsoft.Sql/servers/databases/dataMaskingPolicies/rules"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/sqlcrudtest-6852/providers/Microsoft.Sql/servers/sqlcrudtest-6852/databases/sqlcrudtest-331/dataMaskingPolicies/Default/rules/"), - // Location: to.Ptr("Central US"), - // Properties: &armsql.DataMaskingRuleProperties{ - // ColumnName: to.Ptr("test1"), - // ID: to.Ptr("dbo_Table_1_test1"), - // MaskingFunction: to.Ptr(armsql.DataMaskingFunctionNumber), - // NumberFrom: to.Ptr("0"), - // NumberTo: to.Ptr("2"), - // RuleState: to.Ptr(armsql.DataMaskingRuleStateEnabled), - // SchemaName: to.Ptr("dbo"), - // TableName: to.Ptr("Table_1"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/stable/2014-04-01/examples/DataMaskingRuleCreateOrUpdateText.json -func ExampleDataMaskingRulesClient_CreateOrUpdate_createUpdateDataMaskingRuleForText() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDataMaskingRulesClient().CreateOrUpdate(ctx, "sqlcrudtest-6852", "sqlcrudtest-2080", "sqlcrudtest-331", "rule1", armsql.DataMaskingRule{ - Properties: &armsql.DataMaskingRuleProperties{ - ColumnName: to.Ptr("test1"), - MaskingFunction: to.Ptr(armsql.DataMaskingFunctionText), - PrefixSize: to.Ptr("1"), - ReplacementString: to.Ptr("asdf"), - SchemaName: to.Ptr("dbo"), - SuffixSize: to.Ptr("0"), - TableName: to.Ptr("Table_1"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DataMaskingRule = armsql.DataMaskingRule{ - // Type: to.Ptr("Microsoft.Sql/servers/databases/dataMaskingPolicies/rules"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/sqlcrudtest-6852/providers/Microsoft.Sql/servers/sqlcrudtest-6852/databases/sqlcrudtest-331/dataMaskingPolicies/Default/rules/"), - // Location: to.Ptr("Central US"), - // Properties: &armsql.DataMaskingRuleProperties{ - // ColumnName: to.Ptr("test1"), - // ID: to.Ptr("dbo_Table_1_test1"), - // MaskingFunction: to.Ptr(armsql.DataMaskingFunctionText), - // PrefixSize: to.Ptr("1"), - // ReplacementString: to.Ptr("asdf"), - // RuleState: to.Ptr(armsql.DataMaskingRuleStateEnabled), - // SchemaName: to.Ptr("dbo"), - // SuffixSize: to.Ptr("0"), - // TableName: to.Ptr("Table_1"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/stable/2014-04-01/examples/DataMaskingRuleList.json -func ExampleDataMaskingRulesClient_NewListByDatabasePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDataMaskingRulesClient().NewListByDatabasePager("sqlcrudtest-6852", "sqlcrudtest-2080", "sqlcrudtest-331", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DataMaskingRuleListResult = armsql.DataMaskingRuleListResult{ - // Value: []*armsql.DataMaskingRule{ - // { - // Type: to.Ptr("Microsoft.Sql/servers/databases/dataMaskingPolicies/rules"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/sqlcrudtest-6852/providers/Microsoft.Sql/servers/sqlcrudtest-6852/databases/sqlcrudtest-331/dataMaskingPolicies/Default/rules/"), - // Location: to.Ptr("Central US"), - // Properties: &armsql.DataMaskingRuleProperties{ - // ColumnName: to.Ptr("test1"), - // ID: to.Ptr("dbo_Table_1_test1"), - // MaskingFunction: to.Ptr(armsql.DataMaskingFunctionText), - // PrefixSize: to.Ptr("1"), - // ReplacementString: to.Ptr("asdf"), - // RuleState: to.Ptr(armsql.DataMaskingRuleStateEnabled), - // SchemaName: to.Ptr("dbo"), - // SuffixSize: to.Ptr("0"), - // TableName: to.Ptr("Table_1"), - // }, - // }, - // { - // Type: to.Ptr("Microsoft.Sql/servers/databases/dataMaskingPolicies/rules"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/sqlcrudtest-6852/providers/Microsoft.Sql/servers/sqlcrudtest-6852/databases/sqlcrudtest-331/dataMaskingPolicies/Default/rules/"), - // Location: to.Ptr("Central US"), - // Properties: &armsql.DataMaskingRuleProperties{ - // ColumnName: to.Ptr("test1"), - // ID: to.Ptr("dbo_Table_1_test1"), - // MaskingFunction: to.Ptr(armsql.DataMaskingFunctionNumber), - // NumberFrom: to.Ptr("0"), - // NumberTo: to.Ptr("2"), - // RuleState: to.Ptr(armsql.DataMaskingRuleStateEnabled), - // SchemaName: to.Ptr("dbo"), - // TableName: to.Ptr("Table_1"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/sql/armsql/datawarehouseuseractivities_client.go b/sdk/resourcemanager/sql/armsql/datawarehouseuseractivities_client.go index 9024df39abe2..f6565589b0d0 100644 --- a/sdk/resourcemanager/sql/armsql/datawarehouseuseractivities_client.go +++ b/sdk/resourcemanager/sql/armsql/datawarehouseuseractivities_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armsql @@ -47,7 +46,7 @@ func NewDataWarehouseUserActivitiesClient(subscriptionID string, credential azco // Get - Gets the user activities of a data warehouse which includes running and suspended queries // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -56,18 +55,21 @@ func NewDataWarehouseUserActivitiesClient(subscriptionID string, credential azco // - options - DataWarehouseUserActivitiesClientGetOptions contains the optional parameters for the DataWarehouseUserActivitiesClient.Get // method. func (client *DataWarehouseUserActivitiesClient) Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string, dataWarehouseUserActivityName DataWarehouseUserActivityName, options *DataWarehouseUserActivitiesClientGetOptions) (DataWarehouseUserActivitiesClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, serverName, databaseName, dataWarehouseUserActivityName, options) if err != nil { return DataWarehouseUserActivitiesClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return DataWarehouseUserActivitiesClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return DataWarehouseUserActivitiesClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DataWarehouseUserActivitiesClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -98,7 +100,7 @@ func (client *DataWarehouseUserActivitiesClient) getCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -115,7 +117,7 @@ func (client *DataWarehouseUserActivitiesClient) getHandleResponse(resp *http.Re // NewListByDatabasePager - List the user activities of a data warehouse which includes running and suspended queries // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -174,7 +176,7 @@ func (client *DataWarehouseUserActivitiesClient) listByDatabaseCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/sql/armsql/datawarehouseuseractivities_client_example_test.go b/sdk/resourcemanager/sql/armsql/datawarehouseuseractivities_client_example_test.go deleted file mode 100644 index e319c70ea0fe..000000000000 --- a/sdk/resourcemanager/sql/armsql/datawarehouseuseractivities_client_example_test.go +++ /dev/null @@ -1,81 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsql_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sql/armsql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/GetDataWarehouseUserActivities.json -func ExampleDataWarehouseUserActivitiesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDataWarehouseUserActivitiesClient().Get(ctx, "Default-SQL-SouthEastAsia", "testsvr", "testdb", armsql.DataWarehouseUserActivityNameCurrent, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DataWarehouseUserActivities = armsql.DataWarehouseUserActivities{ - // Name: to.Ptr("current"), - // Type: to.Ptr("Microsoft.Sql/servers/databases/dataWarehouseUserActivities"), - // ID: to.Ptr("subscriptions/326affc3-21f4-4471-a545-e37430b70113/resourceGroups/Default-SQL-Onebox/providers/Microsoft.Sql/servers/testsvr/databases/dwdb01/dataWarehouseUserActivities/current"), - // Properties: &armsql.DataWarehouseUserActivitiesProperties{ - // ActiveQueriesCount: to.Ptr[int32](0), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ListDataWarehouseUserActivities.json -func ExampleDataWarehouseUserActivitiesClient_NewListByDatabasePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDataWarehouseUserActivitiesClient().NewListByDatabasePager("Default-SQL-SouthEastAsia", "testsvr", "testdb", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DataWarehouseUserActivitiesListResult = armsql.DataWarehouseUserActivitiesListResult{ - // Value: []*armsql.DataWarehouseUserActivities{ - // { - // Type: to.Ptr("Microsoft.Sql/servers/databases/dataWarehouseUserActivities"), - // ID: to.Ptr("subscriptions/326affc3-21f4-4471-a545-e37430b70113/resourceGroups/Default-SQL-Onebox/providers/Microsoft.Sql/servers/testsvr/databases/dwdb01/dataWarehouseUserActivities/current"), - // Properties: &armsql.DataWarehouseUserActivitiesProperties{ - // ActiveQueriesCount: to.Ptr[int32](0), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/sql/armsql/deletedservers_client.go b/sdk/resourcemanager/sql/armsql/deletedservers_client.go index 6d53d727f713..dc6b2ff22ab2 100644 --- a/sdk/resourcemanager/sql/armsql/deletedservers_client.go +++ b/sdk/resourcemanager/sql/armsql/deletedservers_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armsql @@ -47,23 +46,26 @@ func NewDeletedServersClient(subscriptionID string, credential azcore.TokenCrede // Get - Gets a deleted server. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - locationName - The name of the region where the resource is located. // - deletedServerName - The name of the deleted server. // - options - DeletedServersClientGetOptions contains the optional parameters for the DeletedServersClient.Get method. func (client *DeletedServersClient) Get(ctx context.Context, locationName string, deletedServerName string, options *DeletedServersClientGetOptions) (DeletedServersClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, locationName, deletedServerName, options) if err != nil { return DeletedServersClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return DeletedServersClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return DeletedServersClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DeletedServersClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -86,7 +88,7 @@ func (client *DeletedServersClient) getCreateRequest(ctx context.Context, locati return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -103,7 +105,7 @@ func (client *DeletedServersClient) getHandleResponse(resp *http.Response) (Dele // NewListPager - Gets a list of all deleted servers in a subscription. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - options - DeletedServersClientListOptions contains the optional parameters for the DeletedServersClient.NewListPager method. func (client *DeletedServersClient) NewListPager(options *DeletedServersClientListOptions) *runtime.Pager[DeletedServersClientListResponse] { return runtime.NewPager(runtime.PagingHandler[DeletedServersClientListResponse]{ @@ -145,7 +147,7 @@ func (client *DeletedServersClient) listCreateRequest(ctx context.Context, optio return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -162,7 +164,7 @@ func (client *DeletedServersClient) listHandleResponse(resp *http.Response) (Del // NewListByLocationPager - Gets a list of deleted servers for a location. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - locationName - The name of the region where the resource is located. // - options - DeletedServersClientListByLocationOptions contains the optional parameters for the DeletedServersClient.NewListByLocationPager // method. @@ -210,7 +212,7 @@ func (client *DeletedServersClient) listByLocationCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -228,7 +230,7 @@ func (client *DeletedServersClient) listByLocationHandleResponse(resp *http.Resp // BeginRecover - Recovers a deleted server. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - locationName - The name of the region where the resource is located. // - deletedServerName - The name of the deleted server. // - options - DeletedServersClientBeginRecoverOptions contains the optional parameters for the DeletedServersClient.BeginRecover @@ -239,7 +241,8 @@ func (client *DeletedServersClient) BeginRecover(ctx context.Context, locationNa if err != nil { return nil, err } - return runtime.NewPoller[DeletedServersClientRecoverResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[DeletedServersClientRecoverResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[DeletedServersClientRecoverResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -248,20 +251,22 @@ func (client *DeletedServersClient) BeginRecover(ctx context.Context, locationNa // Recover - Recovers a deleted server. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview func (client *DeletedServersClient) recoverOperation(ctx context.Context, locationName string, deletedServerName string, options *DeletedServersClientBeginRecoverOptions) (*http.Response, error) { + var err error req, err := client.recoverCreateRequest(ctx, locationName, deletedServerName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // recoverCreateRequest creates the Recover request. @@ -284,7 +289,7 @@ func (client *DeletedServersClient) recoverCreateRequest(ctx context.Context, lo return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/sql/armsql/deletedservers_client_example_test.go b/sdk/resourcemanager/sql/armsql/deletedservers_client_example_test.go deleted file mode 100644 index 5b71839fc7c2..000000000000 --- a/sdk/resourcemanager/sql/armsql/deletedservers_client_example_test.go +++ /dev/null @@ -1,184 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsql_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sql/armsql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DeletedServerListBySubscription.json -func ExampleDeletedServersClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDeletedServersClient().NewListPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DeletedServerListResult = armsql.DeletedServerListResult{ - // Value: []*armsql.DeletedServer{ - // { - // Name: to.Ptr("sqlcrudtest-d-1414"), - // Type: to.Ptr("Microsoft.Sql/deletedServers"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/providers/Microsoft.Sql/locations/japaneast/deletedServers/sqlcrudtest-d-1414"), - // Properties: &armsql.DeletedServerProperties{ - // DeletionTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-06-15T20:20:00.345Z"); return t}()), - // FullyQualifiedDomainName: to.Ptr("sqlcrudtest-d-1414.database.windows.net"), - // OriginalID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/servers/sqlcrudtest-d-1414"), - // Version: to.Ptr("12.0"), - // }, - // }, - // { - // Name: to.Ptr("sqlcrudtest-d-2424"), - // Type: to.Ptr("Microsoft.Sql/deletedServers"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/providers/Microsoft.Sql/locations/japaneast/deletedServers/sqlcrudtest-d-2424"), - // Properties: &armsql.DeletedServerProperties{ - // DeletionTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-06-13T10:10:00.678Z"); return t}()), - // FullyQualifiedDomainName: to.Ptr("sqlcrudtest-d-2424.database.windows.net"), - // OriginalID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/servers/sqlcrudtest-d-2424"), - // Version: to.Ptr("12.0"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DeletedServerGet.json -func ExampleDeletedServersClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDeletedServersClient().Get(ctx, "japaneast", "sqlcrudtest-d-1414", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DeletedServer = armsql.DeletedServer{ - // Name: to.Ptr("sqlcrudtest-d-1414"), - // Type: to.Ptr("Microsoft.Sql/deletedServers"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/providers/Microsoft.Sql/locations/japaneast/deletedServers/sqlcrudtest-d-1414"), - // Properties: &armsql.DeletedServerProperties{ - // DeletionTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-06-15T11:20:00.345Z"); return t}()), - // FullyQualifiedDomainName: to.Ptr("sqlcrudtest-d-1414.database.windows.net"), - // OriginalID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/servers/sqlcrudtest-d-1414"), - // Version: to.Ptr("12.0"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DeletedServerList.json -func ExampleDeletedServersClient_NewListByLocationPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDeletedServersClient().NewListByLocationPager("japaneast", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DeletedServerListResult = armsql.DeletedServerListResult{ - // Value: []*armsql.DeletedServer{ - // { - // Name: to.Ptr("sqlcrudtest-d-1414"), - // Type: to.Ptr("Microsoft.Sql/deletedServers"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/providers/Microsoft.Sql/locations/japaneast/deletedServers/sqlcrudtest-d-1414"), - // Properties: &armsql.DeletedServerProperties{ - // DeletionTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-06-15T20:20:00.345Z"); return t}()), - // FullyQualifiedDomainName: to.Ptr("sqlcrudtest-d-1414.database.windows.net"), - // OriginalID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/servers/sqlcrudtest-d-1414"), - // Version: to.Ptr("12.0"), - // }, - // }, - // { - // Name: to.Ptr("sqlcrudtest-d-2424"), - // Type: to.Ptr("Microsoft.Sql/deletedServers"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/providers/Microsoft.Sql/locations/japaneast/deletedServers/sqlcrudtest-d-2424"), - // Properties: &armsql.DeletedServerProperties{ - // DeletionTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-06-13T10:10:00.678Z"); return t}()), - // FullyQualifiedDomainName: to.Ptr("sqlcrudtest-d-2424.database.windows.net"), - // OriginalID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/servers/sqlcrudtest-d-2424"), - // Version: to.Ptr("12.0"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DeletedServerRecover.json -func ExampleDeletedServersClient_BeginRecover() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDeletedServersClient().BeginRecover(ctx, "japaneast", "sqlcrudtest-d-1414", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DeletedServer = armsql.DeletedServer{ - // Name: to.Ptr("sqlcrudtest-d-1414"), - // Type: to.Ptr("Microsoft.Sql/deletedServers"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/providers/Microsoft.Sql/locations/japaneast/deletedServers/sqlcrudtest-d-1414"), - // Properties: &armsql.DeletedServerProperties{ - // DeletionTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-06-15T11:20:00.345Z"); return t}()), - // FullyQualifiedDomainName: to.Ptr("sqlcrudtest-d-1414.database.windows.net"), - // OriginalID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/servers/sqlcrudtest-d-1414"), - // Version: to.Ptr("12.0"), - // }, - // } -} diff --git a/sdk/resourcemanager/sql/armsql/distributedavailabilitygroups_client.go b/sdk/resourcemanager/sql/armsql/distributedavailabilitygroups_client.go index 4f000d16e0f2..14d122924435 100644 --- a/sdk/resourcemanager/sql/armsql/distributedavailabilitygroups_client.go +++ b/sdk/resourcemanager/sql/armsql/distributedavailabilitygroups_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armsql @@ -47,7 +46,7 @@ func NewDistributedAvailabilityGroupsClient(subscriptionID string, credential az // BeginCreateOrUpdate - Creates a distributed availability group between Sql On-Prem and Sql Managed Instance. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - managedInstanceName - The name of the managed instance. @@ -61,7 +60,8 @@ func (client *DistributedAvailabilityGroupsClient) BeginCreateOrUpdate(ctx conte if err != nil { return nil, err } - return runtime.NewPoller[DistributedAvailabilityGroupsClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[DistributedAvailabilityGroupsClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[DistributedAvailabilityGroupsClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -70,20 +70,22 @@ func (client *DistributedAvailabilityGroupsClient) BeginCreateOrUpdate(ctx conte // CreateOrUpdate - Creates a distributed availability group between Sql On-Prem and Sql Managed Instance. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-11-01-preview +// Generated from API version 2022-11-01-preview func (client *DistributedAvailabilityGroupsClient) createOrUpdate(ctx context.Context, resourceGroupName string, managedInstanceName string, distributedAvailabilityGroupName string, parameters DistributedAvailabilityGroup, options *DistributedAvailabilityGroupsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, managedInstanceName, distributedAvailabilityGroupName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createOrUpdateCreateRequest creates the CreateOrUpdate request. @@ -110,16 +112,19 @@ func (client *DistributedAvailabilityGroupsClient) createOrUpdateCreateRequest(c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // BeginDelete - Drops a distributed availability group between Sql On-Prem and Sql Managed Instance. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - managedInstanceName - The name of the managed instance. @@ -132,7 +137,8 @@ func (client *DistributedAvailabilityGroupsClient) BeginDelete(ctx context.Conte if err != nil { return nil, err } - return runtime.NewPoller[DistributedAvailabilityGroupsClientDeleteResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[DistributedAvailabilityGroupsClientDeleteResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[DistributedAvailabilityGroupsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -141,20 +147,22 @@ func (client *DistributedAvailabilityGroupsClient) BeginDelete(ctx context.Conte // Delete - Drops a distributed availability group between Sql On-Prem and Sql Managed Instance. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-11-01-preview +// Generated from API version 2022-11-01-preview func (client *DistributedAvailabilityGroupsClient) deleteOperation(ctx context.Context, resourceGroupName string, managedInstanceName string, distributedAvailabilityGroupName string, options *DistributedAvailabilityGroupsClientBeginDeleteOptions) (*http.Response, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, managedInstanceName, distributedAvailabilityGroupName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteCreateRequest creates the Delete request. @@ -181,7 +189,7 @@ func (client *DistributedAvailabilityGroupsClient) deleteCreateRequest(ctx conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -189,7 +197,7 @@ func (client *DistributedAvailabilityGroupsClient) deleteCreateRequest(ctx conte // Get - Gets a distributed availability group info. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - managedInstanceName - The name of the managed instance. @@ -197,18 +205,21 @@ func (client *DistributedAvailabilityGroupsClient) deleteCreateRequest(ctx conte // - options - DistributedAvailabilityGroupsClientGetOptions contains the optional parameters for the DistributedAvailabilityGroupsClient.Get // method. func (client *DistributedAvailabilityGroupsClient) Get(ctx context.Context, resourceGroupName string, managedInstanceName string, distributedAvailabilityGroupName string, options *DistributedAvailabilityGroupsClientGetOptions) (DistributedAvailabilityGroupsClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, managedInstanceName, distributedAvailabilityGroupName, options) if err != nil { return DistributedAvailabilityGroupsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return DistributedAvailabilityGroupsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return DistributedAvailabilityGroupsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DistributedAvailabilityGroupsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -235,7 +246,7 @@ func (client *DistributedAvailabilityGroupsClient) getCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -252,7 +263,7 @@ func (client *DistributedAvailabilityGroupsClient) getHandleResponse(resp *http. // NewListByInstancePager - Gets a list of a distributed availability groups in instance. // -// Generated from API version 2021-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - managedInstanceName - The name of the managed instance. @@ -306,7 +317,7 @@ func (client *DistributedAvailabilityGroupsClient) listByInstanceCreateRequest(c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -321,10 +332,88 @@ func (client *DistributedAvailabilityGroupsClient) listByInstanceHandleResponse( return result, nil } +// BeginSetRole - Sets the role for managed instance in a distributed availability group. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-11-01-preview +// - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure +// Resource Manager API or the portal. +// - managedInstanceName - The name of the managed instance. +// - distributedAvailabilityGroupName - The distributed availability group name. +// - parameters - The distributed availability group set role request parameters. +// - options - DistributedAvailabilityGroupsClientBeginSetRoleOptions contains the optional parameters for the DistributedAvailabilityGroupsClient.BeginSetRole +// method. +func (client *DistributedAvailabilityGroupsClient) BeginSetRole(ctx context.Context, resourceGroupName string, managedInstanceName string, distributedAvailabilityGroupName string, parameters DistributedAvailabilityGroupSetRole, options *DistributedAvailabilityGroupsClientBeginSetRoleOptions) (*runtime.Poller[DistributedAvailabilityGroupsClientSetRoleResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.setRole(ctx, resourceGroupName, managedInstanceName, distributedAvailabilityGroupName, parameters, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller[DistributedAvailabilityGroupsClientSetRoleResponse](resp, client.internal.Pipeline(), nil) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[DistributedAvailabilityGroupsClientSetRoleResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// SetRole - Sets the role for managed instance in a distributed availability group. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-11-01-preview +func (client *DistributedAvailabilityGroupsClient) setRole(ctx context.Context, resourceGroupName string, managedInstanceName string, distributedAvailabilityGroupName string, parameters DistributedAvailabilityGroupSetRole, options *DistributedAvailabilityGroupsClientBeginSetRoleOptions) (*http.Response, error) { + var err error + req, err := client.setRoleCreateRequest(ctx, resourceGroupName, managedInstanceName, distributedAvailabilityGroupName, parameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// setRoleCreateRequest creates the SetRole request. +func (client *DistributedAvailabilityGroupsClient) setRoleCreateRequest(ctx context.Context, resourceGroupName string, managedInstanceName string, distributedAvailabilityGroupName string, parameters DistributedAvailabilityGroupSetRole, options *DistributedAvailabilityGroupsClientBeginSetRoleOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/distributedAvailabilityGroups/{distributedAvailabilityGroupName}/setRole" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if managedInstanceName == "" { + return nil, errors.New("parameter managedInstanceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{managedInstanceName}", url.PathEscape(managedInstanceName)) + if distributedAvailabilityGroupName == "" { + return nil, errors.New("parameter distributedAvailabilityGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{distributedAvailabilityGroupName}", url.PathEscape(distributedAvailabilityGroupName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + // BeginUpdate - Updates a distributed availability group replication mode. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - managedInstanceName - The name of the managed instance. @@ -338,7 +427,8 @@ func (client *DistributedAvailabilityGroupsClient) BeginUpdate(ctx context.Conte if err != nil { return nil, err } - return runtime.NewPoller[DistributedAvailabilityGroupsClientUpdateResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[DistributedAvailabilityGroupsClientUpdateResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[DistributedAvailabilityGroupsClientUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -347,20 +437,22 @@ func (client *DistributedAvailabilityGroupsClient) BeginUpdate(ctx context.Conte // Update - Updates a distributed availability group replication mode. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-11-01-preview +// Generated from API version 2022-11-01-preview func (client *DistributedAvailabilityGroupsClient) update(ctx context.Context, resourceGroupName string, managedInstanceName string, distributedAvailabilityGroupName string, parameters DistributedAvailabilityGroup, options *DistributedAvailabilityGroupsClientBeginUpdateOptions) (*http.Response, error) { + var err error req, err := client.updateCreateRequest(ctx, resourceGroupName, managedInstanceName, distributedAvailabilityGroupName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // updateCreateRequest creates the Update request. @@ -387,8 +479,11 @@ func (client *DistributedAvailabilityGroupsClient) updateCreateRequest(ctx conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } diff --git a/sdk/resourcemanager/sql/armsql/distributedavailabilitygroups_client_example_test.go b/sdk/resourcemanager/sql/armsql/distributedavailabilitygroups_client_example_test.go deleted file mode 100644 index 122d32bdaa3d..000000000000 --- a/sdk/resourcemanager/sql/armsql/distributedavailabilitygroups_client_example_test.go +++ /dev/null @@ -1,211 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsql_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sql/armsql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/DistributedAvailabilityGroupsListByInstance.json -func ExampleDistributedAvailabilityGroupsClient_NewListByInstancePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDistributedAvailabilityGroupsClient().NewListByInstancePager("testrg", "testcl", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DistributedAvailabilityGroupsListResult = armsql.DistributedAvailabilityGroupsListResult{ - // Value: []*armsql.DistributedAvailabilityGroup{ - // { - // Name: to.Ptr("dag"), - // Type: to.Ptr("Microsoft.Sql/managedInstances/distributedAvailabilityGroups"), - // ID: to.Ptr("/subscriptions/f2669dff-5f08-45dd-b857-b2a60b72cdc9/resourceGroups/testrg/providers/Microsoft.Sql/managedInstances/testcl/distributedAvailabilityGroups/dag"), - // Properties: &armsql.DistributedAvailabilityGroupProperties{ - // DistributedAvailabilityGroupID: to.Ptr("6bc05a51-aa36-a196-09bd-481d7a0973c0"), - // LastHardenedLsn: to.Ptr("39000000030400001"), - // LinkState: to.Ptr("Catchup"), - // ReplicationMode: to.Ptr(armsql.ReplicationModeAsync), - // SourceEndpoint: to.Ptr("TCP://SERVER:7022"), - // SourceReplicaID: to.Ptr("543dd519-7585-faff-6ad2-11fb826d4f4d"), - // TargetDatabase: to.Ptr("testdb"), - // TargetReplicaID: to.Ptr("7e218aba-0a53-6231-be09-895d99f96bf2"), - // }, - // }, - // { - // Name: to.Ptr("dag2"), - // Type: to.Ptr("Microsoft.Sql/managedInstances/distributedAvailabilityGroups"), - // ID: to.Ptr("/subscriptions/f2669dff-5f08-45dd-b857-b2a60b72cdc9/resourceGroups/testrg/providers/Microsoft.Sql/managedInstances/testcl/distributedAvailabilityGroups/dag2"), - // Properties: &armsql.DistributedAvailabilityGroupProperties{ - // DistributedAvailabilityGroupID: to.Ptr("7ec05a51-aa36-a196-09bd-481d7a0973c0"), - // LastHardenedLsn: to.Ptr("39000000030400001"), - // LinkState: to.Ptr("Catchup"), - // ReplicationMode: to.Ptr(armsql.ReplicationModeAsync), - // SourceEndpoint: to.Ptr("TCP://SERVER:7022"), - // SourceReplicaID: to.Ptr("d423d519-7585-faff-6ad2-11fb826d4f4d"), - // TargetDatabase: to.Ptr("testdb2"), - // TargetReplicaID: to.Ptr("32578aba-0a53-6231-be09-895d99f96bf2"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/DistributedAvailabilityGroupsGet.json -func ExampleDistributedAvailabilityGroupsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDistributedAvailabilityGroupsClient().Get(ctx, "testrg", "testcl", "dag", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DistributedAvailabilityGroup = armsql.DistributedAvailabilityGroup{ - // Name: to.Ptr("dag"), - // Type: to.Ptr("Microsoft.Sql/managedInstances/distributedAvailabilityGroups"), - // ID: to.Ptr("/subscriptions/f2669dff-5f08-45dd-b857-b2a60b72cdc9/resourceGroups/testrg/providers/Microsoft.Sql/managedInstances/testcl/distributedAvailabilityGroups/dag"), - // Properties: &armsql.DistributedAvailabilityGroupProperties{ - // DistributedAvailabilityGroupID: to.Ptr("6bc05a51-aa36-a196-09bd-481d7a0973c0"), - // LastHardenedLsn: to.Ptr("39000000030400001"), - // LinkState: to.Ptr("Catchup"), - // ReplicationMode: to.Ptr(armsql.ReplicationModeAsync), - // SourceEndpoint: to.Ptr("TCP://SERVER:7022"), - // SourceReplicaID: to.Ptr("543dd519-7585-faff-6ad2-11fb826d4f4d"), - // TargetDatabase: to.Ptr("testdb"), - // TargetReplicaID: to.Ptr("7e218aba-0a53-6231-be09-895d99f96bf2"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/DistributedAvailabilityGroupsCreate.json -func ExampleDistributedAvailabilityGroupsClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDistributedAvailabilityGroupsClient().BeginCreateOrUpdate(ctx, "testrg", "testcl", "dag", armsql.DistributedAvailabilityGroup{ - Properties: &armsql.DistributedAvailabilityGroupProperties{ - PrimaryAvailabilityGroupName: to.Ptr("BoxLocalAg1"), - SecondaryAvailabilityGroupName: to.Ptr("testcl"), - SourceEndpoint: to.Ptr("TCP://SERVER:7022"), - TargetDatabase: to.Ptr("testdb"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DistributedAvailabilityGroup = armsql.DistributedAvailabilityGroup{ - // Name: to.Ptr("dag"), - // Type: to.Ptr("Microsoft.Sql/managedInstances/distributedAvailabilityGroups"), - // ID: to.Ptr("/subscriptions/f2669dff-5f08-45dd-b857-b2a60b72cdc9/resourceGroups/testrg/providers/Microsoft.Sql/managedInstances/testcl/distributedAvailabilityGroups/dag"), - // Properties: &armsql.DistributedAvailabilityGroupProperties{ - // PrimaryAvailabilityGroupName: to.Ptr("BoxLocalAg1"), - // SecondaryAvailabilityGroupName: to.Ptr("testcl"), - // SourceEndpoint: to.Ptr("TCP://SERVER:7022"), - // TargetDatabase: to.Ptr("testdb"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/DistributedAvailabilityGroupsDelete.json -func ExampleDistributedAvailabilityGroupsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDistributedAvailabilityGroupsClient().BeginDelete(ctx, "testrg", "testcl", "dag", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/DistributedAvailabilityGroupsUpdate.json -func ExampleDistributedAvailabilityGroupsClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDistributedAvailabilityGroupsClient().BeginUpdate(ctx, "testrg", "testcl", "dag", armsql.DistributedAvailabilityGroup{ - Properties: &armsql.DistributedAvailabilityGroupProperties{ - ReplicationMode: to.Ptr(armsql.ReplicationModeSync), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DistributedAvailabilityGroup = armsql.DistributedAvailabilityGroup{ - // Name: to.Ptr("dag"), - // Type: to.Ptr("Microsoft.Sql/managedInstances/distributedAvailabilityGroups"), - // ID: to.Ptr("/subscriptions/f2669dff-5f08-45dd-b857-b2a60b72cdc9/resourceGroups/testrg/providers/Microsoft.Sql/managedInstances/testcl/distributedAvailabilityGroups/dag"), - // Properties: &armsql.DistributedAvailabilityGroupProperties{ - // ReplicationMode: to.Ptr(armsql.ReplicationModeSync), - // }, - // } -} diff --git a/sdk/resourcemanager/sql/armsql/elasticpoolactivities_client.go b/sdk/resourcemanager/sql/armsql/elasticpoolactivities_client.go deleted file mode 100644 index 8089bece09da..000000000000 --- a/sdk/resourcemanager/sql/armsql/elasticpoolactivities_client.go +++ /dev/null @@ -1,115 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsql - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "net/url" - "strings" -) - -// ElasticPoolActivitiesClient contains the methods for the ElasticPoolActivities group. -// Don't use this type directly, use NewElasticPoolActivitiesClient() instead. -type ElasticPoolActivitiesClient struct { - internal *arm.Client - subscriptionID string -} - -// NewElasticPoolActivitiesClient creates a new instance of ElasticPoolActivitiesClient with the specified values. -// - subscriptionID - The subscription ID that identifies an Azure subscription. -// - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. -func NewElasticPoolActivitiesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ElasticPoolActivitiesClient, error) { - cl, err := arm.NewClient(moduleName+".ElasticPoolActivitiesClient", moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &ElasticPoolActivitiesClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// NewListByElasticPoolPager - Returns elastic pool activities. -// -// Generated from API version 2014-04-01 -// - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure -// Resource Manager API or the portal. -// - serverName - The name of the server. -// - elasticPoolName - The name of the elastic pool for which to get the current activity. -// - options - ElasticPoolActivitiesClientListByElasticPoolOptions contains the optional parameters for the ElasticPoolActivitiesClient.NewListByElasticPoolPager -// method. -func (client *ElasticPoolActivitiesClient) NewListByElasticPoolPager(resourceGroupName string, serverName string, elasticPoolName string, options *ElasticPoolActivitiesClientListByElasticPoolOptions) *runtime.Pager[ElasticPoolActivitiesClientListByElasticPoolResponse] { - return runtime.NewPager(runtime.PagingHandler[ElasticPoolActivitiesClientListByElasticPoolResponse]{ - More: func(page ElasticPoolActivitiesClientListByElasticPoolResponse) bool { - return false - }, - Fetcher: func(ctx context.Context, page *ElasticPoolActivitiesClientListByElasticPoolResponse) (ElasticPoolActivitiesClientListByElasticPoolResponse, error) { - req, err := client.listByElasticPoolCreateRequest(ctx, resourceGroupName, serverName, elasticPoolName, options) - if err != nil { - return ElasticPoolActivitiesClientListByElasticPoolResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ElasticPoolActivitiesClientListByElasticPoolResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ElasticPoolActivitiesClientListByElasticPoolResponse{}, runtime.NewResponseError(resp) - } - return client.listByElasticPoolHandleResponse(resp) - }, - }) -} - -// listByElasticPoolCreateRequest creates the ListByElasticPool request. -func (client *ElasticPoolActivitiesClient) listByElasticPoolCreateRequest(ctx context.Context, resourceGroupName string, serverName string, elasticPoolName string, options *ElasticPoolActivitiesClientListByElasticPoolOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}/elasticPoolActivity" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if serverName == "" { - return nil, errors.New("parameter serverName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{serverName}", url.PathEscape(serverName)) - if elasticPoolName == "" { - return nil, errors.New("parameter elasticPoolName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{elasticPoolName}", url.PathEscape(elasticPoolName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2014-04-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listByElasticPoolHandleResponse handles the ListByElasticPool response. -func (client *ElasticPoolActivitiesClient) listByElasticPoolHandleResponse(resp *http.Response) (ElasticPoolActivitiesClientListByElasticPoolResponse, error) { - result := ElasticPoolActivitiesClientListByElasticPoolResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.ElasticPoolActivityListResult); err != nil { - return ElasticPoolActivitiesClientListByElasticPoolResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/sql/armsql/elasticpoolactivities_client_example_test.go b/sdk/resourcemanager/sql/armsql/elasticpoolactivities_client_example_test.go deleted file mode 100644 index f5520523a12f..000000000000 --- a/sdk/resourcemanager/sql/armsql/elasticpoolactivities_client_example_test.go +++ /dev/null @@ -1,67 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsql_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sql/armsql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/stable/2014-04-01-legacy/examples/ElasticPoolActivityList.json -func ExampleElasticPoolActivitiesClient_NewListByElasticPoolPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewElasticPoolActivitiesClient().NewListByElasticPoolPager("sqlcrudtest-4291", "sqlcrudtest-6574", "8749", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ElasticPoolActivityListResult = armsql.ElasticPoolActivityListResult{ - // Value: []*armsql.ElasticPoolActivity{ - // { - // Name: to.Ptr("851f1672-f7f0-46f6-a262-ee9b51e18e97"), - // Type: to.Ptr("Microsoft.Sql/servers/elasticPools/elasticPoolActivity"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/sqlcrudtest-4291/providers/Microsoft.Sql/servers/sqlcrudtest-6574/elasticPools/8749/elasticPoolActivity/851f1672-f7f0-46f6-a262-ee9b51e18e97"), - // Location: to.Ptr("Japan East"), - // Properties: &armsql.ElasticPoolActivityProperties{ - // OperationID: to.Ptr("851f1672-f7f0-46f6-a262-ee9b51e18e97"), - // ElasticPoolName: to.Ptr("8749"), - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-02-10T02:03:23.263Z"); return t}()), - // Operation: to.Ptr("CREATE"), - // PercentComplete: to.Ptr[int32](100), - // RequestedDatabaseDtuCap: to.Ptr[int32](5), - // RequestedDatabaseDtuGuarantee: to.Ptr[int32](0), - // RequestedDtuGuarantee: to.Ptr[int32](100), - // RequestedStorageLimitInGB: to.Ptr[int64](9), - // RequestedStorageLimitInMB: to.Ptr[int32](10000), - // ServerName: to.Ptr("sqlcrudtest-6574"), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-02-10T02:03:06.16Z"); return t}()), - // State: to.Ptr("COMPLETED"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/sql/armsql/elasticpooldatabaseactivities_client.go b/sdk/resourcemanager/sql/armsql/elasticpooldatabaseactivities_client.go deleted file mode 100644 index 0d9dd3ba2ead..000000000000 --- a/sdk/resourcemanager/sql/armsql/elasticpooldatabaseactivities_client.go +++ /dev/null @@ -1,115 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsql - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "net/url" - "strings" -) - -// ElasticPoolDatabaseActivitiesClient contains the methods for the ElasticPoolDatabaseActivities group. -// Don't use this type directly, use NewElasticPoolDatabaseActivitiesClient() instead. -type ElasticPoolDatabaseActivitiesClient struct { - internal *arm.Client - subscriptionID string -} - -// NewElasticPoolDatabaseActivitiesClient creates a new instance of ElasticPoolDatabaseActivitiesClient with the specified values. -// - subscriptionID - The subscription ID that identifies an Azure subscription. -// - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. -func NewElasticPoolDatabaseActivitiesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ElasticPoolDatabaseActivitiesClient, error) { - cl, err := arm.NewClient(moduleName+".ElasticPoolDatabaseActivitiesClient", moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &ElasticPoolDatabaseActivitiesClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// NewListByElasticPoolPager - Returns activity on databases inside of an elastic pool. -// -// Generated from API version 2014-04-01 -// - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure -// Resource Manager API or the portal. -// - serverName - The name of the server. -// - elasticPoolName - The name of the elastic pool. -// - options - ElasticPoolDatabaseActivitiesClientListByElasticPoolOptions contains the optional parameters for the ElasticPoolDatabaseActivitiesClient.NewListByElasticPoolPager -// method. -func (client *ElasticPoolDatabaseActivitiesClient) NewListByElasticPoolPager(resourceGroupName string, serverName string, elasticPoolName string, options *ElasticPoolDatabaseActivitiesClientListByElasticPoolOptions) *runtime.Pager[ElasticPoolDatabaseActivitiesClientListByElasticPoolResponse] { - return runtime.NewPager(runtime.PagingHandler[ElasticPoolDatabaseActivitiesClientListByElasticPoolResponse]{ - More: func(page ElasticPoolDatabaseActivitiesClientListByElasticPoolResponse) bool { - return false - }, - Fetcher: func(ctx context.Context, page *ElasticPoolDatabaseActivitiesClientListByElasticPoolResponse) (ElasticPoolDatabaseActivitiesClientListByElasticPoolResponse, error) { - req, err := client.listByElasticPoolCreateRequest(ctx, resourceGroupName, serverName, elasticPoolName, options) - if err != nil { - return ElasticPoolDatabaseActivitiesClientListByElasticPoolResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ElasticPoolDatabaseActivitiesClientListByElasticPoolResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ElasticPoolDatabaseActivitiesClientListByElasticPoolResponse{}, runtime.NewResponseError(resp) - } - return client.listByElasticPoolHandleResponse(resp) - }, - }) -} - -// listByElasticPoolCreateRequest creates the ListByElasticPool request. -func (client *ElasticPoolDatabaseActivitiesClient) listByElasticPoolCreateRequest(ctx context.Context, resourceGroupName string, serverName string, elasticPoolName string, options *ElasticPoolDatabaseActivitiesClientListByElasticPoolOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}/elasticPoolDatabaseActivity" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if serverName == "" { - return nil, errors.New("parameter serverName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{serverName}", url.PathEscape(serverName)) - if elasticPoolName == "" { - return nil, errors.New("parameter elasticPoolName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{elasticPoolName}", url.PathEscape(elasticPoolName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2014-04-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listByElasticPoolHandleResponse handles the ListByElasticPool response. -func (client *ElasticPoolDatabaseActivitiesClient) listByElasticPoolHandleResponse(resp *http.Response) (ElasticPoolDatabaseActivitiesClientListByElasticPoolResponse, error) { - result := ElasticPoolDatabaseActivitiesClientListByElasticPoolResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.ElasticPoolDatabaseActivityListResult); err != nil { - return ElasticPoolDatabaseActivitiesClientListByElasticPoolResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/sql/armsql/elasticpooldatabaseactivities_client_example_test.go b/sdk/resourcemanager/sql/armsql/elasticpooldatabaseactivities_client_example_test.go deleted file mode 100644 index 18c7fae9fdc4..000000000000 --- a/sdk/resourcemanager/sql/armsql/elasticpooldatabaseactivities_client_example_test.go +++ /dev/null @@ -1,82 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsql_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sql/armsql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/stable/2014-04-01-legacy/examples/ElasticPoolDatabaseActivityList.json -func ExampleElasticPoolDatabaseActivitiesClient_NewListByElasticPoolPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewElasticPoolDatabaseActivitiesClient().NewListByElasticPoolPager("sqlcrudtest-4673", "sqlcrudtest-603", "7537", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ElasticPoolDatabaseActivityListResult = armsql.ElasticPoolDatabaseActivityListResult{ - // Value: []*armsql.ElasticPoolDatabaseActivity{ - // { - // Name: to.Ptr("3a3272b3-f1fe-423c-9feb-7b843157eda5"), - // Type: to.Ptr("Microsoft.Sql/servers/elasticPools/elasticPoolDatabaseActivity"), - // ID: to.Ptr("/subscriptions/9d4e2ad0-e20b-4464-9219-353bded52513/resourceGroups/sqlcrudtest-4673/providers/Microsoft.Sql/servers/sqlcrudtest-603/elasticPools/7537/elasticPoolDatabaseActivity/3a3272b3-f1fe-423c-9feb-7b843157eda5"), - // Location: to.Ptr("Japan East"), - // Properties: &armsql.ElasticPoolDatabaseActivityProperties{ - // OperationID: to.Ptr("3a3272b3-f1fe-423c-9feb-7b843157eda5"), - // CurrentElasticPoolName: to.Ptr("7537"), - // CurrentServiceObjective: to.Ptr("ElasticPool"), - // DatabaseName: to.Ptr("2396"), - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2016-10-23T03:08:02.95Z"); return t}()), - // Operation: to.Ptr("UPDATE"), - // PercentComplete: to.Ptr[int32](100), - // ServerName: to.Ptr("sqlcrudtest-603"), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2016-10-23T03:07:12.57Z"); return t}()), - // State: to.Ptr("COMPLETED"), - // }, - // }, - // { - // Name: to.Ptr("95108a78-384e-48d3-b4de-7bf23b93a26d"), - // Type: to.Ptr("Microsoft.Sql/servers/elasticPools/elasticPoolDatabaseActivity"), - // ID: to.Ptr("/subscriptions/9d4e2ad0-e20b-4464-9219-353bded52513/resourceGroups/sqlcrudtest-4673/providers/Microsoft.Sql/servers/sqlcrudtest-603/elasticPools/7537/elasticPoolDatabaseActivity/95108a78-384e-48d3-b4de-7bf23b93a26d"), - // Location: to.Ptr("Japan East"), - // Properties: &armsql.ElasticPoolDatabaseActivityProperties{ - // OperationID: to.Ptr("95108a78-384e-48d3-b4de-7bf23b93a26d"), - // CurrentElasticPoolName: to.Ptr("7537"), - // CurrentServiceObjective: to.Ptr("ElasticPool"), - // DatabaseName: to.Ptr("2396"), - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2016-10-23T03:06:49.19Z"); return t}()), - // Operation: to.Ptr("CREATE"), - // PercentComplete: to.Ptr[int32](100), - // ServerName: to.Ptr("sqlcrudtest-603"), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2016-10-23T03:06:11.19Z"); return t}()), - // State: to.Ptr("COMPLETED"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/sql/armsql/elasticpooloperations_client.go b/sdk/resourcemanager/sql/armsql/elasticpooloperations_client.go index b54ad0d09ea4..bd46638e196e 100644 --- a/sdk/resourcemanager/sql/armsql/elasticpooloperations_client.go +++ b/sdk/resourcemanager/sql/armsql/elasticpooloperations_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armsql @@ -47,7 +46,7 @@ func NewElasticPoolOperationsClient(subscriptionID string, credential azcore.Tok // Cancel - Cancels the asynchronous operation on the elastic pool. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -55,16 +54,18 @@ func NewElasticPoolOperationsClient(subscriptionID string, credential azcore.Tok // - options - ElasticPoolOperationsClientCancelOptions contains the optional parameters for the ElasticPoolOperationsClient.Cancel // method. func (client *ElasticPoolOperationsClient) Cancel(ctx context.Context, resourceGroupName string, serverName string, elasticPoolName string, operationID string, options *ElasticPoolOperationsClientCancelOptions) (ElasticPoolOperationsClientCancelResponse, error) { + var err error req, err := client.cancelCreateRequest(ctx, resourceGroupName, serverName, elasticPoolName, operationID, options) if err != nil { return ElasticPoolOperationsClientCancelResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ElasticPoolOperationsClientCancelResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ElasticPoolOperationsClientCancelResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ElasticPoolOperationsClientCancelResponse{}, err } return ElasticPoolOperationsClientCancelResponse{}, nil } @@ -94,14 +95,14 @@ func (client *ElasticPoolOperationsClient) cancelCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } // NewListByElasticPoolPager - Gets a list of operations performed on the elastic pool. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -159,7 +160,7 @@ func (client *ElasticPoolOperationsClient) listByElasticPoolCreateRequest(ctx co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/sql/armsql/elasticpooloperations_client_example_test.go b/sdk/resourcemanager/sql/armsql/elasticpooloperations_client_example_test.go deleted file mode 100644 index c9de302b8473..000000000000 --- a/sdk/resourcemanager/sql/armsql/elasticpooloperations_client_example_test.go +++ /dev/null @@ -1,91 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsql_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sql/armsql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/CancelElasticPoolOperation.json -func ExampleElasticPoolOperationsClient_Cancel() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewElasticPoolOperationsClient().Cancel(ctx, "sqlcrudtest-7398", "sqlcrudtest-6661", "testpool", "f779414b-e748-4925-8cfe-c8598f7660ae", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ListElasticPoolOperations.json -func ExampleElasticPoolOperationsClient_NewListByElasticPoolPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewElasticPoolOperationsClient().NewListByElasticPoolPager("sqlcrudtestgroup", "sqlcrudtestserver", "testpool", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ElasticPoolOperationListResult = armsql.ElasticPoolOperationListResult{ - // Value: []*armsql.ElasticPoolOperation{ - // { - // Name: to.Ptr("11111111-1111-1111-1111-111111111111"), - // Type: to.Ptr("Microsoft.Sql/servers/elasticPools/operations"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/sqlcrudtestgroup/providers/Microsoft.Sql/servers/sqlcrudtestserver/elasticPools/testpool/operations/11111111-1111-1111-1111-111111111111"), - // Properties: &armsql.ElasticPoolOperationProperties{ - // ElasticPoolName: to.Ptr("testpool"), - // Operation: to.Ptr("UPDATE"), - // OperationFriendlyName: to.Ptr("UPDATE"), - // PercentComplete: to.Ptr[int32](100), - // ServerName: to.Ptr("sqlcrudtestserver"), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-10-30T09:10:08.1Z"); return t}()), - // State: to.Ptr("COMPLETED"), - // }, - // }, - // { - // Name: to.Ptr("55555555-5555-5555-5555-555555555555"), - // Type: to.Ptr("Microsoft.Sql/servers/elasticPools/operations"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/sqlcrudtestgroup/providers/Microsoft.Sql/servers/sqlcrudtestserver/elasticPools/testpool/operations/55555555-5555-5555-5555-555555555555"), - // Properties: &armsql.ElasticPoolOperationProperties{ - // ElasticPoolName: to.Ptr("testpool"), - // Operation: to.Ptr("UPDATE"), - // OperationFriendlyName: to.Ptr("UPDATE"), - // PercentComplete: to.Ptr[int32](0), - // ServerName: to.Ptr("sqlcrudtestserver"), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-10-30T10:10:08.1Z"); return t}()), - // State: to.Ptr("IN_PROGRESS"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/sql/armsql/elasticpools_client.go b/sdk/resourcemanager/sql/armsql/elasticpools_client.go index 498c050a70b5..bf0dac3944e2 100644 --- a/sdk/resourcemanager/sql/armsql/elasticpools_client.go +++ b/sdk/resourcemanager/sql/armsql/elasticpools_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armsql @@ -48,7 +47,7 @@ func NewElasticPoolsClient(subscriptionID string, credential azcore.TokenCredent // BeginCreateOrUpdate - Creates or updates an elastic pool. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -62,7 +61,10 @@ func (client *ElasticPoolsClient) BeginCreateOrUpdate(ctx context.Context, resou if err != nil { return nil, err } - return runtime.NewPoller[ElasticPoolsClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ElasticPoolsClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + return poller, err } else { return runtime.NewPollerFromResumeToken[ElasticPoolsClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -71,20 +73,22 @@ func (client *ElasticPoolsClient) BeginCreateOrUpdate(ctx context.Context, resou // CreateOrUpdate - Creates or updates an elastic pool. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01-preview +// Generated from API version 2022-11-01-preview func (client *ElasticPoolsClient) createOrUpdate(ctx context.Context, resourceGroupName string, serverName string, elasticPoolName string, parameters ElasticPool, options *ElasticPoolsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, serverName, elasticPoolName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createOrUpdateCreateRequest creates the CreateOrUpdate request. @@ -111,16 +115,19 @@ func (client *ElasticPoolsClient) createOrUpdateCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // BeginDelete - Deletes an elastic pool. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -133,7 +140,10 @@ func (client *ElasticPoolsClient) BeginDelete(ctx context.Context, resourceGroup if err != nil { return nil, err } - return runtime.NewPoller[ElasticPoolsClientDeleteResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ElasticPoolsClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err } else { return runtime.NewPollerFromResumeToken[ElasticPoolsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -142,20 +152,22 @@ func (client *ElasticPoolsClient) BeginDelete(ctx context.Context, resourceGroup // Delete - Deletes an elastic pool. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01-preview +// Generated from API version 2022-11-01-preview func (client *ElasticPoolsClient) deleteOperation(ctx context.Context, resourceGroupName string, serverName string, elasticPoolName string, options *ElasticPoolsClientBeginDeleteOptions) (*http.Response, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, serverName, elasticPoolName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteCreateRequest creates the Delete request. @@ -182,7 +194,7 @@ func (client *ElasticPoolsClient) deleteCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -190,7 +202,7 @@ func (client *ElasticPoolsClient) deleteCreateRequest(ctx context.Context, resou // BeginFailover - Failovers an elastic pool. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -203,7 +215,8 @@ func (client *ElasticPoolsClient) BeginFailover(ctx context.Context, resourceGro if err != nil { return nil, err } - return runtime.NewPoller[ElasticPoolsClientFailoverResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[ElasticPoolsClientFailoverResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[ElasticPoolsClientFailoverResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -212,20 +225,22 @@ func (client *ElasticPoolsClient) BeginFailover(ctx context.Context, resourceGro // Failover - Failovers an elastic pool. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01-preview +// Generated from API version 2022-11-01-preview func (client *ElasticPoolsClient) failover(ctx context.Context, resourceGroupName string, serverName string, elasticPoolName string, options *ElasticPoolsClientBeginFailoverOptions) (*http.Response, error) { + var err error req, err := client.failoverCreateRequest(ctx, resourceGroupName, serverName, elasticPoolName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // failoverCreateRequest creates the Failover request. @@ -252,7 +267,7 @@ func (client *ElasticPoolsClient) failoverCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -260,25 +275,28 @@ func (client *ElasticPoolsClient) failoverCreateRequest(ctx context.Context, res // Get - Gets an elastic pool. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. // - elasticPoolName - The name of the elastic pool. // - options - ElasticPoolsClientGetOptions contains the optional parameters for the ElasticPoolsClient.Get method. func (client *ElasticPoolsClient) Get(ctx context.Context, resourceGroupName string, serverName string, elasticPoolName string, options *ElasticPoolsClientGetOptions) (ElasticPoolsClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, serverName, elasticPoolName, options) if err != nil { return ElasticPoolsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ElasticPoolsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ElasticPoolsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ElasticPoolsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -305,7 +323,7 @@ func (client *ElasticPoolsClient) getCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -322,7 +340,7 @@ func (client *ElasticPoolsClient) getHandleResponse(resp *http.Response) (Elasti // NewListByServerPager - Gets all elastic pools in a server. // -// Generated from API version 2021-08-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -379,7 +397,7 @@ func (client *ElasticPoolsClient) listByServerCreateRequest(ctx context.Context, if options != nil && options.Skip != nil { reqQP.Set("$skip", strconv.FormatInt(*options.Skip, 10)) } - reqQP.Set("api-version", "2021-08-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -394,152 +412,10 @@ func (client *ElasticPoolsClient) listByServerHandleResponse(resp *http.Response return result, nil } -// NewListMetricDefinitionsPager - Returns elastic pool metric definitions. -// -// Generated from API version 2014-04-01 -// - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure -// Resource Manager API or the portal. -// - serverName - The name of the server. -// - elasticPoolName - The name of the elastic pool. -// - options - ElasticPoolsClientListMetricDefinitionsOptions contains the optional parameters for the ElasticPoolsClient.NewListMetricDefinitionsPager -// method. -func (client *ElasticPoolsClient) NewListMetricDefinitionsPager(resourceGroupName string, serverName string, elasticPoolName string, options *ElasticPoolsClientListMetricDefinitionsOptions) *runtime.Pager[ElasticPoolsClientListMetricDefinitionsResponse] { - return runtime.NewPager(runtime.PagingHandler[ElasticPoolsClientListMetricDefinitionsResponse]{ - More: func(page ElasticPoolsClientListMetricDefinitionsResponse) bool { - return false - }, - Fetcher: func(ctx context.Context, page *ElasticPoolsClientListMetricDefinitionsResponse) (ElasticPoolsClientListMetricDefinitionsResponse, error) { - req, err := client.listMetricDefinitionsCreateRequest(ctx, resourceGroupName, serverName, elasticPoolName, options) - if err != nil { - return ElasticPoolsClientListMetricDefinitionsResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ElasticPoolsClientListMetricDefinitionsResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ElasticPoolsClientListMetricDefinitionsResponse{}, runtime.NewResponseError(resp) - } - return client.listMetricDefinitionsHandleResponse(resp) - }, - }) -} - -// listMetricDefinitionsCreateRequest creates the ListMetricDefinitions request. -func (client *ElasticPoolsClient) listMetricDefinitionsCreateRequest(ctx context.Context, resourceGroupName string, serverName string, elasticPoolName string, options *ElasticPoolsClientListMetricDefinitionsOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}/metricDefinitions" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if serverName == "" { - return nil, errors.New("parameter serverName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{serverName}", url.PathEscape(serverName)) - if elasticPoolName == "" { - return nil, errors.New("parameter elasticPoolName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{elasticPoolName}", url.PathEscape(elasticPoolName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2014-04-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listMetricDefinitionsHandleResponse handles the ListMetricDefinitions response. -func (client *ElasticPoolsClient) listMetricDefinitionsHandleResponse(resp *http.Response) (ElasticPoolsClientListMetricDefinitionsResponse, error) { - result := ElasticPoolsClientListMetricDefinitionsResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.MetricDefinitionListResult); err != nil { - return ElasticPoolsClientListMetricDefinitionsResponse{}, err - } - return result, nil -} - -// NewListMetricsPager - Returns elastic pool metrics. -// -// Generated from API version 2014-04-01 -// - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure -// Resource Manager API or the portal. -// - serverName - The name of the server. -// - elasticPoolName - The name of the elastic pool. -// - filter - An OData filter expression that describes a subset of metrics to return. -// - options - ElasticPoolsClientListMetricsOptions contains the optional parameters for the ElasticPoolsClient.NewListMetricsPager -// method. -func (client *ElasticPoolsClient) NewListMetricsPager(resourceGroupName string, serverName string, elasticPoolName string, filter string, options *ElasticPoolsClientListMetricsOptions) *runtime.Pager[ElasticPoolsClientListMetricsResponse] { - return runtime.NewPager(runtime.PagingHandler[ElasticPoolsClientListMetricsResponse]{ - More: func(page ElasticPoolsClientListMetricsResponse) bool { - return false - }, - Fetcher: func(ctx context.Context, page *ElasticPoolsClientListMetricsResponse) (ElasticPoolsClientListMetricsResponse, error) { - req, err := client.listMetricsCreateRequest(ctx, resourceGroupName, serverName, elasticPoolName, filter, options) - if err != nil { - return ElasticPoolsClientListMetricsResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ElasticPoolsClientListMetricsResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ElasticPoolsClientListMetricsResponse{}, runtime.NewResponseError(resp) - } - return client.listMetricsHandleResponse(resp) - }, - }) -} - -// listMetricsCreateRequest creates the ListMetrics request. -func (client *ElasticPoolsClient) listMetricsCreateRequest(ctx context.Context, resourceGroupName string, serverName string, elasticPoolName string, filter string, options *ElasticPoolsClientListMetricsOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}/metrics" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if serverName == "" { - return nil, errors.New("parameter serverName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{serverName}", url.PathEscape(serverName)) - if elasticPoolName == "" { - return nil, errors.New("parameter elasticPoolName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{elasticPoolName}", url.PathEscape(elasticPoolName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2014-04-01") - reqQP.Set("$filter", filter) - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listMetricsHandleResponse handles the ListMetrics response. -func (client *ElasticPoolsClient) listMetricsHandleResponse(resp *http.Response) (ElasticPoolsClientListMetricsResponse, error) { - result := ElasticPoolsClientListMetricsResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.MetricListResult); err != nil { - return ElasticPoolsClientListMetricsResponse{}, err - } - return result, nil -} - // BeginUpdate - Updates an elastic pool. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -553,7 +429,10 @@ func (client *ElasticPoolsClient) BeginUpdate(ctx context.Context, resourceGroup if err != nil { return nil, err } - return runtime.NewPoller[ElasticPoolsClientUpdateResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ElasticPoolsClientUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err } else { return runtime.NewPollerFromResumeToken[ElasticPoolsClientUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -562,20 +441,22 @@ func (client *ElasticPoolsClient) BeginUpdate(ctx context.Context, resourceGroup // Update - Updates an elastic pool. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-08-01-preview +// Generated from API version 2022-11-01-preview func (client *ElasticPoolsClient) update(ctx context.Context, resourceGroupName string, serverName string, elasticPoolName string, parameters ElasticPoolUpdate, options *ElasticPoolsClientBeginUpdateOptions) (*http.Response, error) { + var err error req, err := client.updateCreateRequest(ctx, resourceGroupName, serverName, elasticPoolName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // updateCreateRequest creates the Update request. @@ -602,8 +483,11 @@ func (client *ElasticPoolsClient) updateCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } diff --git a/sdk/resourcemanager/sql/armsql/elasticpools_client_example_test.go b/sdk/resourcemanager/sql/armsql/elasticpools_client_example_test.go deleted file mode 100644 index 46fe70a62978..000000000000 --- a/sdk/resourcemanager/sql/armsql/elasticpools_client_example_test.go +++ /dev/null @@ -1,1167 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsql_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sql/armsql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/stable/2014-04-01/examples/ElasticPoolMetricsListWithFilter.json -func ExampleElasticPoolsClient_NewListMetricsPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewElasticPoolsClient().NewListMetricsPager("sqlcrudtest-6730", "sqlcrudtest-9007", "3481", "name/value eq 'cpu_percent' and timeGrain eq '00:10:00' and startTime eq '2017-06-02T18:35:00Z' and endTime eq '2017-06-02T18:55:00Z'", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.MetricListResult = armsql.MetricListResult{ - // Value: []*armsql.Metric{ - // { - // Name: &armsql.MetricName{ - // LocalizedValue: to.Ptr("CPU percentage"), - // Value: to.Ptr("cpu_percent"), - // }, - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-06-02T18:55:00Z"); return t}()), - // MetricValues: []*armsql.MetricValue{ - // { - // Average: to.Ptr[float64](0), - // Count: to.Ptr[int32](1), - // Maximum: to.Ptr[float64](0), - // Minimum: to.Ptr[float64](0), - // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-06-02T18:30:01Z"); return t}()), - // Total: to.Ptr[float64](0), - // }, - // { - // Average: to.Ptr[float64](0), - // Count: to.Ptr[int32](1), - // Maximum: to.Ptr[float64](0), - // Minimum: to.Ptr[float64](0), - // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-06-02T18:40:01Z"); return t}()), - // Total: to.Ptr[float64](0), - // }, - // { - // Average: to.Ptr[float64](0), - // Count: to.Ptr[int32](1), - // Maximum: to.Ptr[float64](0), - // Minimum: to.Ptr[float64](0), - // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-06-02T18:50:01Z"); return t}()), - // Total: to.Ptr[float64](0), - // }}, - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-06-02T18:35:00Z"); return t}()), - // TimeGrain: to.Ptr("00:10:00"), - // Unit: to.Ptr(armsql.UnitTypePercent), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/stable/2014-04-01/examples/ElasticPoolMetricsDefinitionsList.json -func ExampleElasticPoolsClient_NewListMetricDefinitionsPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewElasticPoolsClient().NewListMetricDefinitionsPager("sqlcrudtest-6730", "sqlcrudtest-9007", "3481", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.MetricDefinitionListResult = armsql.MetricDefinitionListResult{ - // Value: []*armsql.MetricDefinition{ - // { - // Name: &armsql.MetricName{ - // LocalizedValue: to.Ptr("CPU percentage"), - // Value: to.Ptr("cpu_percent"), - // }, - // MetricAvailabilities: []*armsql.MetricAvailability{ - // { - // Retention: to.Ptr("PT1H"), - // TimeGrain: to.Ptr("PT15S"), - // }, - // { - // Retention: to.Ptr("PT1H"), - // TimeGrain: to.Ptr("PT60S"), - // }, - // { - // Retention: to.Ptr("P14D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P14D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P14D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // PrimaryAggregationType: to.Ptr(armsql.PrimaryAggregationTypeAverage), - // ResourceURI: to.Ptr("/subscriptions/b6a6e0c5-e79c-4c6d-a878-72eafbca4cf2/resourceGroups/QA/providers/Microsoft.Sql/servers/nafantest/databases/db1"), - // Unit: to.Ptr(armsql.UnitDefinitionTypePercent), - // }, - // { - // Name: &armsql.MetricName{ - // LocalizedValue: to.Ptr("Data IO percentage"), - // Value: to.Ptr("physical_data_read_percent"), - // }, - // MetricAvailabilities: []*armsql.MetricAvailability{ - // { - // Retention: to.Ptr("PT1H"), - // TimeGrain: to.Ptr("PT15S"), - // }, - // { - // Retention: to.Ptr("PT1H"), - // TimeGrain: to.Ptr("PT60S"), - // }, - // { - // Retention: to.Ptr("P14D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P14D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P14D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // PrimaryAggregationType: to.Ptr(armsql.PrimaryAggregationTypeAverage), - // ResourceURI: to.Ptr("/subscriptions/b6a6e0c5-e79c-4c6d-a878-72eafbca4cf2/resourceGroups/QA/providers/Microsoft.Sql/servers/nafantest/databases/db1"), - // Unit: to.Ptr(armsql.UnitDefinitionTypePercent), - // }, - // { - // Name: &armsql.MetricName{ - // LocalizedValue: to.Ptr("Log IO percentage"), - // Value: to.Ptr("log_write_percent"), - // }, - // MetricAvailabilities: []*armsql.MetricAvailability{ - // { - // Retention: to.Ptr("PT1H"), - // TimeGrain: to.Ptr("PT15S"), - // }, - // { - // Retention: to.Ptr("PT1H"), - // TimeGrain: to.Ptr("PT60S"), - // }, - // { - // Retention: to.Ptr("P14D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P14D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P14D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // PrimaryAggregationType: to.Ptr(armsql.PrimaryAggregationTypeAverage), - // ResourceURI: to.Ptr("/subscriptions/b6a6e0c5-e79c-4c6d-a878-72eafbca4cf2/resourceGroups/QA/providers/Microsoft.Sql/servers/nafantest/databases/db1"), - // Unit: to.Ptr(armsql.UnitDefinitionTypePercent), - // }, - // { - // Name: &armsql.MetricName{ - // LocalizedValue: to.Ptr("DTU percentage"), - // Value: to.Ptr("dtu_consumption_percent"), - // }, - // MetricAvailabilities: []*armsql.MetricAvailability{ - // { - // Retention: to.Ptr("PT1H"), - // TimeGrain: to.Ptr("PT15S"), - // }, - // { - // Retention: to.Ptr("PT1H"), - // TimeGrain: to.Ptr("PT60S"), - // }, - // { - // Retention: to.Ptr("P14D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P14D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P14D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // PrimaryAggregationType: to.Ptr(armsql.PrimaryAggregationTypeAverage), - // ResourceURI: to.Ptr("/subscriptions/b6a6e0c5-e79c-4c6d-a878-72eafbca4cf2/resourceGroups/QA/providers/Microsoft.Sql/servers/nafantest/databases/db1"), - // Unit: to.Ptr(armsql.UnitDefinitionTypePercent), - // }, - // { - // Name: &armsql.MetricName{ - // LocalizedValue: to.Ptr("Total database size"), - // Value: to.Ptr("storage"), - // }, - // MetricAvailabilities: []*armsql.MetricAvailability{ - // { - // Retention: to.Ptr("P14D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P14D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P14D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // PrimaryAggregationType: to.Ptr(armsql.PrimaryAggregationTypeMaximum), - // ResourceURI: to.Ptr("/subscriptions/b6a6e0c5-e79c-4c6d-a878-72eafbca4cf2/resourceGroups/QA/providers/Microsoft.Sql/servers/nafantest/databases/db1"), - // Unit: to.Ptr(armsql.UnitDefinitionTypeBytes), - // }, - // { - // Name: &armsql.MetricName{ - // LocalizedValue: to.Ptr("In-Memory OLTP storage percent"), - // Value: to.Ptr("xtp_storage_percent"), - // }, - // MetricAvailabilities: []*armsql.MetricAvailability{ - // { - // Retention: to.Ptr("PT1H"), - // TimeGrain: to.Ptr("PT15S"), - // }, - // { - // Retention: to.Ptr("PT1H"), - // TimeGrain: to.Ptr("PT60S"), - // }, - // { - // Retention: to.Ptr("P14D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P14D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P14D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // PrimaryAggregationType: to.Ptr(armsql.PrimaryAggregationTypeAverage), - // ResourceURI: to.Ptr("/subscriptions/b6a6e0c5-e79c-4c6d-a878-72eafbca4cf2/resourceGroups/QA/providers/Microsoft.Sql/servers/nafantest/databases/db1"), - // Unit: to.Ptr(armsql.UnitDefinitionTypePercent), - // }, - // { - // Name: &armsql.MetricName{ - // LocalizedValue: to.Ptr("Workers percentage"), - // Value: to.Ptr("workers_percent"), - // }, - // MetricAvailabilities: []*armsql.MetricAvailability{ - // { - // Retention: to.Ptr("P14D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P14D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P14D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // PrimaryAggregationType: to.Ptr(armsql.PrimaryAggregationTypeAverage), - // ResourceURI: to.Ptr("/subscriptions/b6a6e0c5-e79c-4c6d-a878-72eafbca4cf2/resourceGroups/QA/providers/Microsoft.Sql/servers/nafantest/databases/db1"), - // Unit: to.Ptr(armsql.UnitDefinitionTypePercent), - // }, - // { - // Name: &armsql.MetricName{ - // LocalizedValue: to.Ptr("Sessions percentage"), - // Value: to.Ptr("sessions_percent"), - // }, - // MetricAvailabilities: []*armsql.MetricAvailability{ - // { - // Retention: to.Ptr("P14D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P14D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P14D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // PrimaryAggregationType: to.Ptr(armsql.PrimaryAggregationTypeAverage), - // ResourceURI: to.Ptr("/subscriptions/b6a6e0c5-e79c-4c6d-a878-72eafbca4cf2/resourceGroups/QA/providers/Microsoft.Sql/servers/nafantest/databases/db1"), - // Unit: to.Ptr(armsql.UnitDefinitionTypePercent), - // }, - // { - // Name: &armsql.MetricName{ - // LocalizedValue: to.Ptr("DTU limit"), - // Value: to.Ptr("dtu_limit"), - // }, - // MetricAvailabilities: []*armsql.MetricAvailability{ - // { - // Retention: to.Ptr("P14D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P14D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P14D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // PrimaryAggregationType: to.Ptr(armsql.PrimaryAggregationTypeAverage), - // ResourceURI: to.Ptr("/subscriptions/b6a6e0c5-e79c-4c6d-a878-72eafbca4cf2/resourceGroups/QA/providers/Microsoft.Sql/servers/nafantest/databases/db1"), - // Unit: to.Ptr(armsql.UnitDefinitionTypeCount), - // }, - // { - // Name: &armsql.MetricName{ - // LocalizedValue: to.Ptr("DTU used"), - // Value: to.Ptr("dtu_used"), - // }, - // MetricAvailabilities: []*armsql.MetricAvailability{ - // { - // Retention: to.Ptr("P14D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P14D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P14D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // PrimaryAggregationType: to.Ptr(armsql.PrimaryAggregationTypeAverage), - // ResourceURI: to.Ptr("/subscriptions/b6a6e0c5-e79c-4c6d-a878-72eafbca4cf2/resourceGroups/QA/providers/Microsoft.Sql/servers/nafantest/databases/db1"), - // Unit: to.Ptr(armsql.UnitDefinitionTypeCount), - // }, - // { - // Name: &armsql.MetricName{ - // LocalizedValue: to.Ptr("Successful Connections"), - // Value: to.Ptr("connection_successful"), - // }, - // MetricAvailabilities: []*armsql.MetricAvailability{ - // { - // Retention: to.Ptr("P14D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P14D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P14D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // PrimaryAggregationType: to.Ptr(armsql.PrimaryAggregationTypeTotal), - // ResourceURI: to.Ptr("/subscriptions/b6a6e0c5-e79c-4c6d-a878-72eafbca4cf2/resourceGroups/QA/providers/Microsoft.Sql/servers/nafantest/databases/db1"), - // Unit: to.Ptr(armsql.UnitDefinitionTypeCount), - // }, - // { - // Name: &armsql.MetricName{ - // LocalizedValue: to.Ptr("Failed Connections"), - // Value: to.Ptr("connection_failed"), - // }, - // MetricAvailabilities: []*armsql.MetricAvailability{ - // { - // Retention: to.Ptr("P14D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P14D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P14D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // PrimaryAggregationType: to.Ptr(armsql.PrimaryAggregationTypeTotal), - // ResourceURI: to.Ptr("/subscriptions/b6a6e0c5-e79c-4c6d-a878-72eafbca4cf2/resourceGroups/QA/providers/Microsoft.Sql/servers/nafantest/databases/db1"), - // Unit: to.Ptr(armsql.UnitDefinitionTypeCount), - // }, - // { - // Name: &armsql.MetricName{ - // LocalizedValue: to.Ptr("Blocked by Firewall"), - // Value: to.Ptr("blocked_by_firewall"), - // }, - // MetricAvailabilities: []*armsql.MetricAvailability{ - // { - // Retention: to.Ptr("P14D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P14D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P14D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // PrimaryAggregationType: to.Ptr(armsql.PrimaryAggregationTypeTotal), - // ResourceURI: to.Ptr("/subscriptions/b6a6e0c5-e79c-4c6d-a878-72eafbca4cf2/resourceGroups/QA/providers/Microsoft.Sql/servers/nafantest/databases/db1"), - // Unit: to.Ptr(armsql.UnitDefinitionTypeCount), - // }, - // { - // Name: &armsql.MetricName{ - // LocalizedValue: to.Ptr("Deadlocks"), - // Value: to.Ptr("deadlock"), - // }, - // MetricAvailabilities: []*armsql.MetricAvailability{ - // { - // Retention: to.Ptr("P14D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P14D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P14D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // PrimaryAggregationType: to.Ptr(armsql.PrimaryAggregationTypeTotal), - // ResourceURI: to.Ptr("/subscriptions/b6a6e0c5-e79c-4c6d-a878-72eafbca4cf2/resourceGroups/QA/providers/Microsoft.Sql/servers/nafantest/databases/db1"), - // Unit: to.Ptr(armsql.UnitDefinitionTypeCount), - // }, - // { - // Name: &armsql.MetricName{ - // LocalizedValue: to.Ptr("Database size percentage"), - // Value: to.Ptr("storage_percent"), - // }, - // MetricAvailabilities: []*armsql.MetricAvailability{ - // { - // Retention: to.Ptr("P14D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P14D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P14D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // PrimaryAggregationType: to.Ptr(armsql.PrimaryAggregationTypeMaximum), - // ResourceURI: to.Ptr("/subscriptions/b6a6e0c5-e79c-4c6d-a878-72eafbca4cf2/resourceGroups/QA/providers/Microsoft.Sql/servers/nafantest/databases/db1"), - // Unit: to.Ptr(armsql.UnitDefinitionTypePercent), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-08-01-preview/examples/ElasticPoolListByServer.json -func ExampleElasticPoolsClient_NewListByServerPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewElasticPoolsClient().NewListByServerPager("sqlcrudtest-2369", "sqlcrudtest-8069", &armsql.ElasticPoolsClientListByServerOptions{Skip: nil}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ElasticPoolListResult = armsql.ElasticPoolListResult{ - // Value: []*armsql.ElasticPool{ - // { - // Name: to.Ptr("sqlcrudtest-2729"), - // Type: to.Ptr("Microsoft.Sql/servers/elasticPools"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/sqlcrudtest-2369/providers/Microsoft.Sql/servers/sqlcrudtest-8069/elasticPools/sqlcrudtest-2729"), - // Location: to.Ptr("Japan East"), - // Properties: &armsql.ElasticPoolProperties{ - // CreationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-02-10T01:27:21.32Z"); return t}()), - // LicenseType: to.Ptr(armsql.ElasticPoolLicenseTypeLicenseIncluded), - // MaxSizeBytes: to.Ptr[int64](5242880000), - // PerDatabaseSettings: &armsql.ElasticPoolPerDatabaseSettings{ - // MaxCapacity: to.Ptr[float64](1), - // MinCapacity: to.Ptr[float64](0.25), - // }, - // State: to.Ptr(armsql.ElasticPoolStateReady), - // ZoneRedundant: to.Ptr(true), - // }, - // SKU: &armsql.SKU{ - // Name: to.Ptr("GP_Gen4_2"), - // Capacity: to.Ptr[int32](2), - // Tier: to.Ptr("GeneralPurpose"), - // }, - // }, - // { - // Name: to.Ptr("sqlcrudtest-3191"), - // Type: to.Ptr("Microsoft.Sql/servers/elasticPools"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/sqlcrudtest-2369/providers/Microsoft.Sql/servers/sqlcrudtest-8069/elasticPools/sqlcrudtest-3191"), - // Location: to.Ptr("Japan East"), - // Properties: &armsql.ElasticPoolProperties{ - // CreationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-02-10T01:26:26.45Z"); return t}()), - // MaxSizeBytes: to.Ptr[int64](5242880000), - // PerDatabaseSettings: &armsql.ElasticPoolPerDatabaseSettings{ - // MaxCapacity: to.Ptr[float64](5), - // MinCapacity: to.Ptr[float64](0), - // }, - // State: to.Ptr(armsql.ElasticPoolStateReady), - // }, - // SKU: &armsql.SKU{ - // Name: to.Ptr("BasicPool"), - // Capacity: to.Ptr[int32](50), - // Tier: to.Ptr("Basic"), - // }, - // }, - // { - // Name: to.Ptr("sqlcrudtest-8102"), - // Type: to.Ptr("Microsoft.Sql/servers/elasticPools"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/sqlcrudtest-2369/providers/Microsoft.Sql/servers/sqlcrudtest-8069/elasticPools/sqlcrudtest-8102"), - // Location: to.Ptr("Japan East"), - // Properties: &armsql.ElasticPoolProperties{ - // CreationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-02-10T01:25:25.033Z"); return t}()), - // MaxSizeBytes: to.Ptr[int64](5242880000), - // PerDatabaseSettings: &armsql.ElasticPoolPerDatabaseSettings{ - // MaxCapacity: to.Ptr[float64](5), - // MinCapacity: to.Ptr[float64](0), - // }, - // State: to.Ptr(armsql.ElasticPoolStateReady), - // }, - // SKU: &armsql.SKU{ - // Name: to.Ptr("BasicPool"), - // Capacity: to.Ptr[int32](50), - // Tier: to.Ptr("Basic"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-08-01-preview/examples/HyperscaleElasticPoolGet.json -func ExampleElasticPoolsClient_Get_getAHyperscaleElasticPool() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewElasticPoolsClient().Get(ctx, "sqlcrudtest-2369", "sqlcrudtest-8069", "sqlcrudtest-8102", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ElasticPool = armsql.ElasticPool{ - // Name: to.Ptr("sqlcrudtest-8102"), - // Type: to.Ptr("Microsoft.Sql/servers/elasticPools"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/sqlcrudtest-2369/providers/Microsoft.Sql/servers/sqlcrudtest-8069/elasticPools/sqlcrudtest-8102"), - // Location: to.Ptr("Japan East"), - // Kind: to.Ptr("vcore,pool"), - // Properties: &armsql.ElasticPoolProperties{ - // CreationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-26T03:46:20.57Z"); return t}()), - // HighAvailabilityReplicaCount: to.Ptr[int32](2), - // LicenseType: to.Ptr(armsql.ElasticPoolLicenseTypeLicenseIncluded), - // MaintenanceConfigurationID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/providers/Microsoft.Maintenance/publicMaintenanceConfigurations/SQL_Default"), - // MaxSizeBytes: to.Ptr[int64](0), - // PerDatabaseSettings: &armsql.ElasticPoolPerDatabaseSettings{ - // MaxCapacity: to.Ptr[float64](4), - // MinCapacity: to.Ptr[float64](0), - // }, - // State: to.Ptr(armsql.ElasticPoolStateReady), - // ZoneRedundant: to.Ptr(false), - // }, - // SKU: &armsql.SKU{ - // Name: to.Ptr("HS_Gen5"), - // Capacity: to.Ptr[int32](4), - // Family: to.Ptr("Gen5"), - // Tier: to.Ptr("Hyperscale"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-08-01-preview/examples/ElasticPoolGet.json -func ExampleElasticPoolsClient_Get_getAnElasticPool() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewElasticPoolsClient().Get(ctx, "sqlcrudtest-2369", "sqlcrudtest-8069", "sqlcrudtest-8102", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ElasticPool = armsql.ElasticPool{ - // Name: to.Ptr("sqlcrudtest-8102"), - // Type: to.Ptr("Microsoft.Sql/servers/elasticPools"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/sqlcrudtest-2369/providers/Microsoft.Sql/servers/sqlcrudtest-8069/elasticPools/sqlcrudtest-8102"), - // Location: to.Ptr("Japan East"), - // Properties: &armsql.ElasticPoolProperties{ - // CreationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-10-10T01:25:25.033Z"); return t}()), - // LicenseType: to.Ptr(armsql.ElasticPoolLicenseTypeLicenseIncluded), - // MaintenanceConfigurationID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/providers/Microsoft.Maintenance/publicMaintenanceConfigurations/SQL_JapanEast_1"), - // MaxSizeBytes: to.Ptr[int64](5242880000), - // PerDatabaseSettings: &armsql.ElasticPoolPerDatabaseSettings{ - // MaxCapacity: to.Ptr[float64](1), - // MinCapacity: to.Ptr[float64](0.25), - // }, - // State: to.Ptr(armsql.ElasticPoolStateReady), - // ZoneRedundant: to.Ptr(true), - // }, - // SKU: &armsql.SKU{ - // Name: to.Ptr("GP_Gen5_2"), - // Capacity: to.Ptr[int32](2), - // Tier: to.Ptr("GeneralPurpose"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-08-01-preview/examples/HyperscaleElasticPoolCreateOrUpdateSetHighAvailabilityReplicaCount.json -func ExampleElasticPoolsClient_BeginCreateOrUpdate_createOrUpdateHyperscaleElasticPoolWithHighAvailabilityReplicaCountParameter() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewElasticPoolsClient().BeginCreateOrUpdate(ctx, "sqlcrudtest-2369", "sqlcrudtest-8069", "sqlcrudtest-8102", armsql.ElasticPool{ - Location: to.Ptr("Japan East"), - Properties: &armsql.ElasticPoolProperties{ - HighAvailabilityReplicaCount: to.Ptr[int32](2), - }, - SKU: &armsql.SKU{ - Name: to.Ptr("HS_Gen5_4"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ElasticPool = armsql.ElasticPool{ - // Name: to.Ptr("sqlcrudtest-8102"), - // Type: to.Ptr("Microsoft.Sql/servers/elasticPools"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/sqlcrudtest-2369/providers/Microsoft.Sql/servers/sqlcrudtest-8069/elasticPools/sqlcrudtest-8102"), - // Location: to.Ptr("Japan East"), - // Kind: to.Ptr("vcore,pool"), - // Properties: &armsql.ElasticPoolProperties{ - // CreationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-26T03:46:20.57Z"); return t}()), - // HighAvailabilityReplicaCount: to.Ptr[int32](2), - // LicenseType: to.Ptr(armsql.ElasticPoolLicenseTypeLicenseIncluded), - // MaintenanceConfigurationID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/providers/Microsoft.Maintenance/publicMaintenanceConfigurations/SQL_Default"), - // MaxSizeBytes: to.Ptr[int64](0), - // PerDatabaseSettings: &armsql.ElasticPoolPerDatabaseSettings{ - // MaxCapacity: to.Ptr[float64](4), - // MinCapacity: to.Ptr[float64](0), - // }, - // State: to.Ptr(armsql.ElasticPoolStateReady), - // ZoneRedundant: to.Ptr(false), - // }, - // SKU: &armsql.SKU{ - // Name: to.Ptr("HS_Gen5"), - // Capacity: to.Ptr[int32](4), - // Family: to.Ptr("Gen5"), - // Tier: to.Ptr("Hyperscale"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-08-01-preview/examples/ElasticPoolCreateOrUpdateMax.json -func ExampleElasticPoolsClient_BeginCreateOrUpdate_createOrUpdateElasticPoolWithAllParameter() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewElasticPoolsClient().BeginCreateOrUpdate(ctx, "sqlcrudtest-2369", "sqlcrudtest-8069", "sqlcrudtest-8102", armsql.ElasticPool{ - Location: to.Ptr("Japan East"), - Properties: &armsql.ElasticPoolProperties{ - PerDatabaseSettings: &armsql.ElasticPoolPerDatabaseSettings{ - MaxCapacity: to.Ptr[float64](2), - MinCapacity: to.Ptr[float64](0.25), - }, - }, - SKU: &armsql.SKU{ - Name: to.Ptr("GP_Gen4_2"), - Capacity: to.Ptr[int32](2), - Tier: to.Ptr("GeneralPurpose"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ElasticPool = armsql.ElasticPool{ - // Name: to.Ptr("sqlcrudtest-8102"), - // Type: to.Ptr("Microsoft.Sql/servers/elasticPools"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/sqlcrudtest-2369/providers/Microsoft.Sql/servers/sqlcrudtest-8069/elasticPools/sqlcrudtest-8102"), - // Location: to.Ptr("Japan East"), - // Properties: &armsql.ElasticPoolProperties{ - // CreationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-02-10T01:25:25.033Z"); return t}()), - // MaxSizeBytes: to.Ptr[int64](5242880000), - // PerDatabaseSettings: &armsql.ElasticPoolPerDatabaseSettings{ - // MaxCapacity: to.Ptr[float64](2), - // MinCapacity: to.Ptr[float64](0.25), - // }, - // State: to.Ptr(armsql.ElasticPoolStateReady), - // }, - // SKU: &armsql.SKU{ - // Name: to.Ptr("GP_Gen4_2"), - // Capacity: to.Ptr[int32](2), - // Tier: to.Ptr("GeneralPurpose"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-08-01-preview/examples/ElasticPoolCreateOrUpdateSetMaintenanceConfiguration.json -func ExampleElasticPoolsClient_BeginCreateOrUpdate_createOrUpdateElasticPoolWithMaintenanceConfigurationParameter() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewElasticPoolsClient().BeginCreateOrUpdate(ctx, "sqlcrudtest-2369", "sqlcrudtest-8069", "sqlcrudtest-8102", armsql.ElasticPool{ - Location: to.Ptr("Japan East"), - Properties: &armsql.ElasticPoolProperties{ - MaintenanceConfigurationID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/providers/Microsoft.Maintenance/publicMaintenanceConfigurations/SQL_JapanEast_1"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ElasticPool = armsql.ElasticPool{ - // Name: to.Ptr("sqlcrudtest-8102"), - // Type: to.Ptr("Microsoft.Sql/servers/elasticPools"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/sqlcrudtest-2369/providers/Microsoft.Sql/servers/sqlcrudtest-8069/elasticPools/sqlcrudtest-8102"), - // Location: to.Ptr("Japan East"), - // Properties: &armsql.ElasticPoolProperties{ - // CreationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-02-10T01:25:25.033Z"); return t}()), - // MaintenanceConfigurationID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/providers/Microsoft.Maintenance/publicMaintenanceConfigurations/SQL_JapanEast_1"), - // MaxSizeBytes: to.Ptr[int64](102400), - // PerDatabaseSettings: &armsql.ElasticPoolPerDatabaseSettings{ - // MaxCapacity: to.Ptr[float64](100), - // MinCapacity: to.Ptr[float64](0), - // }, - // State: to.Ptr(armsql.ElasticPoolStateReady), - // }, - // SKU: &armsql.SKU{ - // Name: to.Ptr("StandardPool"), - // Capacity: to.Ptr[int32](100), - // Tier: to.Ptr("Standard"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-08-01-preview/examples/ElasticPoolCreateOrUpdateMin.json -func ExampleElasticPoolsClient_BeginCreateOrUpdate_createOrUpdateElasticPoolWithMinimumParameters() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewElasticPoolsClient().BeginCreateOrUpdate(ctx, "sqlcrudtest-2369", "sqlcrudtest-8069", "sqlcrudtest-8102", armsql.ElasticPool{ - Location: to.Ptr("Japan East"), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ElasticPool = armsql.ElasticPool{ - // Name: to.Ptr("sqlcrudtest-8102"), - // Type: to.Ptr("Microsoft.Sql/servers/elasticPools"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/sqlcrudtest-2369/providers/Microsoft.Sql/servers/sqlcrudtest-8069/elasticPools/sqlcrudtest-8102"), - // Location: to.Ptr("Japan East"), - // Properties: &armsql.ElasticPoolProperties{ - // CreationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-02-10T01:25:25.033Z"); return t}()), - // MaxSizeBytes: to.Ptr[int64](102400), - // PerDatabaseSettings: &armsql.ElasticPoolPerDatabaseSettings{ - // MaxCapacity: to.Ptr[float64](100), - // MinCapacity: to.Ptr[float64](0), - // }, - // State: to.Ptr(armsql.ElasticPoolStateReady), - // }, - // SKU: &armsql.SKU{ - // Name: to.Ptr("StandardPool"), - // Capacity: to.Ptr[int32](100), - // Tier: to.Ptr("Standard"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-08-01-preview/examples/ElasticPoolDelete.json -func ExampleElasticPoolsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewElasticPoolsClient().BeginDelete(ctx, "sqlcrudtest-3129", "sqlcrudtest-228", "sqlcrudtest-3851", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-08-01-preview/examples/ElasticPoolUpdateAssignMaintenanceConfiguration.json -func ExampleElasticPoolsClient_BeginUpdate_assignsMaintenanceConfigurationToAnElasticPool() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewElasticPoolsClient().BeginUpdate(ctx, "sqlcrudtest-2369", "sqlcrudtest-8069", "sqlcrudtest-8102", armsql.ElasticPoolUpdate{ - Properties: &armsql.ElasticPoolUpdateProperties{ - MaintenanceConfigurationID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/providers/Microsoft.Maintenance/publicMaintenanceConfigurations/SQL_JapanEast_1"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ElasticPool = armsql.ElasticPool{ - // Name: to.Ptr("sqlcrudtest-8102"), - // Type: to.Ptr("Microsoft.Sql/servers/elasticPools"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/sqlcrudtest-2369/providers/Microsoft.Sql/servers/sqlcrudtest-8069/elasticPools/sqlcrudtest-8102"), - // Location: to.Ptr("Japan East"), - // Properties: &armsql.ElasticPoolProperties{ - // CreationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-02-10T01:25:25.033Z"); return t}()), - // MaintenanceConfigurationID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/providers/Microsoft.Maintenance/publicMaintenanceConfigurations/SQL_JapanEast_1"), - // MaxSizeBytes: to.Ptr[int64](5242880000), - // PerDatabaseSettings: &armsql.ElasticPoolPerDatabaseSettings{ - // MaxCapacity: to.Ptr[float64](5), - // MinCapacity: to.Ptr[float64](0), - // }, - // State: to.Ptr(armsql.ElasticPoolStateReady), - // }, - // SKU: &armsql.SKU{ - // Name: to.Ptr("BasicPool"), - // Capacity: to.Ptr[int32](50), - // Tier: to.Ptr("Basic"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-08-01-preview/examples/ElasticPoolUpdateResetMaintenanceConfiguration.json -func ExampleElasticPoolsClient_BeginUpdate_resetsMaintenanceConfigurationOfAnElasticPoolToDefault() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewElasticPoolsClient().BeginUpdate(ctx, "sqlcrudtest-2369", "sqlcrudtest-8069", "sqlcrudtest-8102", armsql.ElasticPoolUpdate{ - Properties: &armsql.ElasticPoolUpdateProperties{ - MaintenanceConfigurationID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/providers/Microsoft.Maintenance/publicMaintenanceConfigurations/SQL_Default"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ElasticPool = armsql.ElasticPool{ - // Name: to.Ptr("sqlcrudtest-8102"), - // Type: to.Ptr("Microsoft.Sql/servers/elasticPools"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/sqlcrudtest-2369/providers/Microsoft.Sql/servers/sqlcrudtest-8069/elasticPools/sqlcrudtest-8102"), - // Location: to.Ptr("Japan East"), - // Properties: &armsql.ElasticPoolProperties{ - // CreationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-02-10T01:25:25.033Z"); return t}()), - // MaxSizeBytes: to.Ptr[int64](5242880000), - // PerDatabaseSettings: &armsql.ElasticPoolPerDatabaseSettings{ - // MaxCapacity: to.Ptr[float64](5), - // MinCapacity: to.Ptr[float64](0), - // }, - // State: to.Ptr(armsql.ElasticPoolStateReady), - // }, - // SKU: &armsql.SKU{ - // Name: to.Ptr("BasicPool"), - // Capacity: to.Ptr[int32](50), - // Tier: to.Ptr("Basic"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-08-01-preview/examples/ElasticPoolUpdateMax.json -func ExampleElasticPoolsClient_BeginUpdate_updateAnElasticPoolWithAllParameter() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewElasticPoolsClient().BeginUpdate(ctx, "sqlcrudtest-2369", "sqlcrudtest-8069", "sqlcrudtest-8102", armsql.ElasticPoolUpdate{ - Properties: &armsql.ElasticPoolUpdateProperties{ - LicenseType: to.Ptr(armsql.ElasticPoolLicenseTypeLicenseIncluded), - PerDatabaseSettings: &armsql.ElasticPoolPerDatabaseSettings{ - MaxCapacity: to.Ptr[float64](1), - MinCapacity: to.Ptr[float64](0.25), - }, - ZoneRedundant: to.Ptr(true), - }, - SKU: &armsql.SKU{ - Name: to.Ptr("BC_Gen4"), - Capacity: to.Ptr[int32](2), - Tier: to.Ptr("BusinessCritical"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ElasticPool = armsql.ElasticPool{ - // Name: to.Ptr("sqlcrudtest-8102"), - // Type: to.Ptr("Microsoft.Sql/servers/elasticPools"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/sqlcrudtest-2369/providers/Microsoft.Sql/servers/sqlcrudtest-8069/elasticPools/sqlcrudtest-8102"), - // Location: to.Ptr("Japan East"), - // Properties: &armsql.ElasticPoolProperties{ - // CreationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-02-10T01:27:21.32Z"); return t}()), - // LicenseType: to.Ptr(armsql.ElasticPoolLicenseTypeLicenseIncluded), - // MaxSizeBytes: to.Ptr[int64](5242880000), - // PerDatabaseSettings: &armsql.ElasticPoolPerDatabaseSettings{ - // MaxCapacity: to.Ptr[float64](1), - // MinCapacity: to.Ptr[float64](0.25), - // }, - // State: to.Ptr(armsql.ElasticPoolStateReady), - // ZoneRedundant: to.Ptr(true), - // }, - // SKU: &armsql.SKU{ - // Name: to.Ptr("BC_Gen4"), - // Capacity: to.Ptr[int32](2), - // Tier: to.Ptr("BusinessCritical"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-08-01-preview/examples/ElasticPoolUpdateMin.json -func ExampleElasticPoolsClient_BeginUpdate_updateAnElasticPoolWithMinimumParameters() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewElasticPoolsClient().BeginUpdate(ctx, "sqlcrudtest-2369", "sqlcrudtest-8069", "sqlcrudtest-8102", armsql.ElasticPoolUpdate{}, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ElasticPool = armsql.ElasticPool{ - // Name: to.Ptr("sqlcrudtest-8102"), - // Type: to.Ptr("Microsoft.Sql/servers/elasticPools"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/sqlcrudtest-2369/providers/Microsoft.Sql/servers/sqlcrudtest-8069/elasticPools/sqlcrudtest-8102"), - // Location: to.Ptr("Japan East"), - // Properties: &armsql.ElasticPoolProperties{ - // CreationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-02-10T01:25:25.033Z"); return t}()), - // MaxSizeBytes: to.Ptr[int64](5242880000), - // PerDatabaseSettings: &armsql.ElasticPoolPerDatabaseSettings{ - // MaxCapacity: to.Ptr[float64](5), - // MinCapacity: to.Ptr[float64](0), - // }, - // State: to.Ptr(armsql.ElasticPoolStateReady), - // }, - // SKU: &armsql.SKU{ - // Name: to.Ptr("BasicPool"), - // Capacity: to.Ptr[int32](50), - // Tier: to.Ptr("Basic"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-08-01-preview/examples/HyperscaleElasticPoolUpdateSetHighAvailabilityReplicaCount.json -func ExampleElasticPoolsClient_BeginUpdate_updateHighAvailabilityReplicaCountOfAHyperscaleElasticPool() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewElasticPoolsClient().BeginUpdate(ctx, "sqlcrudtest-2369", "sqlcrudtest-8069", "sqlcrudtest-8102", armsql.ElasticPoolUpdate{ - Properties: &armsql.ElasticPoolUpdateProperties{ - HighAvailabilityReplicaCount: to.Ptr[int32](2), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ElasticPool = armsql.ElasticPool{ - // Name: to.Ptr("sqlcrudtest-8102"), - // Type: to.Ptr("Microsoft.Sql/servers/elasticPools"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/sqlcrudtest-2369/providers/Microsoft.Sql/servers/sqlcrudtest-8069/elasticPools/sqlcrudtest-8102"), - // Location: to.Ptr("Japan East"), - // Kind: to.Ptr("vcore,pool"), - // Properties: &armsql.ElasticPoolProperties{ - // CreationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-26T03:46:20.57Z"); return t}()), - // HighAvailabilityReplicaCount: to.Ptr[int32](2), - // LicenseType: to.Ptr(armsql.ElasticPoolLicenseTypeLicenseIncluded), - // MaintenanceConfigurationID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/providers/Microsoft.Maintenance/publicMaintenanceConfigurations/SQL_Default"), - // MaxSizeBytes: to.Ptr[int64](0), - // PerDatabaseSettings: &armsql.ElasticPoolPerDatabaseSettings{ - // MaxCapacity: to.Ptr[float64](4), - // MinCapacity: to.Ptr[float64](0), - // }, - // State: to.Ptr(armsql.ElasticPoolStateReady), - // ZoneRedundant: to.Ptr(false), - // }, - // SKU: &armsql.SKU{ - // Name: to.Ptr("HS_Gen5"), - // Capacity: to.Ptr[int32](4), - // Family: to.Ptr("Gen5"), - // Tier: to.Ptr("Hyperscale"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-08-01-preview/examples/FailoverElasticPool.json -func ExampleElasticPoolsClient_BeginFailover() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewElasticPoolsClient().BeginFailover(ctx, "group1", "testServer", "testElasticPool", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} diff --git a/sdk/resourcemanager/sql/armsql/encryptionprotectors_client.go b/sdk/resourcemanager/sql/armsql/encryptionprotectors_client.go index 64f0600e1719..80bb0e57b78a 100644 --- a/sdk/resourcemanager/sql/armsql/encryptionprotectors_client.go +++ b/sdk/resourcemanager/sql/armsql/encryptionprotectors_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armsql @@ -47,7 +46,7 @@ func NewEncryptionProtectorsClient(subscriptionID string, credential azcore.Toke // BeginCreateOrUpdate - Updates an existing encryption protector. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -61,7 +60,8 @@ func (client *EncryptionProtectorsClient) BeginCreateOrUpdate(ctx context.Contex if err != nil { return nil, err } - return runtime.NewPoller[EncryptionProtectorsClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[EncryptionProtectorsClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[EncryptionProtectorsClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -70,20 +70,22 @@ func (client *EncryptionProtectorsClient) BeginCreateOrUpdate(ctx context.Contex // CreateOrUpdate - Updates an existing encryption protector. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview func (client *EncryptionProtectorsClient) createOrUpdate(ctx context.Context, resourceGroupName string, serverName string, encryptionProtectorName EncryptionProtectorName, parameters EncryptionProtector, options *EncryptionProtectorsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, serverName, encryptionProtectorName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createOrUpdateCreateRequest creates the CreateOrUpdate request. @@ -110,16 +112,19 @@ func (client *EncryptionProtectorsClient) createOrUpdateCreateRequest(ctx contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // Get - Gets a server encryption protector. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -127,18 +132,21 @@ func (client *EncryptionProtectorsClient) createOrUpdateCreateRequest(ctx contex // - options - EncryptionProtectorsClientGetOptions contains the optional parameters for the EncryptionProtectorsClient.Get // method. func (client *EncryptionProtectorsClient) Get(ctx context.Context, resourceGroupName string, serverName string, encryptionProtectorName EncryptionProtectorName, options *EncryptionProtectorsClientGetOptions) (EncryptionProtectorsClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, serverName, encryptionProtectorName, options) if err != nil { return EncryptionProtectorsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return EncryptionProtectorsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return EncryptionProtectorsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return EncryptionProtectorsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -165,7 +173,7 @@ func (client *EncryptionProtectorsClient) getCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -182,7 +190,7 @@ func (client *EncryptionProtectorsClient) getHandleResponse(resp *http.Response) // NewListByServerPager - Gets a list of server encryption protectors // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -236,7 +244,7 @@ func (client *EncryptionProtectorsClient) listByServerCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -254,7 +262,7 @@ func (client *EncryptionProtectorsClient) listByServerHandleResponse(resp *http. // BeginRevalidate - Revalidates an existing encryption protector. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -267,7 +275,8 @@ func (client *EncryptionProtectorsClient) BeginRevalidate(ctx context.Context, r if err != nil { return nil, err } - return runtime.NewPoller[EncryptionProtectorsClientRevalidateResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[EncryptionProtectorsClientRevalidateResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[EncryptionProtectorsClientRevalidateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -276,20 +285,22 @@ func (client *EncryptionProtectorsClient) BeginRevalidate(ctx context.Context, r // Revalidate - Revalidates an existing encryption protector. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview func (client *EncryptionProtectorsClient) revalidate(ctx context.Context, resourceGroupName string, serverName string, encryptionProtectorName EncryptionProtectorName, options *EncryptionProtectorsClientBeginRevalidateOptions) (*http.Response, error) { + var err error req, err := client.revalidateCreateRequest(ctx, resourceGroupName, serverName, encryptionProtectorName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // revalidateCreateRequest creates the Revalidate request. @@ -316,7 +327,7 @@ func (client *EncryptionProtectorsClient) revalidateCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } diff --git a/sdk/resourcemanager/sql/armsql/encryptionprotectors_client_example_test.go b/sdk/resourcemanager/sql/armsql/encryptionprotectors_client_example_test.go deleted file mode 100644 index 72598689f20f..000000000000 --- a/sdk/resourcemanager/sql/armsql/encryptionprotectors_client_example_test.go +++ /dev/null @@ -1,195 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsql_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sql/armsql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/EncryptionProtectorList.json -func ExampleEncryptionProtectorsClient_NewListByServerPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewEncryptionProtectorsClient().NewListByServerPager("sqlcrudtest-7398", "sqlcrudtest-4645", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.EncryptionProtectorListResult = armsql.EncryptionProtectorListResult{ - // Value: []*armsql.EncryptionProtector{ - // { - // Name: to.Ptr("current"), - // Type: to.Ptr("Microsoft.Sql/servers/encryptionProtector"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/sqlcrudtest-7398/providers/Microsoft.Sql/servers/sqlcrudtest-4645/encryptionProtector/current"), - // Kind: to.Ptr("azurekeyvault"), - // Location: to.Ptr("Japan East"), - // Properties: &armsql.EncryptionProtectorProperties{ - // ServerKeyName: to.Ptr("someVault_someKey_01234567890123456789012345678901"), - // ServerKeyType: to.Ptr(armsql.ServerKeyTypeAzureKeyVault), - // URI: to.Ptr("https://someVault.vault.azure.net/keys/someKey/01234567890123456789012345678901"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/EncryptionProtectorGet.json -func ExampleEncryptionProtectorsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewEncryptionProtectorsClient().Get(ctx, "sqlcrudtest-7398", "sqlcrudtest-4645", armsql.EncryptionProtectorNameCurrent, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.EncryptionProtector = armsql.EncryptionProtector{ - // Name: to.Ptr("current"), - // Type: to.Ptr("Microsoft.Sql/servers/encryptionProtector"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/sqlcrudtest-7398/providers/Microsoft.Sql/servers/sqlcrudtest-4645/encryptionProtector/current"), - // Kind: to.Ptr("azurekeyvault"), - // Location: to.Ptr("Japan East"), - // Properties: &armsql.EncryptionProtectorProperties{ - // AutoRotationEnabled: to.Ptr(false), - // ServerKeyName: to.Ptr("someVault_someKey_01234567890123456789012345678901"), - // ServerKeyType: to.Ptr(armsql.ServerKeyTypeAzureKeyVault), - // URI: to.Ptr("https://someVault.vault.azure.net/keys/someKey/01234567890123456789012345678901"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/EncryptionProtectorCreateOrUpdateKeyVault.json -func ExampleEncryptionProtectorsClient_BeginCreateOrUpdate_updateTheEncryptionProtectorToKeyVault() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewEncryptionProtectorsClient().BeginCreateOrUpdate(ctx, "sqlcrudtest-7398", "sqlcrudtest-4645", armsql.EncryptionProtectorNameCurrent, armsql.EncryptionProtector{ - Properties: &armsql.EncryptionProtectorProperties{ - AutoRotationEnabled: to.Ptr(false), - ServerKeyName: to.Ptr("someVault_someKey_01234567890123456789012345678901"), - ServerKeyType: to.Ptr(armsql.ServerKeyTypeAzureKeyVault), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.EncryptionProtector = armsql.EncryptionProtector{ - // Name: to.Ptr("current"), - // Type: to.Ptr("Microsoft.Sql/servers/encryptionProtector"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/sqlcrudtest-7398/providers/Microsoft.Sql/servers/sqlcrudtest-4645/encryptionProtector/current"), - // Kind: to.Ptr("azurekeyvault"), - // Location: to.Ptr("West US"), - // Properties: &armsql.EncryptionProtectorProperties{ - // AutoRotationEnabled: to.Ptr(false), - // ServerKeyName: to.Ptr("someVault_someKey_01234567890123456789012345678901"), - // ServerKeyType: to.Ptr(armsql.ServerKeyTypeAzureKeyVault), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/EncryptionProtectorCreateOrUpdateServiceManaged.json -func ExampleEncryptionProtectorsClient_BeginCreateOrUpdate_updateTheEncryptionProtectorToServiceManaged() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewEncryptionProtectorsClient().BeginCreateOrUpdate(ctx, "sqlcrudtest-7398", "sqlcrudtest-4645", armsql.EncryptionProtectorNameCurrent, armsql.EncryptionProtector{ - Properties: &armsql.EncryptionProtectorProperties{ - ServerKeyName: to.Ptr("ServiceManaged"), - ServerKeyType: to.Ptr(armsql.ServerKeyTypeServiceManaged), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.EncryptionProtector = armsql.EncryptionProtector{ - // Name: to.Ptr("current"), - // Type: to.Ptr("Microsoft.Sql/servers/encryptionProtector"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/sqlcrudtest-7398/providers/Microsoft.Sql/servers/sqlcrudtest-4645/encryptionProtector/current"), - // Kind: to.Ptr("servicemanaged"), - // Location: to.Ptr("West US"), - // Properties: &armsql.EncryptionProtectorProperties{ - // ServerKeyName: to.Ptr("ServiceManaged"), - // ServerKeyType: to.Ptr(armsql.ServerKeyTypeServiceManaged), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/EncryptionProtectorRevalidate.json -func ExampleEncryptionProtectorsClient_BeginRevalidate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewEncryptionProtectorsClient().BeginRevalidate(ctx, "sqlcrudtest-7398", "sqlcrudtest-4645", armsql.EncryptionProtectorNameCurrent, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} diff --git a/sdk/resourcemanager/sql/armsql/endpointcertificates_client.go b/sdk/resourcemanager/sql/armsql/endpointcertificates_client.go index f18074920e68..9410808cd782 100644 --- a/sdk/resourcemanager/sql/armsql/endpointcertificates_client.go +++ b/sdk/resourcemanager/sql/armsql/endpointcertificates_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armsql @@ -47,7 +46,7 @@ func NewEndpointCertificatesClient(subscriptionID string, credential azcore.Toke // Get - Gets a certificate used on the endpoint with the given id. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - managedInstanceName - The name of the managed instance. @@ -55,18 +54,21 @@ func NewEndpointCertificatesClient(subscriptionID string, credential azcore.Toke // - options - EndpointCertificatesClientGetOptions contains the optional parameters for the EndpointCertificatesClient.Get // method. func (client *EndpointCertificatesClient) Get(ctx context.Context, resourceGroupName string, managedInstanceName string, endpointType string, options *EndpointCertificatesClientGetOptions) (EndpointCertificatesClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, managedInstanceName, endpointType, options) if err != nil { return EndpointCertificatesClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return EndpointCertificatesClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return EndpointCertificatesClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return EndpointCertificatesClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -93,7 +95,7 @@ func (client *EndpointCertificatesClient) getCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -110,7 +112,7 @@ func (client *EndpointCertificatesClient) getHandleResponse(resp *http.Response) // NewListByInstancePager - List certificates used on endpoints on the target instance. // -// Generated from API version 2021-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - managedInstanceName - The name of the managed instance. @@ -164,7 +166,7 @@ func (client *EndpointCertificatesClient) listByInstanceCreateRequest(ctx contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/sql/armsql/endpointcertificates_client_example_test.go b/sdk/resourcemanager/sql/armsql/endpointcertificates_client_example_test.go deleted file mode 100644 index 7ec1e69149c4..000000000000 --- a/sdk/resourcemanager/sql/armsql/endpointcertificates_client_example_test.go +++ /dev/null @@ -1,90 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsql_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sql/armsql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/EndpointCertificatesListByInstance.json -func ExampleEndpointCertificatesClient_NewListByInstancePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewEndpointCertificatesClient().NewListByInstancePager("testrg", "testcl", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.EndpointCertificateListResult = armsql.EndpointCertificateListResult{ - // Value: []*armsql.EndpointCertificate{ - // { - // Name: to.Ptr("SERVICE_BROKER"), - // Type: to.Ptr("Microsoft.Sql/managedInstances/endpointCertificates"), - // ID: to.Ptr("/subscriptions/38e0dc56-907f-45ba-a97c-74233baad471/resourceGroups/testrg/providers/Microsoft.Sql/managedInstances/testcl/endpointCertificates/SERVICE_BROKER"), - // Properties: &armsql.EndpointCertificateProperties{ - // PublicBlob: to.Ptr("0x308203B23082021AA003020102021034C597BA"), - // }, - // }, - // { - // Name: to.Ptr("DATABASE_MIRRORING"), - // Type: to.Ptr("Microsoft.Sql/managedInstances/endpointCertificates"), - // ID: to.Ptr("/subscriptions/38e0dc56-907f-45ba-a97c-74233baad471/resourceGroups/testrg/providers/Microsoft.Sql/managedInstances/testcl/endpointCertificates/DATABASE_MIRRORING"), - // Properties: &armsql.EndpointCertificateProperties{ - // PublicBlob: to.Ptr("0x308203B23082021AA003020102021034C597BA"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/EndpointCertificatesGet.json -func ExampleEndpointCertificatesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewEndpointCertificatesClient().Get(ctx, "testrg", "testcl", "DATABASE_MIRRORING", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.EndpointCertificate = armsql.EndpointCertificate{ - // Name: to.Ptr("DATABASE_MIRRORING"), - // Type: to.Ptr("Microsoft.Sql/managedInstances/endpointCertificates"), - // ID: to.Ptr("/subscriptions/38e0dc56-907f-45ba-a97c-74233baad471/resourceGroups/testrg/providers/Microsoft.Sql/managedInstances/testcl/endpointCertificates/DATABASE_MIRRORING"), - // Properties: &armsql.EndpointCertificateProperties{ - // PublicBlob: to.Ptr("0x308203B23082021AA003020102021034C597BA"), - // }, - // } -} diff --git a/sdk/resourcemanager/sql/armsql/extendeddatabaseblobauditingpolicies_client.go b/sdk/resourcemanager/sql/armsql/extendeddatabaseblobauditingpolicies_client.go index f00b2c1d242b..451dcf81965e 100644 --- a/sdk/resourcemanager/sql/armsql/extendeddatabaseblobauditingpolicies_client.go +++ b/sdk/resourcemanager/sql/armsql/extendeddatabaseblobauditingpolicies_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armsql @@ -47,7 +46,7 @@ func NewExtendedDatabaseBlobAuditingPoliciesClient(subscriptionID string, creden // CreateOrUpdate - Creates or updates an extended database's blob auditing policy. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -56,18 +55,21 @@ func NewExtendedDatabaseBlobAuditingPoliciesClient(subscriptionID string, creden // - options - ExtendedDatabaseBlobAuditingPoliciesClientCreateOrUpdateOptions contains the optional parameters for the ExtendedDatabaseBlobAuditingPoliciesClient.CreateOrUpdate // method. func (client *ExtendedDatabaseBlobAuditingPoliciesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters ExtendedDatabaseBlobAuditingPolicy, options *ExtendedDatabaseBlobAuditingPoliciesClientCreateOrUpdateOptions) (ExtendedDatabaseBlobAuditingPoliciesClientCreateOrUpdateResponse, error) { + var err error req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, serverName, databaseName, parameters, options) if err != nil { return ExtendedDatabaseBlobAuditingPoliciesClientCreateOrUpdateResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ExtendedDatabaseBlobAuditingPoliciesClientCreateOrUpdateResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { - return ExtendedDatabaseBlobAuditingPoliciesClientCreateOrUpdateResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return ExtendedDatabaseBlobAuditingPoliciesClientCreateOrUpdateResponse{}, err } - return client.createOrUpdateHandleResponse(resp) + resp, err := client.createOrUpdateHandleResponse(httpResp) + return resp, err } // createOrUpdateCreateRequest creates the CreateOrUpdate request. @@ -95,10 +97,13 @@ func (client *ExtendedDatabaseBlobAuditingPoliciesClient) createOrUpdateCreateRe return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // createOrUpdateHandleResponse handles the CreateOrUpdate response. @@ -113,7 +118,7 @@ func (client *ExtendedDatabaseBlobAuditingPoliciesClient) createOrUpdateHandleRe // Get - Gets an extended database's blob auditing policy. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -121,18 +126,21 @@ func (client *ExtendedDatabaseBlobAuditingPoliciesClient) createOrUpdateHandleRe // - options - ExtendedDatabaseBlobAuditingPoliciesClientGetOptions contains the optional parameters for the ExtendedDatabaseBlobAuditingPoliciesClient.Get // method. func (client *ExtendedDatabaseBlobAuditingPoliciesClient) Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string, options *ExtendedDatabaseBlobAuditingPoliciesClientGetOptions) (ExtendedDatabaseBlobAuditingPoliciesClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, serverName, databaseName, options) if err != nil { return ExtendedDatabaseBlobAuditingPoliciesClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ExtendedDatabaseBlobAuditingPoliciesClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ExtendedDatabaseBlobAuditingPoliciesClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ExtendedDatabaseBlobAuditingPoliciesClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -160,7 +168,7 @@ func (client *ExtendedDatabaseBlobAuditingPoliciesClient) getCreateRequest(ctx c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -177,7 +185,7 @@ func (client *ExtendedDatabaseBlobAuditingPoliciesClient) getHandleResponse(resp // NewListByDatabasePager - Lists extended auditing settings of a database. // -// Generated from API version 2021-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -236,7 +244,7 @@ func (client *ExtendedDatabaseBlobAuditingPoliciesClient) listByDatabaseCreateRe return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/sql/armsql/extendeddatabaseblobauditingpolicies_client_example_test.go b/sdk/resourcemanager/sql/armsql/extendeddatabaseblobauditingpolicies_client_example_test.go deleted file mode 100644 index 114845eb09b3..000000000000 --- a/sdk/resourcemanager/sql/armsql/extendeddatabaseblobauditingpolicies_client_example_test.go +++ /dev/null @@ -1,239 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsql_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sql/armsql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/DatabaseExtendedAuditingSettingsList.json -func ExampleExtendedDatabaseBlobAuditingPoliciesClient_NewListByDatabasePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewExtendedDatabaseBlobAuditingPoliciesClient().NewListByDatabasePager("blobauditingtest-6852", "blobauditingtest-2080", "testdb", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ExtendedDatabaseBlobAuditingPolicyListResult = armsql.ExtendedDatabaseBlobAuditingPolicyListResult{ - // Value: []*armsql.ExtendedDatabaseBlobAuditingPolicy{ - // { - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.Sql/servers/databases/extendedAuditingSettings"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/blobauditingtest-6852/providers/Microsoft.Sql/servers/blobauditingtest-2080/databases/testdb/extendedAuditingSettings/default"), - // Properties: &armsql.ExtendedDatabaseBlobAuditingPolicyProperties{ - // AuditActionsAndGroups: []*string{ - // }, - // IsAzureMonitorTargetEnabled: to.Ptr(false), - // IsManagedIdentityInUse: to.Ptr(false), - // IsStorageSecondaryKeyInUse: to.Ptr(false), - // PredicateExpression: to.Ptr("statement = 'select 1'"), - // RetentionDays: to.Ptr[int32](0), - // State: to.Ptr(armsql.BlobAuditingPolicyStateDisabled), - // StorageAccountSubscriptionID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // StorageEndpoint: to.Ptr(""), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/ExtendedDatabaseBlobAuditingGet.json -func ExampleExtendedDatabaseBlobAuditingPoliciesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewExtendedDatabaseBlobAuditingPoliciesClient().Get(ctx, "blobauditingtest-6852", "blobauditingtest-2080", "testdb", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ExtendedDatabaseBlobAuditingPolicy = armsql.ExtendedDatabaseBlobAuditingPolicy{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.Sql/servers/databases/extendedAuditingSettings"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/blobauditingtest-6852/providers/Microsoft.Sql/servers/blobauditingtest-2080/databases/testdb"), - // Properties: &armsql.ExtendedDatabaseBlobAuditingPolicyProperties{ - // AuditActionsAndGroups: []*string{ - // }, - // IsAzureMonitorTargetEnabled: to.Ptr(false), - // IsManagedIdentityInUse: to.Ptr(false), - // IsStorageSecondaryKeyInUse: to.Ptr(false), - // PredicateExpression: to.Ptr("statement = 'select 1'"), - // RetentionDays: to.Ptr[int32](0), - // State: to.Ptr(armsql.BlobAuditingPolicyStateDisabled), - // StorageAccountSubscriptionID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // StorageEndpoint: to.Ptr(""), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/ExtendedDatabaseAzureMonitorAuditingCreateMin.json -func ExampleExtendedDatabaseBlobAuditingPoliciesClient_CreateOrUpdate_createOrUpdateAnExtendedDatabasesAzureMonitorAuditingPolicyWithMinimalParameters() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewExtendedDatabaseBlobAuditingPoliciesClient().CreateOrUpdate(ctx, "blobauditingtest-4799", "blobauditingtest-6440", "testdb", armsql.ExtendedDatabaseBlobAuditingPolicy{ - Properties: &armsql.ExtendedDatabaseBlobAuditingPolicyProperties{ - IsAzureMonitorTargetEnabled: to.Ptr(true), - State: to.Ptr(armsql.BlobAuditingPolicyStateEnabled), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ExtendedDatabaseBlobAuditingPolicy = armsql.ExtendedDatabaseBlobAuditingPolicy{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.Sql/servers/databases/extendedAuditingSettings"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/blobauditingtest-4799/providers/Microsoft.Sql/servers/blobauditingtest-6440/databases/testdb"), - // Properties: &armsql.ExtendedDatabaseBlobAuditingPolicyProperties{ - // AuditActionsAndGroups: []*string{ - // to.Ptr("SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP"), - // to.Ptr("FAILED_DATABASE_AUTHENTICATION_GROUP"), - // to.Ptr("BATCH_COMPLETED_GROUP")}, - // IsAzureMonitorTargetEnabled: to.Ptr(true), - // RetentionDays: to.Ptr[int32](0), - // State: to.Ptr(armsql.BlobAuditingPolicyStateEnabled), - // StorageAccountSubscriptionID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/ExtendedDatabaseBlobAuditingCreateMax.json -func ExampleExtendedDatabaseBlobAuditingPoliciesClient_CreateOrUpdate_createOrUpdateAnExtendedDatabasesBlobAuditingPolicyWithAllParameters() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewExtendedDatabaseBlobAuditingPoliciesClient().CreateOrUpdate(ctx, "blobauditingtest-4799", "blobauditingtest-6440", "testdb", armsql.ExtendedDatabaseBlobAuditingPolicy{ - Properties: &armsql.ExtendedDatabaseBlobAuditingPolicyProperties{ - AuditActionsAndGroups: []*string{ - to.Ptr("DATABASE_LOGOUT_GROUP"), - to.Ptr("DATABASE_ROLE_MEMBER_CHANGE_GROUP"), - to.Ptr("UPDATE on database::TestDatabaseName by public")}, - IsAzureMonitorTargetEnabled: to.Ptr(true), - IsStorageSecondaryKeyInUse: to.Ptr(false), - PredicateExpression: to.Ptr("statement = 'select 1'"), - QueueDelayMs: to.Ptr[int32](4000), - RetentionDays: to.Ptr[int32](6), - State: to.Ptr(armsql.BlobAuditingPolicyStateEnabled), - StorageAccountAccessKey: to.Ptr("sdlfkjabc+sdlfkjsdlkfsjdfLDKFTERLKFDFKLjsdfksjdflsdkfD2342309432849328476458/3RSD=="), - StorageAccountSubscriptionID: to.Ptr("00000000-1234-0000-5678-000000000000"), - StorageEndpoint: to.Ptr("https://mystorage.blob.core.windows.net"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ExtendedDatabaseBlobAuditingPolicy = armsql.ExtendedDatabaseBlobAuditingPolicy{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.Sql/servers/databases/extendedAuditingSettings"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/blobauditingtest-4799/providers/Microsoft.Sql/servers/blobauditingtest-6440/databases/testdb"), - // Properties: &armsql.ExtendedDatabaseBlobAuditingPolicyProperties{ - // AuditActionsAndGroups: []*string{ - // to.Ptr("DATABASE_LOGOUT_GROUP"), - // to.Ptr("DATABASE_ROLE_MEMBER_CHANGE_GROUP"), - // to.Ptr("UPDATE on database::TestDatabaseName by public")}, - // IsAzureMonitorTargetEnabled: to.Ptr(true), - // IsStorageSecondaryKeyInUse: to.Ptr(false), - // PredicateExpression: to.Ptr("statement = 'select 1'"), - // QueueDelayMs: to.Ptr[int32](4000), - // RetentionDays: to.Ptr[int32](0), - // State: to.Ptr(armsql.BlobAuditingPolicyStateEnabled), - // StorageAccountSubscriptionID: to.Ptr("00000000-1234-0000-5678-000000000000"), - // StorageEndpoint: to.Ptr("https://mystorage.blob.core.windows.net"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/ExtendedDatabaseBlobAuditingCreateMin.json -func ExampleExtendedDatabaseBlobAuditingPoliciesClient_CreateOrUpdate_createOrUpdateAnExtendedDatabasesBlobAuditingPolicyWithMinimalParameters() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewExtendedDatabaseBlobAuditingPoliciesClient().CreateOrUpdate(ctx, "blobauditingtest-4799", "blobauditingtest-6440", "testdb", armsql.ExtendedDatabaseBlobAuditingPolicy{ - Properties: &armsql.ExtendedDatabaseBlobAuditingPolicyProperties{ - State: to.Ptr(armsql.BlobAuditingPolicyStateEnabled), - StorageAccountAccessKey: to.Ptr("sdlfkjabc+sdlfkjsdlkfsjdfLDKFTERLKFDFKLjsdfksjdflsdkfD2342309432849328476458/3RSD=="), - StorageEndpoint: to.Ptr("https://mystorage.blob.core.windows.net"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ExtendedDatabaseBlobAuditingPolicy = armsql.ExtendedDatabaseBlobAuditingPolicy{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.Sql/servers/databases/extendedAuditingSettings"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/blobauditingtest-4799/providers/Microsoft.Sql/servers/blobauditingtest-6440/databases/testdb"), - // Properties: &armsql.ExtendedDatabaseBlobAuditingPolicyProperties{ - // AuditActionsAndGroups: []*string{ - // to.Ptr("SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP"), - // to.Ptr("FAILED_DATABASE_AUTHENTICATION_GROUP"), - // to.Ptr("BATCH_COMPLETED_GROUP")}, - // IsAzureMonitorTargetEnabled: to.Ptr(false), - // IsStorageSecondaryKeyInUse: to.Ptr(false), - // RetentionDays: to.Ptr[int32](0), - // State: to.Ptr(armsql.BlobAuditingPolicyStateEnabled), - // StorageAccountSubscriptionID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // StorageEndpoint: to.Ptr("https://mystorage.blob.core.windows.net"), - // }, - // } -} diff --git a/sdk/resourcemanager/sql/armsql/extendedserverblobauditingpolicies_client.go b/sdk/resourcemanager/sql/armsql/extendedserverblobauditingpolicies_client.go index 8239696c9444..d74303133780 100644 --- a/sdk/resourcemanager/sql/armsql/extendedserverblobauditingpolicies_client.go +++ b/sdk/resourcemanager/sql/armsql/extendedserverblobauditingpolicies_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armsql @@ -47,7 +46,7 @@ func NewExtendedServerBlobAuditingPoliciesClient(subscriptionID string, credenti // BeginCreateOrUpdate - Creates or updates an extended server's blob auditing policy. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -60,7 +59,8 @@ func (client *ExtendedServerBlobAuditingPoliciesClient) BeginCreateOrUpdate(ctx if err != nil { return nil, err } - return runtime.NewPoller[ExtendedServerBlobAuditingPoliciesClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[ExtendedServerBlobAuditingPoliciesClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[ExtendedServerBlobAuditingPoliciesClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -69,20 +69,22 @@ func (client *ExtendedServerBlobAuditingPoliciesClient) BeginCreateOrUpdate(ctx // CreateOrUpdate - Creates or updates an extended server's blob auditing policy. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-11-01-preview +// Generated from API version 2022-11-01-preview func (client *ExtendedServerBlobAuditingPoliciesClient) createOrUpdate(ctx context.Context, resourceGroupName string, serverName string, parameters ExtendedServerBlobAuditingPolicy, options *ExtendedServerBlobAuditingPoliciesClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, serverName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createOrUpdateCreateRequest creates the CreateOrUpdate request. @@ -106,34 +108,40 @@ func (client *ExtendedServerBlobAuditingPoliciesClient) createOrUpdateCreateRequ return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // Get - Gets an extended server's blob auditing policy. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. // - options - ExtendedServerBlobAuditingPoliciesClientGetOptions contains the optional parameters for the ExtendedServerBlobAuditingPoliciesClient.Get // method. func (client *ExtendedServerBlobAuditingPoliciesClient) Get(ctx context.Context, resourceGroupName string, serverName string, options *ExtendedServerBlobAuditingPoliciesClientGetOptions) (ExtendedServerBlobAuditingPoliciesClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, serverName, options) if err != nil { return ExtendedServerBlobAuditingPoliciesClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ExtendedServerBlobAuditingPoliciesClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ExtendedServerBlobAuditingPoliciesClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ExtendedServerBlobAuditingPoliciesClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -157,7 +165,7 @@ func (client *ExtendedServerBlobAuditingPoliciesClient) getCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -174,7 +182,7 @@ func (client *ExtendedServerBlobAuditingPoliciesClient) getHandleResponse(resp * // NewListByServerPager - Lists extended auditing settings of a server. // -// Generated from API version 2021-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -228,7 +236,7 @@ func (client *ExtendedServerBlobAuditingPoliciesClient) listByServerCreateReques return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/sql/armsql/extendedserverblobauditingpolicies_client_example_test.go b/sdk/resourcemanager/sql/armsql/extendedserverblobauditingpolicies_client_example_test.go deleted file mode 100644 index f2df79d848d2..000000000000 --- a/sdk/resourcemanager/sql/armsql/extendedserverblobauditingpolicies_client_example_test.go +++ /dev/null @@ -1,207 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsql_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sql/armsql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/ServerExtendedAuditingSettingsList.json -func ExampleExtendedServerBlobAuditingPoliciesClient_NewListByServerPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewExtendedServerBlobAuditingPoliciesClient().NewListByServerPager("blobauditingtest-4799", "blobauditingtest-6440", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ExtendedServerBlobAuditingPolicyListResult = armsql.ExtendedServerBlobAuditingPolicyListResult{ - // Value: []*armsql.ExtendedServerBlobAuditingPolicy{ - // { - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.Sql/servers/extendedAuditingSettings"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/blobauditingtest-6852/providers/Microsoft.Sql/servers/blobauditingtest-2080/extendedAuditingSettings/default"), - // Properties: &armsql.ExtendedServerBlobAuditingPolicyProperties{ - // AuditActionsAndGroups: []*string{ - // }, - // IsAzureMonitorTargetEnabled: to.Ptr(false), - // IsManagedIdentityInUse: to.Ptr(false), - // IsStorageSecondaryKeyInUse: to.Ptr(false), - // PredicateExpression: to.Ptr("object_name = 'SensitiveData'"), - // RetentionDays: to.Ptr[int32](0), - // State: to.Ptr(armsql.BlobAuditingPolicyStateDisabled), - // StorageAccountSubscriptionID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // StorageEndpoint: to.Ptr(""), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/ExtendedServerBlobAuditingGet.json -func ExampleExtendedServerBlobAuditingPoliciesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewExtendedServerBlobAuditingPoliciesClient().Get(ctx, "blobauditingtest-4799", "blobauditingtest-6440", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ExtendedServerBlobAuditingPolicy = armsql.ExtendedServerBlobAuditingPolicy{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.Sql/servers/extendedAuditingSettings"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/blobauditingtest-6852/providers/Microsoft.Sql/servers/blobauditingtest-2080/extendedAuditingSettings/default"), - // Properties: &armsql.ExtendedServerBlobAuditingPolicyProperties{ - // AuditActionsAndGroups: []*string{ - // }, - // IsAzureMonitorTargetEnabled: to.Ptr(false), - // IsManagedIdentityInUse: to.Ptr(false), - // IsStorageSecondaryKeyInUse: to.Ptr(false), - // PredicateExpression: to.Ptr("object_name = 'SensitiveData'"), - // RetentionDays: to.Ptr[int32](0), - // State: to.Ptr(armsql.BlobAuditingPolicyStateDisabled), - // StorageAccountSubscriptionID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // StorageEndpoint: to.Ptr(""), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/ExtendedServerBlobAuditingCreateMax.json -func ExampleExtendedServerBlobAuditingPoliciesClient_BeginCreateOrUpdate_updateAServersExtendedBlobAuditingPolicyWithAllParameters() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewExtendedServerBlobAuditingPoliciesClient().BeginCreateOrUpdate(ctx, "blobauditingtest-4799", "blobauditingtest-6440", armsql.ExtendedServerBlobAuditingPolicy{ - Properties: &armsql.ExtendedServerBlobAuditingPolicyProperties{ - AuditActionsAndGroups: []*string{ - to.Ptr("SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP"), - to.Ptr("FAILED_DATABASE_AUTHENTICATION_GROUP"), - to.Ptr("BATCH_COMPLETED_GROUP")}, - IsAzureMonitorTargetEnabled: to.Ptr(true), - IsStorageSecondaryKeyInUse: to.Ptr(false), - PredicateExpression: to.Ptr("object_name = 'SensitiveData'"), - QueueDelayMs: to.Ptr[int32](4000), - RetentionDays: to.Ptr[int32](6), - State: to.Ptr(armsql.BlobAuditingPolicyStateEnabled), - StorageAccountAccessKey: to.Ptr("sdlfkjabc+sdlfkjsdlkfsjdfLDKFTERLKFDFKLjsdfksjdflsdkfD2342309432849328476458/3RSD=="), - StorageAccountSubscriptionID: to.Ptr("00000000-1234-0000-5678-000000000000"), - StorageEndpoint: to.Ptr("https://mystorage.blob.core.windows.net"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ExtendedServerBlobAuditingPolicy = armsql.ExtendedServerBlobAuditingPolicy{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.Sql/servers/extendedAuditingSettings"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/blobauditingtest-4799/providers/Microsoft.Sql/servers/blobauditingtest-6440/extendedAuditingSettings/default"), - // Properties: &armsql.ExtendedServerBlobAuditingPolicyProperties{ - // AuditActionsAndGroups: []*string{ - // to.Ptr("SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP"), - // to.Ptr("FAILED_DATABASE_AUTHENTICATION_GROUP"), - // to.Ptr("BATCH_COMPLETED_GROUP")}, - // IsAzureMonitorTargetEnabled: to.Ptr(true), - // IsStorageSecondaryKeyInUse: to.Ptr(false), - // PredicateExpression: to.Ptr("object_name = 'SensitiveData'"), - // QueueDelayMs: to.Ptr[int32](4000), - // RetentionDays: to.Ptr[int32](6), - // State: to.Ptr(armsql.BlobAuditingPolicyStateEnabled), - // StorageAccountSubscriptionID: to.Ptr("00000000-1234-0000-5678-000000000000"), - // StorageEndpoint: to.Ptr("https://mystorage.blob.core.windows.net"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/ExtendedServerBlobAuditingCreateMin.json -func ExampleExtendedServerBlobAuditingPoliciesClient_BeginCreateOrUpdate_updateAServersExtendedBlobAuditingPolicyWithMinimalParameters() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewExtendedServerBlobAuditingPoliciesClient().BeginCreateOrUpdate(ctx, "blobauditingtest-4799", "blobauditingtest-6440", armsql.ExtendedServerBlobAuditingPolicy{ - Properties: &armsql.ExtendedServerBlobAuditingPolicyProperties{ - State: to.Ptr(armsql.BlobAuditingPolicyStateEnabled), - StorageAccountAccessKey: to.Ptr("sdlfkjabc+sdlfkjsdlkfsjdfLDKFTERLKFDFKLjsdfksjdflsdkfD2342309432849328476458/3RSD=="), - StorageEndpoint: to.Ptr("https://mystorage.blob.core.windows.net"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ExtendedServerBlobAuditingPolicy = armsql.ExtendedServerBlobAuditingPolicy{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.Sql/servers/extendedAuditingSettings"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/blobauditingtest-4799/providers/Microsoft.Sql/servers/blobauditingtest-6440/extendedAuditingSettings/default"), - // Properties: &armsql.ExtendedServerBlobAuditingPolicyProperties{ - // AuditActionsAndGroups: []*string{ - // to.Ptr("SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP"), - // to.Ptr("FAILED_DATABASE_AUTHENTICATION_GROUP"), - // to.Ptr("BATCH_COMPLETED_GROUP")}, - // IsAzureMonitorTargetEnabled: to.Ptr(false), - // IsStorageSecondaryKeyInUse: to.Ptr(false), - // RetentionDays: to.Ptr[int32](6), - // State: to.Ptr(armsql.BlobAuditingPolicyStateEnabled), - // StorageAccountSubscriptionID: to.Ptr("00000000-1234-0000-5678-000000000000"), - // StorageEndpoint: to.Ptr("https://mystorage.blob.core.windows.net"), - // }, - // } -} diff --git a/sdk/resourcemanager/sql/armsql/failovergroups_client.go b/sdk/resourcemanager/sql/armsql/failovergroups_client.go index d2c4960b17fb..849286db4558 100644 --- a/sdk/resourcemanager/sql/armsql/failovergroups_client.go +++ b/sdk/resourcemanager/sql/armsql/failovergroups_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armsql @@ -47,7 +46,7 @@ func NewFailoverGroupsClient(subscriptionID string, credential azcore.TokenCrede // BeginCreateOrUpdate - Creates or updates a failover group. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server containing the failover group. @@ -61,7 +60,8 @@ func (client *FailoverGroupsClient) BeginCreateOrUpdate(ctx context.Context, res if err != nil { return nil, err } - return runtime.NewPoller[FailoverGroupsClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[FailoverGroupsClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[FailoverGroupsClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -70,20 +70,22 @@ func (client *FailoverGroupsClient) BeginCreateOrUpdate(ctx context.Context, res // CreateOrUpdate - Creates or updates a failover group. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview func (client *FailoverGroupsClient) createOrUpdate(ctx context.Context, resourceGroupName string, serverName string, failoverGroupName string, parameters FailoverGroup, options *FailoverGroupsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, serverName, failoverGroupName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createOrUpdateCreateRequest creates the CreateOrUpdate request. @@ -110,16 +112,19 @@ func (client *FailoverGroupsClient) createOrUpdateCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // BeginDelete - Deletes a failover group. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server containing the failover group. @@ -132,7 +137,8 @@ func (client *FailoverGroupsClient) BeginDelete(ctx context.Context, resourceGro if err != nil { return nil, err } - return runtime.NewPoller[FailoverGroupsClientDeleteResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[FailoverGroupsClientDeleteResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[FailoverGroupsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -141,20 +147,22 @@ func (client *FailoverGroupsClient) BeginDelete(ctx context.Context, resourceGro // Delete - Deletes a failover group. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview func (client *FailoverGroupsClient) deleteOperation(ctx context.Context, resourceGroupName string, serverName string, failoverGroupName string, options *FailoverGroupsClientBeginDeleteOptions) (*http.Response, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, serverName, failoverGroupName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteCreateRequest creates the Delete request. @@ -181,7 +189,7 @@ func (client *FailoverGroupsClient) deleteCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -189,7 +197,7 @@ func (client *FailoverGroupsClient) deleteCreateRequest(ctx context.Context, res // BeginFailover - Fails over from the current primary server to this server. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server containing the failover group. @@ -202,7 +210,8 @@ func (client *FailoverGroupsClient) BeginFailover(ctx context.Context, resourceG if err != nil { return nil, err } - return runtime.NewPoller[FailoverGroupsClientFailoverResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[FailoverGroupsClientFailoverResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[FailoverGroupsClientFailoverResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -211,20 +220,22 @@ func (client *FailoverGroupsClient) BeginFailover(ctx context.Context, resourceG // Failover - Fails over from the current primary server to this server. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview func (client *FailoverGroupsClient) failover(ctx context.Context, resourceGroupName string, serverName string, failoverGroupName string, options *FailoverGroupsClientBeginFailoverOptions) (*http.Response, error) { + var err error req, err := client.failoverCreateRequest(ctx, resourceGroupName, serverName, failoverGroupName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // failoverCreateRequest creates the Failover request. @@ -251,7 +262,7 @@ func (client *FailoverGroupsClient) failoverCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -261,7 +272,7 @@ func (client *FailoverGroupsClient) failoverCreateRequest(ctx context.Context, r // in data loss. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server containing the failover group. @@ -274,7 +285,8 @@ func (client *FailoverGroupsClient) BeginForceFailoverAllowDataLoss(ctx context. if err != nil { return nil, err } - return runtime.NewPoller[FailoverGroupsClientForceFailoverAllowDataLossResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[FailoverGroupsClientForceFailoverAllowDataLossResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[FailoverGroupsClientForceFailoverAllowDataLossResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -284,20 +296,22 @@ func (client *FailoverGroupsClient) BeginForceFailoverAllowDataLoss(ctx context. // data loss. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview func (client *FailoverGroupsClient) forceFailoverAllowDataLoss(ctx context.Context, resourceGroupName string, serverName string, failoverGroupName string, options *FailoverGroupsClientBeginForceFailoverAllowDataLossOptions) (*http.Response, error) { + var err error req, err := client.forceFailoverAllowDataLossCreateRequest(ctx, resourceGroupName, serverName, failoverGroupName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // forceFailoverAllowDataLossCreateRequest creates the ForceFailoverAllowDataLoss request. @@ -324,7 +338,7 @@ func (client *FailoverGroupsClient) forceFailoverAllowDataLossCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -333,25 +347,28 @@ func (client *FailoverGroupsClient) forceFailoverAllowDataLossCreateRequest(ctx // Get - Gets a failover group. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server containing the failover group. // - failoverGroupName - The name of the failover group. // - options - FailoverGroupsClientGetOptions contains the optional parameters for the FailoverGroupsClient.Get method. func (client *FailoverGroupsClient) Get(ctx context.Context, resourceGroupName string, serverName string, failoverGroupName string, options *FailoverGroupsClientGetOptions) (FailoverGroupsClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, serverName, failoverGroupName, options) if err != nil { return FailoverGroupsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return FailoverGroupsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return FailoverGroupsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return FailoverGroupsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -378,7 +395,7 @@ func (client *FailoverGroupsClient) getCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -395,7 +412,7 @@ func (client *FailoverGroupsClient) getHandleResponse(resp *http.Response) (Fail // NewListByServerPager - Lists the failover groups in a server. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server containing the failover group. @@ -449,7 +466,7 @@ func (client *FailoverGroupsClient) listByServerCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -464,10 +481,88 @@ func (client *FailoverGroupsClient) listByServerHandleResponse(resp *http.Respon return result, nil } +// BeginTryPlannedBeforeForcedFailover - Fails over from the current primary server to this server. This operation tries planned +// before forced failover but might still result in data loss. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-11-01-preview +// - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure +// Resource Manager API or the portal. +// - serverName - The name of the server. +// - failoverGroupName - The name of the failover group. +// - options - FailoverGroupsClientBeginTryPlannedBeforeForcedFailoverOptions contains the optional parameters for the FailoverGroupsClient.BeginTryPlannedBeforeForcedFailover +// method. +func (client *FailoverGroupsClient) BeginTryPlannedBeforeForcedFailover(ctx context.Context, resourceGroupName string, serverName string, failoverGroupName string, options *FailoverGroupsClientBeginTryPlannedBeforeForcedFailoverOptions) (*runtime.Poller[FailoverGroupsClientTryPlannedBeforeForcedFailoverResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.tryPlannedBeforeForcedFailover(ctx, resourceGroupName, serverName, failoverGroupName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[FailoverGroupsClientTryPlannedBeforeForcedFailoverResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[FailoverGroupsClientTryPlannedBeforeForcedFailoverResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// TryPlannedBeforeForcedFailover - Fails over from the current primary server to this server. This operation tries planned +// before forced failover but might still result in data loss. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-11-01-preview +func (client *FailoverGroupsClient) tryPlannedBeforeForcedFailover(ctx context.Context, resourceGroupName string, serverName string, failoverGroupName string, options *FailoverGroupsClientBeginTryPlannedBeforeForcedFailoverOptions) (*http.Response, error) { + var err error + req, err := client.tryPlannedBeforeForcedFailoverCreateRequest(ctx, resourceGroupName, serverName, failoverGroupName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// tryPlannedBeforeForcedFailoverCreateRequest creates the TryPlannedBeforeForcedFailover request. +func (client *FailoverGroupsClient) tryPlannedBeforeForcedFailoverCreateRequest(ctx context.Context, resourceGroupName string, serverName string, failoverGroupName string, options *FailoverGroupsClientBeginTryPlannedBeforeForcedFailoverOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/failoverGroups/{failoverGroupName}/tryPlannedBeforeForcedFailover" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serverName == "" { + return nil, errors.New("parameter serverName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serverName}", url.PathEscape(serverName)) + if failoverGroupName == "" { + return nil, errors.New("parameter failoverGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{failoverGroupName}", url.PathEscape(failoverGroupName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + // BeginUpdate - Updates a failover group. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server containing the failover group. @@ -481,7 +576,8 @@ func (client *FailoverGroupsClient) BeginUpdate(ctx context.Context, resourceGro if err != nil { return nil, err } - return runtime.NewPoller[FailoverGroupsClientUpdateResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[FailoverGroupsClientUpdateResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[FailoverGroupsClientUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -490,20 +586,22 @@ func (client *FailoverGroupsClient) BeginUpdate(ctx context.Context, resourceGro // Update - Updates a failover group. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview func (client *FailoverGroupsClient) update(ctx context.Context, resourceGroupName string, serverName string, failoverGroupName string, parameters FailoverGroupUpdate, options *FailoverGroupsClientBeginUpdateOptions) (*http.Response, error) { + var err error req, err := client.updateCreateRequest(ctx, resourceGroupName, serverName, failoverGroupName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // updateCreateRequest creates the Update request. @@ -530,8 +628,11 @@ func (client *FailoverGroupsClient) updateCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } diff --git a/sdk/resourcemanager/sql/armsql/failovergroups_client_example_test.go b/sdk/resourcemanager/sql/armsql/failovergroups_client_example_test.go deleted file mode 100644 index 9a9b93051ff6..000000000000 --- a/sdk/resourcemanager/sql/armsql/failovergroups_client_example_test.go +++ /dev/null @@ -1,388 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsql_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sql/armsql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/FailoverGroupGet.json -func ExampleFailoverGroupsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewFailoverGroupsClient().Get(ctx, "Default", "failover-group-primary-server", "failover-group-test", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.FailoverGroup = armsql.FailoverGroup{ - // Name: to.Ptr("failover-group-test"), - // Type: to.Ptr("Microsoft.Sql/servers/failoverGroups"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/servers/failover-group-primary-server/failoverGroups/failover-group-test"), - // Location: to.Ptr("Japan East"), - // Properties: &armsql.FailoverGroupProperties{ - // Databases: []*string{ - // }, - // PartnerServers: []*armsql.PartnerInfo{ - // { - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/servers/failover-group-secondary-server"), - // Location: to.Ptr("Japan West"), - // ReplicationRole: to.Ptr(armsql.FailoverGroupReplicationRoleSecondary), - // }}, - // ReadOnlyEndpoint: &armsql.FailoverGroupReadOnlyEndpoint{ - // FailoverPolicy: to.Ptr(armsql.ReadOnlyEndpointFailoverPolicyDisabled), - // }, - // ReadWriteEndpoint: &armsql.FailoverGroupReadWriteEndpoint{ - // FailoverPolicy: to.Ptr(armsql.ReadWriteEndpointFailoverPolicyAutomatic), - // FailoverWithDataLossGracePeriodMinutes: to.Ptr[int32](480), - // }, - // ReplicationRole: to.Ptr(armsql.FailoverGroupReplicationRolePrimary), - // ReplicationState: to.Ptr("CATCH_UP"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/FailoverGroupCreateOrUpdate.json -func ExampleFailoverGroupsClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewFailoverGroupsClient().BeginCreateOrUpdate(ctx, "Default", "failover-group-primary-server", "failover-group-test-3", armsql.FailoverGroup{ - Properties: &armsql.FailoverGroupProperties{ - Databases: []*string{ - to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/servers/failover-group-primary-server/databases/testdb-1"), - to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/servers/failover-group-primary-server/databases/testdb-2")}, - PartnerServers: []*armsql.PartnerInfo{ - { - ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/servers/failover-group-secondary-server"), - }}, - ReadOnlyEndpoint: &armsql.FailoverGroupReadOnlyEndpoint{ - FailoverPolicy: to.Ptr(armsql.ReadOnlyEndpointFailoverPolicyDisabled), - }, - ReadWriteEndpoint: &armsql.FailoverGroupReadWriteEndpoint{ - FailoverPolicy: to.Ptr(armsql.ReadWriteEndpointFailoverPolicyAutomatic), - FailoverWithDataLossGracePeriodMinutes: to.Ptr[int32](480), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.FailoverGroup = armsql.FailoverGroup{ - // Name: to.Ptr("failover-group-test-3"), - // Type: to.Ptr("Microsoft.Sql/servers/failoverGroups"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/servers/failover-group-primary-server/failoverGroups/failover-group-test-3"), - // Location: to.Ptr("Japan East"), - // Properties: &armsql.FailoverGroupProperties{ - // Databases: []*string{ - // to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/servers/failover-group-primary-server/databases/testdb-1"), - // to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/servers/failover-group-primary-server/databases/testdb-2")}, - // PartnerServers: []*armsql.PartnerInfo{ - // { - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/servers/failover-group-secondary-server"), - // Location: to.Ptr("Japan West"), - // ReplicationRole: to.Ptr(armsql.FailoverGroupReplicationRoleSecondary), - // }}, - // ReadOnlyEndpoint: &armsql.FailoverGroupReadOnlyEndpoint{ - // FailoverPolicy: to.Ptr(armsql.ReadOnlyEndpointFailoverPolicyDisabled), - // }, - // ReadWriteEndpoint: &armsql.FailoverGroupReadWriteEndpoint{ - // FailoverPolicy: to.Ptr(armsql.ReadWriteEndpointFailoverPolicyAutomatic), - // FailoverWithDataLossGracePeriodMinutes: to.Ptr[int32](480), - // }, - // ReplicationRole: to.Ptr(armsql.FailoverGroupReplicationRolePrimary), - // ReplicationState: to.Ptr("CATCH_UP"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/FailoverGroupDelete.json -func ExampleFailoverGroupsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewFailoverGroupsClient().BeginDelete(ctx, "Default", "failover-group-primary-server", "failover-group-test-1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/FailoverGroupUpdate.json -func ExampleFailoverGroupsClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewFailoverGroupsClient().BeginUpdate(ctx, "Default", "failover-group-primary-server", "failover-group-test-1", armsql.FailoverGroupUpdate{ - Properties: &armsql.FailoverGroupUpdateProperties{ - Databases: []*string{ - to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/servers/failover-group-primary-server/databases/testdb-1")}, - ReadWriteEndpoint: &armsql.FailoverGroupReadWriteEndpoint{ - FailoverPolicy: to.Ptr(armsql.ReadWriteEndpointFailoverPolicyAutomatic), - FailoverWithDataLossGracePeriodMinutes: to.Ptr[int32](120), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.FailoverGroup = armsql.FailoverGroup{ - // Name: to.Ptr("failover-group-test-3"), - // Type: to.Ptr("Microsoft.Sql/servers/failoverGroups"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/servers/failover-group-primary-server/failoverGroups/failover-group-test-3"), - // Location: to.Ptr("Japan East"), - // Properties: &armsql.FailoverGroupProperties{ - // Databases: []*string{ - // to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/servers/failover-group-primary-server/databases/testdb-1")}, - // PartnerServers: []*armsql.PartnerInfo{ - // { - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/servers/failover-group-secondary-server"), - // Location: to.Ptr("Japan West"), - // ReplicationRole: to.Ptr(armsql.FailoverGroupReplicationRoleSecondary), - // }}, - // ReadOnlyEndpoint: &armsql.FailoverGroupReadOnlyEndpoint{ - // FailoverPolicy: to.Ptr(armsql.ReadOnlyEndpointFailoverPolicyDisabled), - // }, - // ReadWriteEndpoint: &armsql.FailoverGroupReadWriteEndpoint{ - // FailoverPolicy: to.Ptr(armsql.ReadWriteEndpointFailoverPolicyAutomatic), - // FailoverWithDataLossGracePeriodMinutes: to.Ptr[int32](120), - // }, - // ReplicationRole: to.Ptr(armsql.FailoverGroupReplicationRolePrimary), - // ReplicationState: to.Ptr("CATCH_UP"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/FailoverGroupList.json -func ExampleFailoverGroupsClient_NewListByServerPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewFailoverGroupsClient().NewListByServerPager("Default", "failover-group-primary-server", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.FailoverGroupListResult = armsql.FailoverGroupListResult{ - // Value: []*armsql.FailoverGroup{ - // { - // Name: to.Ptr("failover-group-test"), - // Type: to.Ptr("Microsoft.Sql/servers/failoverGroups"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/servers/failover-group-primary-server/failoverGroups/failover-group-test"), - // Location: to.Ptr("Japan East"), - // Properties: &armsql.FailoverGroupProperties{ - // Databases: []*string{ - // }, - // PartnerServers: []*armsql.PartnerInfo{ - // { - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/servers/failover-group-secondary-server"), - // Location: to.Ptr("Japan West"), - // ReplicationRole: to.Ptr(armsql.FailoverGroupReplicationRoleSecondary), - // }}, - // ReadOnlyEndpoint: &armsql.FailoverGroupReadOnlyEndpoint{ - // FailoverPolicy: to.Ptr(armsql.ReadOnlyEndpointFailoverPolicyDisabled), - // }, - // ReadWriteEndpoint: &armsql.FailoverGroupReadWriteEndpoint{ - // FailoverPolicy: to.Ptr(armsql.ReadWriteEndpointFailoverPolicyAutomatic), - // FailoverWithDataLossGracePeriodMinutes: to.Ptr[int32](480), - // }, - // ReplicationRole: to.Ptr(armsql.FailoverGroupReplicationRolePrimary), - // ReplicationState: to.Ptr("CATCH_UP"), - // }, - // }, - // { - // Name: to.Ptr("failover-group-test-2"), - // Type: to.Ptr("Microsoft.Sql/servers/failoverGroups"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/servers/failover-group-primary-server/failoverGroups/failover-group-test-2"), - // Location: to.Ptr("Japan East"), - // Properties: &armsql.FailoverGroupProperties{ - // Databases: []*string{ - // }, - // PartnerServers: []*armsql.PartnerInfo{ - // { - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/servers/failover-group-secondary-server"), - // Location: to.Ptr("Japan West"), - // ReplicationRole: to.Ptr(armsql.FailoverGroupReplicationRoleSecondary), - // }}, - // ReadOnlyEndpoint: &armsql.FailoverGroupReadOnlyEndpoint{ - // FailoverPolicy: to.Ptr(armsql.ReadOnlyEndpointFailoverPolicyDisabled), - // }, - // ReadWriteEndpoint: &armsql.FailoverGroupReadWriteEndpoint{ - // FailoverPolicy: to.Ptr(armsql.ReadWriteEndpointFailoverPolicyAutomatic), - // FailoverWithDataLossGracePeriodMinutes: to.Ptr[int32](480), - // }, - // ReplicationRole: to.Ptr(armsql.FailoverGroupReplicationRolePrimary), - // ReplicationState: to.Ptr("CATCH_UP"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/FailoverGroupFailover.json -func ExampleFailoverGroupsClient_BeginFailover() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewFailoverGroupsClient().BeginFailover(ctx, "Default", "failover-group-secondary-server", "failover-group-test-3", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.FailoverGroup = armsql.FailoverGroup{ - // Name: to.Ptr("failover-group-test-3"), - // Type: to.Ptr("Microsoft.Sql/servers/failoverGroups"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/servers/failover-group-secondary-server/failoverGroups/failover-group-test-3"), - // Location: to.Ptr("Japan West"), - // Properties: &armsql.FailoverGroupProperties{ - // Databases: []*string{ - // to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/servers/failover-group-secondary-server/databases/testdb-1"), - // to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/servers/failover-group-secondary-server/databases/testdb-2")}, - // PartnerServers: []*armsql.PartnerInfo{ - // { - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/servers/failover-group-primary-server"), - // Location: to.Ptr("Japan East"), - // ReplicationRole: to.Ptr(armsql.FailoverGroupReplicationRoleSecondary), - // }}, - // ReadOnlyEndpoint: &armsql.FailoverGroupReadOnlyEndpoint{ - // FailoverPolicy: to.Ptr(armsql.ReadOnlyEndpointFailoverPolicyDisabled), - // }, - // ReadWriteEndpoint: &armsql.FailoverGroupReadWriteEndpoint{ - // FailoverPolicy: to.Ptr(armsql.ReadWriteEndpointFailoverPolicyAutomatic), - // FailoverWithDataLossGracePeriodMinutes: to.Ptr[int32](120), - // }, - // ReplicationRole: to.Ptr(armsql.FailoverGroupReplicationRolePrimary), - // ReplicationState: to.Ptr("CATCH_UP"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/FailoverGroupForceFailoverAllowDataLoss.json -func ExampleFailoverGroupsClient_BeginForceFailoverAllowDataLoss() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewFailoverGroupsClient().BeginForceFailoverAllowDataLoss(ctx, "Default", "failover-group-secondary-server", "failover-group-test-3", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.FailoverGroup = armsql.FailoverGroup{ - // Name: to.Ptr("failover-group-test-3"), - // Type: to.Ptr("Microsoft.Sql/servers/failoverGroups"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/servers/failover-group-secondary-server/failoverGroups/failover-group-test-3"), - // Location: to.Ptr("Japan West"), - // Properties: &armsql.FailoverGroupProperties{ - // Databases: []*string{ - // to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/servers/failover-group-secondary-server/databases/testdb-1"), - // to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/servers/failover-group-secondary-server/databases/testdb-2")}, - // PartnerServers: []*armsql.PartnerInfo{ - // { - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/servers/failover-group-primary-server"), - // Location: to.Ptr("Japan East"), - // ReplicationRole: to.Ptr(armsql.FailoverGroupReplicationRoleSecondary), - // }}, - // ReadOnlyEndpoint: &armsql.FailoverGroupReadOnlyEndpoint{ - // FailoverPolicy: to.Ptr(armsql.ReadOnlyEndpointFailoverPolicyDisabled), - // }, - // ReadWriteEndpoint: &armsql.FailoverGroupReadWriteEndpoint{ - // FailoverPolicy: to.Ptr(armsql.ReadWriteEndpointFailoverPolicyAutomatic), - // FailoverWithDataLossGracePeriodMinutes: to.Ptr[int32](120), - // }, - // ReplicationRole: to.Ptr(armsql.FailoverGroupReplicationRolePrimary), - // ReplicationState: to.Ptr("CATCH_UP"), - // }, - // } -} diff --git a/sdk/resourcemanager/sql/armsql/firewallrules_client.go b/sdk/resourcemanager/sql/armsql/firewallrules_client.go index 884cbf8bebd5..3165eed55848 100644 --- a/sdk/resourcemanager/sql/armsql/firewallrules_client.go +++ b/sdk/resourcemanager/sql/armsql/firewallrules_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armsql @@ -47,7 +46,7 @@ func NewFirewallRulesClient(subscriptionID string, credential azcore.TokenCreden // CreateOrUpdate - Creates or updates a firewall rule. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -56,18 +55,21 @@ func NewFirewallRulesClient(subscriptionID string, credential azcore.TokenCreden // - options - FirewallRulesClientCreateOrUpdateOptions contains the optional parameters for the FirewallRulesClient.CreateOrUpdate // method. func (client *FirewallRulesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, firewallRuleName string, parameters FirewallRule, options *FirewallRulesClientCreateOrUpdateOptions) (FirewallRulesClientCreateOrUpdateResponse, error) { + var err error req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, serverName, firewallRuleName, parameters, options) if err != nil { return FirewallRulesClientCreateOrUpdateResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return FirewallRulesClientCreateOrUpdateResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { - return FirewallRulesClientCreateOrUpdateResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return FirewallRulesClientCreateOrUpdateResponse{}, err } - return client.createOrUpdateHandleResponse(resp) + resp, err := client.createOrUpdateHandleResponse(httpResp) + return resp, err } // createOrUpdateCreateRequest creates the CreateOrUpdate request. @@ -94,10 +96,13 @@ func (client *FirewallRulesClient) createOrUpdateCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // createOrUpdateHandleResponse handles the CreateOrUpdate response. @@ -112,23 +117,25 @@ func (client *FirewallRulesClient) createOrUpdateHandleResponse(resp *http.Respo // Delete - Deletes a firewall rule. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. // - firewallRuleName - The name of the firewall rule. // - options - FirewallRulesClientDeleteOptions contains the optional parameters for the FirewallRulesClient.Delete method. func (client *FirewallRulesClient) Delete(ctx context.Context, resourceGroupName string, serverName string, firewallRuleName string, options *FirewallRulesClientDeleteOptions) (FirewallRulesClientDeleteResponse, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, serverName, firewallRuleName, options) if err != nil { return FirewallRulesClientDeleteResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return FirewallRulesClientDeleteResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { - return FirewallRulesClientDeleteResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return FirewallRulesClientDeleteResponse{}, err } return FirewallRulesClientDeleteResponse{}, nil } @@ -157,7 +164,7 @@ func (client *FirewallRulesClient) deleteCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -165,25 +172,28 @@ func (client *FirewallRulesClient) deleteCreateRequest(ctx context.Context, reso // Get - Gets a firewall rule. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. // - firewallRuleName - The name of the firewall rule. // - options - FirewallRulesClientGetOptions contains the optional parameters for the FirewallRulesClient.Get method. func (client *FirewallRulesClient) Get(ctx context.Context, resourceGroupName string, serverName string, firewallRuleName string, options *FirewallRulesClientGetOptions) (FirewallRulesClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, serverName, firewallRuleName, options) if err != nil { return FirewallRulesClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return FirewallRulesClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return FirewallRulesClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return FirewallRulesClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -210,7 +220,7 @@ func (client *FirewallRulesClient) getCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -227,7 +237,7 @@ func (client *FirewallRulesClient) getHandleResponse(resp *http.Response) (Firew // NewListByServerPager - Gets a list of firewall rules. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -281,7 +291,7 @@ func (client *FirewallRulesClient) listByServerCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -299,24 +309,27 @@ func (client *FirewallRulesClient) listByServerHandleResponse(resp *http.Respons // Replace - Replaces all firewall rules on the server. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. // - options - FirewallRulesClientReplaceOptions contains the optional parameters for the FirewallRulesClient.Replace method. func (client *FirewallRulesClient) Replace(ctx context.Context, resourceGroupName string, serverName string, parameters FirewallRuleList, options *FirewallRulesClientReplaceOptions) (FirewallRulesClientReplaceResponse, error) { + var err error req, err := client.replaceCreateRequest(ctx, resourceGroupName, serverName, parameters, options) if err != nil { return FirewallRulesClientReplaceResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return FirewallRulesClientReplaceResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return FirewallRulesClientReplaceResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return FirewallRulesClientReplaceResponse{}, err } - return client.replaceHandleResponse(resp) + resp, err := client.replaceHandleResponse(httpResp) + return resp, err } // replaceCreateRequest creates the Replace request. @@ -339,10 +352,13 @@ func (client *FirewallRulesClient) replaceCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // replaceHandleResponse handles the Replace response. diff --git a/sdk/resourcemanager/sql/armsql/firewallrules_client_example_test.go b/sdk/resourcemanager/sql/armsql/firewallrules_client_example_test.go deleted file mode 100644 index 7902fc43b158..000000000000 --- a/sdk/resourcemanager/sql/armsql/firewallrules_client_example_test.go +++ /dev/null @@ -1,235 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsql_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sql/armsql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/FirewallRuleGet.json -func ExampleFirewallRulesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewFirewallRulesClient().Get(ctx, "firewallrulecrudtest-12", "firewallrulecrudtest-6285", "firewallrulecrudtest-2304", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.FirewallRule = armsql.FirewallRule{ - // Name: to.Ptr("firewallrulecrudtest-2304"), - // Type: to.Ptr("Microsoft.Sql/servers/firewallRules"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/firewallrulecrudtest-12/providers/Microsoft.Sql/servers/firewallrulecrudtest-6285/firewallRules/firewallrulecrudtest-2304"), - // Properties: &armsql.ServerFirewallRuleProperties{ - // EndIPAddress: to.Ptr("0.0.0.0"), - // StartIPAddress: to.Ptr("0.0.0.0"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/FirewallRuleCreate.json -func ExampleFirewallRulesClient_CreateOrUpdate_createAFirewallRuleMaxMin() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewFirewallRulesClient().CreateOrUpdate(ctx, "firewallrulecrudtest-12", "firewallrulecrudtest-6285", "firewallrulecrudtest-5370", armsql.FirewallRule{ - Properties: &armsql.ServerFirewallRuleProperties{ - EndIPAddress: to.Ptr("0.0.0.3"), - StartIPAddress: to.Ptr("0.0.0.3"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.FirewallRule = armsql.FirewallRule{ - // Name: to.Ptr("firewallrulecrudtest-5370"), - // Type: to.Ptr("Microsoft.Sql/servers/firewallRules"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/firewallrulecrudtest-12/providers/Microsoft.Sql/servers/firewallrulecrudtest-6285/firewallRules/firewallrulecrudtest-5370"), - // Properties: &armsql.ServerFirewallRuleProperties{ - // EndIPAddress: to.Ptr("0.0.0.3"), - // StartIPAddress: to.Ptr("0.0.0.3"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/FirewallRuleUpdate.json -func ExampleFirewallRulesClient_CreateOrUpdate_updateAFirewallRuleMaxMin() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewFirewallRulesClient().CreateOrUpdate(ctx, "firewallrulecrudtest-12", "firewallrulecrudtest-6285", "firewallrulecrudtest-3927", armsql.FirewallRule{ - Properties: &armsql.ServerFirewallRuleProperties{ - EndIPAddress: to.Ptr("0.0.0.1"), - StartIPAddress: to.Ptr("0.0.0.1"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.FirewallRule = armsql.FirewallRule{ - // Name: to.Ptr("firewallrulecrudtest-3927"), - // Type: to.Ptr("Microsoft.Sql/servers/firewallRules"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/firewallrulecrudtest-12/providers/Microsoft.Sql/servers/firewallrulecrudtest-6285/firewallRules/firewallrulecrudtest-3927"), - // Properties: &armsql.ServerFirewallRuleProperties{ - // EndIPAddress: to.Ptr("0.0.0.1"), - // StartIPAddress: to.Ptr("0.0.0.1"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/FirewallRuleDelete.json -func ExampleFirewallRulesClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewFirewallRulesClient().Delete(ctx, "firewallrulecrudtest-9886", "firewallrulecrudtest-2368", "firewallrulecrudtest-7011", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/FirewallRuleList.json -func ExampleFirewallRulesClient_NewListByServerPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewFirewallRulesClient().NewListByServerPager("firewallrulecrudtest-12", "firewallrulecrudtest-6285", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.FirewallRuleListResult = armsql.FirewallRuleListResult{ - // Value: []*armsql.FirewallRule{ - // { - // Name: to.Ptr("firewallrulecrudtest-2304"), - // Type: to.Ptr("Microsoft.Sql/servers/firewallRules"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/firewallrulecrudtest-12/providers/Microsoft.Sql/servers/firewallrulecrudtest-6285/firewallRules/firewallrulecrudtest-2304"), - // Properties: &armsql.ServerFirewallRuleProperties{ - // EndIPAddress: to.Ptr("0.0.0.0"), - // StartIPAddress: to.Ptr("0.0.0.0"), - // }, - // }, - // { - // Name: to.Ptr("firewallrulecrudtest-3927"), - // Type: to.Ptr("Microsoft.Sql/servers/firewallRules"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/firewallrulecrudtest-12/providers/Microsoft.Sql/servers/firewallrulecrudtest-6285/firewallRules/firewallrulecrudtest-3927"), - // Properties: &armsql.ServerFirewallRuleProperties{ - // EndIPAddress: to.Ptr("0.0.0.1"), - // StartIPAddress: to.Ptr("0.0.0.1"), - // }, - // }, - // { - // Name: to.Ptr("firewallrulecrudtest-5370"), - // Type: to.Ptr("Microsoft.Sql/servers/firewallRules"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/firewallrulecrudtest-12/providers/Microsoft.Sql/servers/firewallrulecrudtest-6285/firewallRules/firewallrulecrudtest-5370"), - // Properties: &armsql.ServerFirewallRuleProperties{ - // EndIPAddress: to.Ptr("0.0.0.3"), - // StartIPAddress: to.Ptr("0.0.0.3"), - // }, - // }, - // { - // Name: to.Ptr("firewallrulecrudtest-5767"), - // Type: to.Ptr("Microsoft.Sql/servers/firewallRules"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/firewallrulecrudtest-12/providers/Microsoft.Sql/servers/firewallrulecrudtest-6285/firewallRules/firewallrulecrudtest-5767"), - // Properties: &armsql.ServerFirewallRuleProperties{ - // EndIPAddress: to.Ptr("0.0.0.2"), - // StartIPAddress: to.Ptr("0.0.0.2"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/FirewallRuleReplace.json -func ExampleFirewallRulesClient_Replace() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewFirewallRulesClient().Replace(ctx, "firewallrulecrudtest-12", "firewallrulecrudtest-6285", armsql.FirewallRuleList{ - Values: []*armsql.FirewallRule{ - { - Name: to.Ptr("firewallrulecrudtest-5370 "), - Properties: &armsql.ServerFirewallRuleProperties{ - EndIPAddress: to.Ptr("100.0.0.0"), - StartIPAddress: to.Ptr("0.0.0.0"), - }, - }}, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.FirewallRule = armsql.FirewallRule{ - // Name: to.Ptr("firewallrulecrudtest-5370"), - // Type: to.Ptr("Microsoft.Sql/servers/firewallRules"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/firewallrulecrudtest-12/providers/Microsoft.Sql/servers/firewallrulecrudtest-6285/firewallRules/firewallrulecrudtest-5370"), - // Properties: &armsql.ServerFirewallRuleProperties{ - // EndIPAddress: to.Ptr("0.0.0.3"), - // StartIPAddress: to.Ptr("0.0.0.3"), - // }, - // } -} diff --git a/sdk/resourcemanager/sql/armsql/geobackuppolicies_client.go b/sdk/resourcemanager/sql/armsql/geobackuppolicies_client.go index c27402527be0..9e98927ae39a 100644 --- a/sdk/resourcemanager/sql/armsql/geobackuppolicies_client.go +++ b/sdk/resourcemanager/sql/armsql/geobackuppolicies_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armsql @@ -44,40 +43,39 @@ func NewGeoBackupPoliciesClient(subscriptionID string, credential azcore.TokenCr return client, nil } -// CreateOrUpdate - Updates a database geo backup policy. +// CreateOrUpdate - Create or update a database default Geo backup policy. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2014-04-01 +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. // - databaseName - The name of the database. -// - geoBackupPolicyName - The name of the geo backup policy. +// - geoBackupPolicyName - The name of the Geo backup policy. This should always be 'Default'. // - parameters - The required parameters for creating or updating the geo backup policy. // - options - GeoBackupPoliciesClientCreateOrUpdateOptions contains the optional parameters for the GeoBackupPoliciesClient.CreateOrUpdate // method. func (client *GeoBackupPoliciesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, databaseName string, geoBackupPolicyName GeoBackupPolicyName, parameters GeoBackupPolicy, options *GeoBackupPoliciesClientCreateOrUpdateOptions) (GeoBackupPoliciesClientCreateOrUpdateResponse, error) { + var err error req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, serverName, databaseName, geoBackupPolicyName, parameters, options) if err != nil { return GeoBackupPoliciesClientCreateOrUpdateResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return GeoBackupPoliciesClientCreateOrUpdateResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { - return GeoBackupPoliciesClientCreateOrUpdateResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return GeoBackupPoliciesClientCreateOrUpdateResponse{}, err } - return client.createOrUpdateHandleResponse(resp) + resp, err := client.createOrUpdateHandleResponse(httpResp) + return resp, err } // createOrUpdateCreateRequest creates the CreateOrUpdate request. func (client *GeoBackupPoliciesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, serverName string, databaseName string, geoBackupPolicyName GeoBackupPolicyName, parameters GeoBackupPolicy, options *GeoBackupPoliciesClientCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/geoBackupPolicies/{geoBackupPolicyName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") } @@ -94,15 +92,22 @@ func (client *GeoBackupPoliciesClient) createOrUpdateCreateRequest(ctx context.C return nil, errors.New("parameter geoBackupPolicyName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{geoBackupPolicyName}", url.PathEscape(string(geoBackupPolicyName))) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2014-04-01") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // createOrUpdateHandleResponse handles the CreateOrUpdate response. @@ -114,38 +119,37 @@ func (client *GeoBackupPoliciesClient) createOrUpdateHandleResponse(resp *http.R return result, nil } -// Get - Gets a geo backup policy. +// Get - Gets a Geo backup policy for the given database resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2014-04-01 +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. // - databaseName - The name of the database. -// - geoBackupPolicyName - The name of the geo backup policy. +// - geoBackupPolicyName - The name of the Geo backup policy. This should always be 'Default'. // - options - GeoBackupPoliciesClientGetOptions contains the optional parameters for the GeoBackupPoliciesClient.Get method. func (client *GeoBackupPoliciesClient) Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string, geoBackupPolicyName GeoBackupPolicyName, options *GeoBackupPoliciesClientGetOptions) (GeoBackupPoliciesClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, serverName, databaseName, geoBackupPolicyName, options) if err != nil { return GeoBackupPoliciesClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return GeoBackupPoliciesClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return GeoBackupPoliciesClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return GeoBackupPoliciesClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. func (client *GeoBackupPoliciesClient) getCreateRequest(ctx context.Context, resourceGroupName string, serverName string, databaseName string, geoBackupPolicyName GeoBackupPolicyName, options *GeoBackupPoliciesClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/geoBackupPolicies/{geoBackupPolicyName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") } @@ -162,12 +166,16 @@ func (client *GeoBackupPoliciesClient) getCreateRequest(ctx context.Context, res return nil, errors.New("parameter geoBackupPolicyName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{geoBackupPolicyName}", url.PathEscape(string(geoBackupPolicyName))) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2014-04-01") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -182,44 +190,46 @@ func (client *GeoBackupPoliciesClient) getHandleResponse(resp *http.Response) (G return result, nil } -// NewListByDatabasePager - Returns a list of geo backup policies. +// NewListPager - Gets a list of Geo backup policies for the given database resource. // -// Generated from API version 2014-04-01 +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. // - databaseName - The name of the database. -// - options - GeoBackupPoliciesClientListByDatabaseOptions contains the optional parameters for the GeoBackupPoliciesClient.NewListByDatabasePager +// - options - GeoBackupPoliciesClientListOptions contains the optional parameters for the GeoBackupPoliciesClient.NewListPager // method. -func (client *GeoBackupPoliciesClient) NewListByDatabasePager(resourceGroupName string, serverName string, databaseName string, options *GeoBackupPoliciesClientListByDatabaseOptions) *runtime.Pager[GeoBackupPoliciesClientListByDatabaseResponse] { - return runtime.NewPager(runtime.PagingHandler[GeoBackupPoliciesClientListByDatabaseResponse]{ - More: func(page GeoBackupPoliciesClientListByDatabaseResponse) bool { - return false +func (client *GeoBackupPoliciesClient) NewListPager(resourceGroupName string, serverName string, databaseName string, options *GeoBackupPoliciesClientListOptions) *runtime.Pager[GeoBackupPoliciesClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[GeoBackupPoliciesClientListResponse]{ + More: func(page GeoBackupPoliciesClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 }, - Fetcher: func(ctx context.Context, page *GeoBackupPoliciesClientListByDatabaseResponse) (GeoBackupPoliciesClientListByDatabaseResponse, error) { - req, err := client.listByDatabaseCreateRequest(ctx, resourceGroupName, serverName, databaseName, options) + Fetcher: func(ctx context.Context, page *GeoBackupPoliciesClientListResponse) (GeoBackupPoliciesClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, serverName, databaseName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } if err != nil { - return GeoBackupPoliciesClientListByDatabaseResponse{}, err + return GeoBackupPoliciesClientListResponse{}, err } resp, err := client.internal.Pipeline().Do(req) if err != nil { - return GeoBackupPoliciesClientListByDatabaseResponse{}, err + return GeoBackupPoliciesClientListResponse{}, err } if !runtime.HasStatusCode(resp, http.StatusOK) { - return GeoBackupPoliciesClientListByDatabaseResponse{}, runtime.NewResponseError(resp) + return GeoBackupPoliciesClientListResponse{}, runtime.NewResponseError(resp) } - return client.listByDatabaseHandleResponse(resp) + return client.listHandleResponse(resp) }, }) } -// listByDatabaseCreateRequest creates the ListByDatabase request. -func (client *GeoBackupPoliciesClient) listByDatabaseCreateRequest(ctx context.Context, resourceGroupName string, serverName string, databaseName string, options *GeoBackupPoliciesClientListByDatabaseOptions) (*policy.Request, error) { +// listCreateRequest creates the List request. +func (client *GeoBackupPoliciesClient) listCreateRequest(ctx context.Context, resourceGroupName string, serverName string, databaseName string, options *GeoBackupPoliciesClientListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/geoBackupPolicies" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") } @@ -232,22 +242,26 @@ func (client *GeoBackupPoliciesClient) listByDatabaseCreateRequest(ctx context.C return nil, errors.New("parameter databaseName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{databaseName}", url.PathEscape(databaseName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2014-04-01") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } -// listByDatabaseHandleResponse handles the ListByDatabase response. -func (client *GeoBackupPoliciesClient) listByDatabaseHandleResponse(resp *http.Response) (GeoBackupPoliciesClientListByDatabaseResponse, error) { - result := GeoBackupPoliciesClientListByDatabaseResponse{} +// listHandleResponse handles the List response. +func (client *GeoBackupPoliciesClient) listHandleResponse(resp *http.Response) (GeoBackupPoliciesClientListResponse, error) { + result := GeoBackupPoliciesClientListResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.GeoBackupPolicyListResult); err != nil { - return GeoBackupPoliciesClientListByDatabaseResponse{}, err + return GeoBackupPoliciesClientListResponse{}, err } return result, nil } diff --git a/sdk/resourcemanager/sql/armsql/geobackuppolicies_client_example_test.go b/sdk/resourcemanager/sql/armsql/geobackuppolicies_client_example_test.go deleted file mode 100644 index bbdf3cfcadee..000000000000 --- a/sdk/resourcemanager/sql/armsql/geobackuppolicies_client_example_test.go +++ /dev/null @@ -1,119 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsql_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sql/armsql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/stable/2014-04-01/examples/GeoBackupPoliciesCreateOrUpdate.json -func ExampleGeoBackupPoliciesClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewGeoBackupPoliciesClient().CreateOrUpdate(ctx, "sqlcrudtest-4799", "sqlcrudtest-5961", "testdw", armsql.GeoBackupPolicyNameDefault, armsql.GeoBackupPolicy{ - Properties: &armsql.GeoBackupPolicyProperties{ - State: to.Ptr(armsql.GeoBackupPolicyStateEnabled), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.GeoBackupPolicy = armsql.GeoBackupPolicy{ - // Name: to.Ptr("Default"), - // Type: to.Ptr("Microsoft.Sql/servers/databases/geoBackupPolicies"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/sqlcrudtest-4799/providers/Microsoft.Sql/servers/sqlcrudtest-5961/databases/testdw/geoBackupPolicies/Default"), - // Properties: &armsql.GeoBackupPolicyProperties{ - // State: to.Ptr(armsql.GeoBackupPolicyStateEnabled), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/stable/2014-04-01/examples/GeoBackupPoliciesGet.json -func ExampleGeoBackupPoliciesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewGeoBackupPoliciesClient().Get(ctx, "sqlcrudtest-4799", "sqlcrudtest-5961", "testdw", armsql.GeoBackupPolicyNameDefault, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.GeoBackupPolicy = armsql.GeoBackupPolicy{ - // Name: to.Ptr("Default"), - // Type: to.Ptr("Microsoft.Sql/servers/databases/geoBackupPolicies"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/sqlcrudtest-4799/providers/Microsoft.Sql/servers/sqlcrudtest-5961/databases/testdw/geoBackupPolicies/Default"), - // Location: to.Ptr("Central US"), - // Properties: &armsql.GeoBackupPolicyProperties{ - // State: to.Ptr(armsql.GeoBackupPolicyStateEnabled), - // StorageType: to.Ptr("Premium"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/stable/2014-04-01/examples/GeoBackupPoliciesList.json -func ExampleGeoBackupPoliciesClient_NewListByDatabasePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewGeoBackupPoliciesClient().NewListByDatabasePager("sqlcrudtest-4799", "sqlcrudtest-5961", "testdw", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.GeoBackupPolicyListResult = armsql.GeoBackupPolicyListResult{ - // Value: []*armsql.GeoBackupPolicy{ - // { - // Name: to.Ptr("Default"), - // Type: to.Ptr("Microsoft.Sql/servers/databases/geoBackupPolicies"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/sqlcrudtest-4799/providers/Microsoft.Sql/servers/sqlcrudtest-5961/databases/testdw/geoBackupPolicies/Default"), - // Location: to.Ptr("Central US"), - // Properties: &armsql.GeoBackupPolicyProperties{ - // State: to.Ptr(armsql.GeoBackupPolicyStateEnabled), - // StorageType: to.Ptr("Premium"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/sql/armsql/go.mod b/sdk/resourcemanager/sql/armsql/go.mod index a7fe91f9b406..12e809b47cea 100644 --- a/sdk/resourcemanager/sql/armsql/go.mod +++ b/sdk/resourcemanager/sql/armsql/go.mod @@ -1,23 +1,15 @@ -module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sql/armsql +module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sql/armsql/v2 go 1.18 -require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.2 -) +require github.com/Azure/azure-sdk-for-go/sdk/azcore v1.6.1 require ( - github.com/Azure/azure-sdk-for-go/sdk/internal v1.2.0 // indirect - github.com/AzureAD/microsoft-authentication-library-for-go v0.9.0 // indirect - github.com/golang-jwt/jwt/v4 v4.5.0 // indirect - github.com/google/uuid v1.3.0 // indirect - github.com/kylelemons/godebug v1.1.0 // indirect - github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 // indirect - golang.org/x/crypto v0.6.0 // indirect - golang.org/x/net v0.7.0 // indirect - golang.org/x/sys v0.5.0 // indirect - golang.org/x/text v0.7.0 // indirect + github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 // indirect + github.com/davecgh/go-spew v1.1.1 // indirect + golang.org/x/net v0.8.0 // indirect + golang.org/x/text v0.8.0 // indirect + gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect ) retract v0.6.0 diff --git a/sdk/resourcemanager/sql/armsql/go.sum b/sdk/resourcemanager/sql/armsql/go.sum index 8ba445a8c4da..5c6bee428364 100644 --- a/sdk/resourcemanager/sql/armsql/go.sum +++ b/sdk/resourcemanager/sql/armsql/go.sum @@ -1,31 +1,15 @@ -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0 h1:rTnT/Jrcm+figWlYz4Ixzt0SJVR2cMC8lvZcimipiEY= -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0/go.mod h1:ON4tFdPTwRcgWEaVDrN3584Ef+b7GgSJaXxe5fW9t4M= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.2 h1:uqM+VoHjVH6zdlkLF2b6O0ZANcHoj3rO0PoQ3jglUJA= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.2/go.mod h1:twTKAa1E6hLmSDjLhaCkbTMQKc7p/rNLU40rLxGEOCI= -github.com/Azure/azure-sdk-for-go/sdk/internal v1.2.0 h1:leh5DwKv6Ihwi+h60uHtn6UWAxBbZ0q8DwQVMzf61zw= -github.com/Azure/azure-sdk-for-go/sdk/internal v1.2.0/go.mod h1:eWRD7oawr1Mu1sLCawqVc0CUiF43ia3qQMxLscsKQ9w= -github.com/AzureAD/microsoft-authentication-library-for-go v0.9.0 h1:UE9n9rkJF62ArLb1F3DEjRt8O3jLwMWdSoypKV4f3MU= -github.com/AzureAD/microsoft-authentication-library-for-go v0.9.0/go.mod h1:kgDmCTgBzIEPFElEF+FK0SdjAor06dRq2Go927dnQ6o= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.6.1 h1:SEy2xmstIphdPwNBUi7uhvjyjhVKISfwjfOJmuy7kg4= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.6.1/go.mod h1:bjGvMhVMb+EEm3VRNQawDMUyMMjo+S5ewNjflkep/0Q= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 h1:sXr+ck84g/ZlZUOZiNELInmMgOsuGwdjjVkEIde0OtY= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0/go.mod h1:okt5dMMTOFjX/aovMlrjvvXoPMBVSPzk9185BT0+eZM= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/dnaeon/go-vcr v1.1.0 h1:ReYa/UBrRyQdant9B4fNHGoCNKw6qh6P0fsdGmZpR7c= -github.com/golang-jwt/jwt/v4 v4.5.0 h1:7cYmW1XlMY7h7ii7UhUyChSgS5wUJEnm9uZVTGqOWzg= -github.com/golang-jwt/jwt/v4 v4.5.0/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= -github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= -github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= -github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= -github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 h1:KoWmjvw+nsYOo29YJK9vDA65RGE3NrOnUtO7a+RF9HU= -github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8/go.mod h1:HKlIX3XHQyzLZPlr7++PzdhaXEj94dEiJgZDTsxEqUI= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= -golang.org/x/crypto v0.6.0 h1:qfktjS5LUO+fFKeJXZ+ikTRijMmljikvG68fpMMruSc= -golang.org/x/crypto v0.6.0/go.mod h1:OFC/31mSvZgRz0V1QTNCzfAI1aIRzbiufJtkMIlEp58= -golang.org/x/net v0.7.0 h1:rJrUqqhjsgNp7KqAIc25s9pZnjU7TUcSY7HcVZjdn1g= -golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= -golang.org/x/sys v0.0.0-20210616045830-e2b7044e8c71/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU= -golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/text v0.7.0 h1:4BRB4x83lYWy72KwLD/qYDuTu7q9PjSagHvijDw7cLo= -golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +golang.org/x/net v0.8.0 h1:Zrh2ngAOFYneWTAIAPethzeaQLuHwhuBkuV6ZiRnUaQ= +golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= +golang.org/x/text v0.8.0 h1:57P1ETyNKtuIjB4SRd15iJxuhj8Gc416Y78H3qgMh68= +golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= +gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/resourcemanager/sql/armsql/instancefailovergroups_client.go b/sdk/resourcemanager/sql/armsql/instancefailovergroups_client.go index 4807de1a9144..fd58bbbef6ea 100644 --- a/sdk/resourcemanager/sql/armsql/instancefailovergroups_client.go +++ b/sdk/resourcemanager/sql/armsql/instancefailovergroups_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armsql @@ -47,7 +46,7 @@ func NewInstanceFailoverGroupsClient(subscriptionID string, credential azcore.To // BeginCreateOrUpdate - Creates or updates a failover group. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - locationName - The name of the region where the resource is located. @@ -61,7 +60,8 @@ func (client *InstanceFailoverGroupsClient) BeginCreateOrUpdate(ctx context.Cont if err != nil { return nil, err } - return runtime.NewPoller[InstanceFailoverGroupsClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[InstanceFailoverGroupsClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[InstanceFailoverGroupsClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -70,20 +70,22 @@ func (client *InstanceFailoverGroupsClient) BeginCreateOrUpdate(ctx context.Cont // CreateOrUpdate - Creates or updates a failover group. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview func (client *InstanceFailoverGroupsClient) createOrUpdate(ctx context.Context, resourceGroupName string, locationName string, failoverGroupName string, parameters InstanceFailoverGroup, options *InstanceFailoverGroupsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, locationName, failoverGroupName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createOrUpdateCreateRequest creates the CreateOrUpdate request. @@ -110,16 +112,19 @@ func (client *InstanceFailoverGroupsClient) createOrUpdateCreateRequest(ctx cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // BeginDelete - Deletes a failover group. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - locationName - The name of the region where the resource is located. @@ -132,7 +137,8 @@ func (client *InstanceFailoverGroupsClient) BeginDelete(ctx context.Context, res if err != nil { return nil, err } - return runtime.NewPoller[InstanceFailoverGroupsClientDeleteResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[InstanceFailoverGroupsClientDeleteResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[InstanceFailoverGroupsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -141,20 +147,22 @@ func (client *InstanceFailoverGroupsClient) BeginDelete(ctx context.Context, res // Delete - Deletes a failover group. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview func (client *InstanceFailoverGroupsClient) deleteOperation(ctx context.Context, resourceGroupName string, locationName string, failoverGroupName string, options *InstanceFailoverGroupsClientBeginDeleteOptions) (*http.Response, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, locationName, failoverGroupName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteCreateRequest creates the Delete request. @@ -181,7 +189,7 @@ func (client *InstanceFailoverGroupsClient) deleteCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -189,7 +197,7 @@ func (client *InstanceFailoverGroupsClient) deleteCreateRequest(ctx context.Cont // BeginFailover - Fails over from the current primary managed instance to this managed instance. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - locationName - The name of the region where the resource is located. @@ -202,7 +210,8 @@ func (client *InstanceFailoverGroupsClient) BeginFailover(ctx context.Context, r if err != nil { return nil, err } - return runtime.NewPoller[InstanceFailoverGroupsClientFailoverResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[InstanceFailoverGroupsClientFailoverResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[InstanceFailoverGroupsClientFailoverResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -211,20 +220,22 @@ func (client *InstanceFailoverGroupsClient) BeginFailover(ctx context.Context, r // Failover - Fails over from the current primary managed instance to this managed instance. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview func (client *InstanceFailoverGroupsClient) failover(ctx context.Context, resourceGroupName string, locationName string, failoverGroupName string, options *InstanceFailoverGroupsClientBeginFailoverOptions) (*http.Response, error) { + var err error req, err := client.failoverCreateRequest(ctx, resourceGroupName, locationName, failoverGroupName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // failoverCreateRequest creates the Failover request. @@ -251,7 +262,7 @@ func (client *InstanceFailoverGroupsClient) failoverCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -261,7 +272,7 @@ func (client *InstanceFailoverGroupsClient) failoverCreateRequest(ctx context.Co // might result in data loss. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - locationName - The name of the region where the resource is located. @@ -274,7 +285,8 @@ func (client *InstanceFailoverGroupsClient) BeginForceFailoverAllowDataLoss(ctx if err != nil { return nil, err } - return runtime.NewPoller[InstanceFailoverGroupsClientForceFailoverAllowDataLossResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[InstanceFailoverGroupsClientForceFailoverAllowDataLossResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[InstanceFailoverGroupsClientForceFailoverAllowDataLossResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -284,20 +296,22 @@ func (client *InstanceFailoverGroupsClient) BeginForceFailoverAllowDataLoss(ctx // might result in data loss. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview func (client *InstanceFailoverGroupsClient) forceFailoverAllowDataLoss(ctx context.Context, resourceGroupName string, locationName string, failoverGroupName string, options *InstanceFailoverGroupsClientBeginForceFailoverAllowDataLossOptions) (*http.Response, error) { + var err error req, err := client.forceFailoverAllowDataLossCreateRequest(ctx, resourceGroupName, locationName, failoverGroupName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // forceFailoverAllowDataLossCreateRequest creates the ForceFailoverAllowDataLoss request. @@ -324,7 +338,7 @@ func (client *InstanceFailoverGroupsClient) forceFailoverAllowDataLossCreateRequ return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -333,7 +347,7 @@ func (client *InstanceFailoverGroupsClient) forceFailoverAllowDataLossCreateRequ // Get - Gets a failover group. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - locationName - The name of the region where the resource is located. @@ -341,18 +355,21 @@ func (client *InstanceFailoverGroupsClient) forceFailoverAllowDataLossCreateRequ // - options - InstanceFailoverGroupsClientGetOptions contains the optional parameters for the InstanceFailoverGroupsClient.Get // method. func (client *InstanceFailoverGroupsClient) Get(ctx context.Context, resourceGroupName string, locationName string, failoverGroupName string, options *InstanceFailoverGroupsClientGetOptions) (InstanceFailoverGroupsClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, locationName, failoverGroupName, options) if err != nil { return InstanceFailoverGroupsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return InstanceFailoverGroupsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return InstanceFailoverGroupsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return InstanceFailoverGroupsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -379,7 +396,7 @@ func (client *InstanceFailoverGroupsClient) getCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -396,7 +413,7 @@ func (client *InstanceFailoverGroupsClient) getHandleResponse(resp *http.Respons // NewListByLocationPager - Lists the failover groups in a location. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - locationName - The name of the region where the resource is located. @@ -450,7 +467,7 @@ func (client *InstanceFailoverGroupsClient) listByLocationCreateRequest(ctx cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/sql/armsql/instancefailovergroups_client_example_test.go b/sdk/resourcemanager/sql/armsql/instancefailovergroups_client_example_test.go deleted file mode 100644 index 8a04c7255df9..000000000000 --- a/sdk/resourcemanager/sql/armsql/instancefailovergroups_client_example_test.go +++ /dev/null @@ -1,335 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsql_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sql/armsql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/InstanceFailoverGroupGet.json -func ExampleInstanceFailoverGroupsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewInstanceFailoverGroupsClient().Get(ctx, "Default", "Japan East", "failover-group-test", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.InstanceFailoverGroup = armsql.InstanceFailoverGroup{ - // Name: to.Ptr("failover-group-test-3"), - // Type: to.Ptr("Microsoft.Sql/locations/failoverGroups"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/locations/JapanEast/instanceFailoverGroups/failover-group-test-3"), - // Properties: &armsql.InstanceFailoverGroupProperties{ - // ManagedInstancePairs: []*armsql.ManagedInstancePairInfo{ - // { - // PartnerManagedInstanceID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/managedInstances/failover-group-secondary-mngdInstance"), - // PrimaryManagedInstanceID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/managedInstances/failover-group-primary-mngdInstance"), - // }}, - // PartnerRegions: []*armsql.PartnerRegionInfo{ - // { - // Location: to.Ptr("Japan West"), - // ReplicationRole: to.Ptr(armsql.InstanceFailoverGroupReplicationRoleSecondary), - // }}, - // ReadOnlyEndpoint: &armsql.InstanceFailoverGroupReadOnlyEndpoint{ - // FailoverPolicy: to.Ptr(armsql.ReadOnlyEndpointFailoverPolicyDisabled), - // }, - // ReadWriteEndpoint: &armsql.InstanceFailoverGroupReadWriteEndpoint{ - // FailoverPolicy: to.Ptr(armsql.ReadWriteEndpointFailoverPolicyAutomatic), - // FailoverWithDataLossGracePeriodMinutes: to.Ptr[int32](480), - // }, - // ReplicationRole: to.Ptr(armsql.InstanceFailoverGroupReplicationRolePrimary), - // ReplicationState: to.Ptr("CATCH_UP"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/InstanceFailoverGroupCreateOrUpdate.json -func ExampleInstanceFailoverGroupsClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewInstanceFailoverGroupsClient().BeginCreateOrUpdate(ctx, "Default", "Japan East", "failover-group-test-3", armsql.InstanceFailoverGroup{ - Properties: &armsql.InstanceFailoverGroupProperties{ - ManagedInstancePairs: []*armsql.ManagedInstancePairInfo{ - { - PartnerManagedInstanceID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/managedInstances/failover-group-secondary-mngdInstance"), - PrimaryManagedInstanceID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/managedInstances/failover-group-primary-mngdInstance"), - }}, - PartnerRegions: []*armsql.PartnerRegionInfo{ - { - Location: to.Ptr("Japan West"), - }}, - ReadOnlyEndpoint: &armsql.InstanceFailoverGroupReadOnlyEndpoint{ - FailoverPolicy: to.Ptr(armsql.ReadOnlyEndpointFailoverPolicyDisabled), - }, - ReadWriteEndpoint: &armsql.InstanceFailoverGroupReadWriteEndpoint{ - FailoverPolicy: to.Ptr(armsql.ReadWriteEndpointFailoverPolicyAutomatic), - FailoverWithDataLossGracePeriodMinutes: to.Ptr[int32](480), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.InstanceFailoverGroup = armsql.InstanceFailoverGroup{ - // Name: to.Ptr("failover-group-test-3"), - // Type: to.Ptr("Microsoft.Sql/locations/failoverGroups"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/locations/JapanEast/instanceFailoverGroups/failover-group-test-3"), - // Properties: &armsql.InstanceFailoverGroupProperties{ - // ManagedInstancePairs: []*armsql.ManagedInstancePairInfo{ - // { - // PartnerManagedInstanceID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/managedInstances/failover-group-secondary-mngdInstance"), - // PrimaryManagedInstanceID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/managedInstances/failover-group-primary-mngdInstance"), - // }}, - // PartnerRegions: []*armsql.PartnerRegionInfo{ - // { - // Location: to.Ptr("Japan West"), - // ReplicationRole: to.Ptr(armsql.InstanceFailoverGroupReplicationRoleSecondary), - // }}, - // ReadOnlyEndpoint: &armsql.InstanceFailoverGroupReadOnlyEndpoint{ - // FailoverPolicy: to.Ptr(armsql.ReadOnlyEndpointFailoverPolicyDisabled), - // }, - // ReadWriteEndpoint: &armsql.InstanceFailoverGroupReadWriteEndpoint{ - // FailoverPolicy: to.Ptr(armsql.ReadWriteEndpointFailoverPolicyAutomatic), - // FailoverWithDataLossGracePeriodMinutes: to.Ptr[int32](480), - // }, - // ReplicationRole: to.Ptr(armsql.InstanceFailoverGroupReplicationRolePrimary), - // ReplicationState: to.Ptr("CATCH_UP"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/InstanceFailoverGroupDelete.json -func ExampleInstanceFailoverGroupsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewInstanceFailoverGroupsClient().BeginDelete(ctx, "Default", "Japan East", "failover-group-test-1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/InstanceFailoverGroupList.json -func ExampleInstanceFailoverGroupsClient_NewListByLocationPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewInstanceFailoverGroupsClient().NewListByLocationPager("Default", "Japan East", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.InstanceFailoverGroupListResult = armsql.InstanceFailoverGroupListResult{ - // Value: []*armsql.InstanceFailoverGroup{ - // { - // Name: to.Ptr("failover-group-test"), - // Type: to.Ptr("Microsoft.Sql/locations/failoverGroups"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/locations/JapanEast/instanceFailoverGroups/failover-group-test"), - // Properties: &armsql.InstanceFailoverGroupProperties{ - // ManagedInstancePairs: []*armsql.ManagedInstancePairInfo{ - // { - // PartnerManagedInstanceID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/managedInstances/failover-group-secondary-mngdInstance"), - // PrimaryManagedInstanceID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/managedInstances/failover-group-primary-mngdInstance"), - // }}, - // PartnerRegions: []*armsql.PartnerRegionInfo{ - // { - // Location: to.Ptr("Japan West"), - // ReplicationRole: to.Ptr(armsql.InstanceFailoverGroupReplicationRoleSecondary), - // }}, - // ReadOnlyEndpoint: &armsql.InstanceFailoverGroupReadOnlyEndpoint{ - // FailoverPolicy: to.Ptr(armsql.ReadOnlyEndpointFailoverPolicyDisabled), - // }, - // ReadWriteEndpoint: &armsql.InstanceFailoverGroupReadWriteEndpoint{ - // FailoverPolicy: to.Ptr(armsql.ReadWriteEndpointFailoverPolicyAutomatic), - // FailoverWithDataLossGracePeriodMinutes: to.Ptr[int32](480), - // }, - // ReplicationRole: to.Ptr(armsql.InstanceFailoverGroupReplicationRolePrimary), - // ReplicationState: to.Ptr("CATCH_UP"), - // }, - // }, - // { - // Name: to.Ptr("failover-group-test-1"), - // Type: to.Ptr("Microsoft.Sql/locations/failoverGroups"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/locations/JapanEast/instanceFailoverGroups/failover-group-test-1"), - // Properties: &armsql.InstanceFailoverGroupProperties{ - // ManagedInstancePairs: []*armsql.ManagedInstancePairInfo{ - // { - // PartnerManagedInstanceID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/managedInstances/failover-group-secondary-mngdInstance-1"), - // PrimaryManagedInstanceID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/managedInstances/failover-group-primary-mngdInstance-1"), - // }}, - // PartnerRegions: []*armsql.PartnerRegionInfo{ - // { - // Location: to.Ptr("Japan West"), - // ReplicationRole: to.Ptr(armsql.InstanceFailoverGroupReplicationRoleSecondary), - // }}, - // ReadOnlyEndpoint: &armsql.InstanceFailoverGroupReadOnlyEndpoint{ - // FailoverPolicy: to.Ptr(armsql.ReadOnlyEndpointFailoverPolicyDisabled), - // }, - // ReadWriteEndpoint: &armsql.InstanceFailoverGroupReadWriteEndpoint{ - // FailoverPolicy: to.Ptr(armsql.ReadWriteEndpointFailoverPolicyAutomatic), - // FailoverWithDataLossGracePeriodMinutes: to.Ptr[int32](480), - // }, - // ReplicationRole: to.Ptr(armsql.InstanceFailoverGroupReplicationRolePrimary), - // ReplicationState: to.Ptr("CATCH_UP"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/InstanceFailoverGroupFailover.json -func ExampleInstanceFailoverGroupsClient_BeginFailover() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewInstanceFailoverGroupsClient().BeginFailover(ctx, "Default", "Japan West", "failover-group-test-3", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.InstanceFailoverGroup = armsql.InstanceFailoverGroup{ - // Name: to.Ptr("failover-group-test-3"), - // Type: to.Ptr("Microsoft.Sql/locations/failoverGroups"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/locations/JapanWest/instanceFailoverGroups/failover-group-test-3"), - // Properties: &armsql.InstanceFailoverGroupProperties{ - // ManagedInstancePairs: []*armsql.ManagedInstancePairInfo{ - // { - // PartnerManagedInstanceID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/managedInstances/failover-group-primary-mngdInstance"), - // PrimaryManagedInstanceID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/managedInstances/failover-group-secondary-mngdInstance"), - // }}, - // PartnerRegions: []*armsql.PartnerRegionInfo{ - // { - // Location: to.Ptr("Japan East"), - // ReplicationRole: to.Ptr(armsql.InstanceFailoverGroupReplicationRoleSecondary), - // }}, - // ReadOnlyEndpoint: &armsql.InstanceFailoverGroupReadOnlyEndpoint{ - // FailoverPolicy: to.Ptr(armsql.ReadOnlyEndpointFailoverPolicyDisabled), - // }, - // ReadWriteEndpoint: &armsql.InstanceFailoverGroupReadWriteEndpoint{ - // FailoverPolicy: to.Ptr(armsql.ReadWriteEndpointFailoverPolicyAutomatic), - // FailoverWithDataLossGracePeriodMinutes: to.Ptr[int32](480), - // }, - // ReplicationRole: to.Ptr(armsql.InstanceFailoverGroupReplicationRolePrimary), - // ReplicationState: to.Ptr("CATCH_UP"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/InstanceFailoverGroupForceFailoverAllowDataLoss.json -func ExampleInstanceFailoverGroupsClient_BeginForceFailoverAllowDataLoss() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewInstanceFailoverGroupsClient().BeginForceFailoverAllowDataLoss(ctx, "Default", "Japan West", "failover-group-test-3", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.InstanceFailoverGroup = armsql.InstanceFailoverGroup{ - // Name: to.Ptr("failover-group-test-3"), - // Type: to.Ptr("Microsoft.Sql/locations/failoverGroups"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/locations/JapanWest/instanceFailoverGroups/failover-group-test-3"), - // Properties: &armsql.InstanceFailoverGroupProperties{ - // ManagedInstancePairs: []*armsql.ManagedInstancePairInfo{ - // { - // PartnerManagedInstanceID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/managedInstances/failover-group-primary-mngdInstance"), - // PrimaryManagedInstanceID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/managedInstances/failover-group-secondary-mngdInstance"), - // }}, - // PartnerRegions: []*armsql.PartnerRegionInfo{ - // { - // Location: to.Ptr("Japan East"), - // ReplicationRole: to.Ptr(armsql.InstanceFailoverGroupReplicationRoleSecondary), - // }}, - // ReadOnlyEndpoint: &armsql.InstanceFailoverGroupReadOnlyEndpoint{ - // FailoverPolicy: to.Ptr(armsql.ReadOnlyEndpointFailoverPolicyDisabled), - // }, - // ReadWriteEndpoint: &armsql.InstanceFailoverGroupReadWriteEndpoint{ - // FailoverPolicy: to.Ptr(armsql.ReadWriteEndpointFailoverPolicyAutomatic), - // FailoverWithDataLossGracePeriodMinutes: to.Ptr[int32](480), - // }, - // ReplicationRole: to.Ptr(armsql.InstanceFailoverGroupReplicationRolePrimary), - // ReplicationState: to.Ptr("CATCH_UP"), - // }, - // } -} diff --git a/sdk/resourcemanager/sql/armsql/instancepools_client.go b/sdk/resourcemanager/sql/armsql/instancepools_client.go index e768af7bff7b..699c98f98685 100644 --- a/sdk/resourcemanager/sql/armsql/instancepools_client.go +++ b/sdk/resourcemanager/sql/armsql/instancepools_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armsql @@ -47,7 +46,7 @@ func NewInstancePoolsClient(subscriptionID string, credential azcore.TokenCreden // BeginCreateOrUpdate - Creates or updates an instance pool. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - instancePoolName - The name of the instance pool to be created or updated. @@ -60,7 +59,8 @@ func (client *InstancePoolsClient) BeginCreateOrUpdate(ctx context.Context, reso if err != nil { return nil, err } - return runtime.NewPoller[InstancePoolsClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[InstancePoolsClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[InstancePoolsClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -69,20 +69,22 @@ func (client *InstancePoolsClient) BeginCreateOrUpdate(ctx context.Context, reso // CreateOrUpdate - Creates or updates an instance pool. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview func (client *InstancePoolsClient) createOrUpdate(ctx context.Context, resourceGroupName string, instancePoolName string, parameters InstancePool, options *InstancePoolsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, instancePoolName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createOrUpdateCreateRequest creates the CreateOrUpdate request. @@ -105,16 +107,19 @@ func (client *InstancePoolsClient) createOrUpdateCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // BeginDelete - Deletes an instance pool // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - instancePoolName - The name of the instance pool to be deleted @@ -126,7 +131,8 @@ func (client *InstancePoolsClient) BeginDelete(ctx context.Context, resourceGrou if err != nil { return nil, err } - return runtime.NewPoller[InstancePoolsClientDeleteResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[InstancePoolsClientDeleteResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[InstancePoolsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -135,20 +141,22 @@ func (client *InstancePoolsClient) BeginDelete(ctx context.Context, resourceGrou // Delete - Deletes an instance pool // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview func (client *InstancePoolsClient) deleteOperation(ctx context.Context, resourceGroupName string, instancePoolName string, options *InstancePoolsClientBeginDeleteOptions) (*http.Response, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, instancePoolName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteCreateRequest creates the Delete request. @@ -171,7 +179,7 @@ func (client *InstancePoolsClient) deleteCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -179,24 +187,27 @@ func (client *InstancePoolsClient) deleteCreateRequest(ctx context.Context, reso // Get - Gets an instance pool. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - instancePoolName - The name of the instance pool to be retrieved. // - options - InstancePoolsClientGetOptions contains the optional parameters for the InstancePoolsClient.Get method. func (client *InstancePoolsClient) Get(ctx context.Context, resourceGroupName string, instancePoolName string, options *InstancePoolsClientGetOptions) (InstancePoolsClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, instancePoolName, options) if err != nil { return InstancePoolsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return InstancePoolsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return InstancePoolsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return InstancePoolsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -219,7 +230,7 @@ func (client *InstancePoolsClient) getCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -236,7 +247,7 @@ func (client *InstancePoolsClient) getHandleResponse(resp *http.Response) (Insta // NewListPager - Gets a list of all instance pools in the subscription. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - options - InstancePoolsClientListOptions contains the optional parameters for the InstancePoolsClient.NewListPager method. func (client *InstancePoolsClient) NewListPager(options *InstancePoolsClientListOptions) *runtime.Pager[InstancePoolsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[InstancePoolsClientListResponse]{ @@ -278,7 +289,7 @@ func (client *InstancePoolsClient) listCreateRequest(ctx context.Context, option return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -295,7 +306,7 @@ func (client *InstancePoolsClient) listHandleResponse(resp *http.Response) (Inst // NewListByResourceGroupPager - Gets a list of instance pools in the resource group // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - options - InstancePoolsClientListByResourceGroupOptions contains the optional parameters for the InstancePoolsClient.NewListByResourceGroupPager @@ -344,7 +355,7 @@ func (client *InstancePoolsClient) listByResourceGroupCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -362,7 +373,7 @@ func (client *InstancePoolsClient) listByResourceGroupHandleResponse(resp *http. // BeginUpdate - Updates an instance pool. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - instancePoolName - The name of the instance pool to be updated. @@ -375,7 +386,8 @@ func (client *InstancePoolsClient) BeginUpdate(ctx context.Context, resourceGrou if err != nil { return nil, err } - return runtime.NewPoller[InstancePoolsClientUpdateResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[InstancePoolsClientUpdateResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[InstancePoolsClientUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -384,20 +396,22 @@ func (client *InstancePoolsClient) BeginUpdate(ctx context.Context, resourceGrou // Update - Updates an instance pool. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview func (client *InstancePoolsClient) update(ctx context.Context, resourceGroupName string, instancePoolName string, parameters InstancePoolUpdate, options *InstancePoolsClientBeginUpdateOptions) (*http.Response, error) { + var err error req, err := client.updateCreateRequest(ctx, resourceGroupName, instancePoolName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // updateCreateRequest creates the Update request. @@ -420,8 +434,11 @@ func (client *InstancePoolsClient) updateCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } diff --git a/sdk/resourcemanager/sql/armsql/instancepools_client_example_test.go b/sdk/resourcemanager/sql/armsql/instancepools_client_example_test.go deleted file mode 100644 index 8a368f98ac19..000000000000 --- a/sdk/resourcemanager/sql/armsql/instancepools_client_example_test.go +++ /dev/null @@ -1,370 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsql_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sql/armsql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/GetInstancePool.json -func ExampleInstancePoolsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewInstancePoolsClient().Get(ctx, "group1", "testIP", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.InstancePool = armsql.InstancePool{ - // Name: to.Ptr("testIP"), - // Type: to.Ptr("Microsoft.Sql/instancePools"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/instancePools/testIP"), - // Location: to.Ptr("japaneast"), - // Tags: map[string]*string{ - // "a": to.Ptr("b"), - // }, - // Properties: &armsql.InstancePoolProperties{ - // LicenseType: to.Ptr(armsql.InstancePoolLicenseTypeLicenseIncluded), - // SubnetID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Network/virtualNetwork/myvnet/subnets/mysubnet1"), - // VCores: to.Ptr[int32](8), - // }, - // SKU: &armsql.SKU{ - // Name: to.Ptr("GP_Gen5"), - // Family: to.Ptr("Gen5"), - // Tier: to.Ptr("GeneralPurpose"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/CreateOrUpdateInstancePoolMax.json -func ExampleInstancePoolsClient_BeginCreateOrUpdate_createAnInstancePoolWithAllProperties() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewInstancePoolsClient().BeginCreateOrUpdate(ctx, "group1", "testIP", armsql.InstancePool{ - Location: to.Ptr("japaneast"), - Tags: map[string]*string{ - "a": to.Ptr("b"), - }, - Properties: &armsql.InstancePoolProperties{ - LicenseType: to.Ptr(armsql.InstancePoolLicenseTypeLicenseIncluded), - SubnetID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Network/virtualNetworks/myvnet/subnets/mysubnet1"), - VCores: to.Ptr[int32](8), - }, - SKU: &armsql.SKU{ - Name: to.Ptr("GP_Gen5"), - Family: to.Ptr("Gen5"), - Tier: to.Ptr("GeneralPurpose"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.InstancePool = armsql.InstancePool{ - // Name: to.Ptr("testIP"), - // Type: to.Ptr("Microsoft.Sql/instancePools"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/instancePools/testIP"), - // Location: to.Ptr("japaneast"), - // Tags: map[string]*string{ - // "a": to.Ptr("b"), - // }, - // Properties: &armsql.InstancePoolProperties{ - // LicenseType: to.Ptr(armsql.InstancePoolLicenseTypeLicenseIncluded), - // SubnetID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Network/virtualNetworks/myvnet/subnets/mysubnet1"), - // VCores: to.Ptr[int32](8), - // }, - // SKU: &armsql.SKU{ - // Name: to.Ptr("GP_Gen5"), - // Family: to.Ptr("Gen5"), - // Tier: to.Ptr("GeneralPurpose"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/CreateOrUpdateInstancePoolMin.json -func ExampleInstancePoolsClient_BeginCreateOrUpdate_createAnInstancePoolWithMinProperties() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewInstancePoolsClient().BeginCreateOrUpdate(ctx, "group1", "testIP", armsql.InstancePool{ - Location: to.Ptr("japaneast"), - Properties: &armsql.InstancePoolProperties{ - LicenseType: to.Ptr(armsql.InstancePoolLicenseTypeLicenseIncluded), - SubnetID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Network/virtualNetworks/myvnet/subnets/mysubnet1"), - VCores: to.Ptr[int32](8), - }, - SKU: &armsql.SKU{ - Name: to.Ptr("GP_Gen5"), - Family: to.Ptr("Gen5"), - Tier: to.Ptr("GeneralPurpose"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.InstancePool = armsql.InstancePool{ - // Name: to.Ptr("testIP"), - // Type: to.Ptr("Microsoft.Sql/instancePools"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/instancePools/testIP"), - // Location: to.Ptr("japaneast"), - // Tags: map[string]*string{ - // }, - // Properties: &armsql.InstancePoolProperties{ - // LicenseType: to.Ptr(armsql.InstancePoolLicenseTypeLicenseIncluded), - // SubnetID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Network/virtualNetworks/myvnet/subnets/mysubnet1"), - // VCores: to.Ptr[int32](8), - // }, - // SKU: &armsql.SKU{ - // Name: to.Ptr("GP_Gen5"), - // Family: to.Ptr("Gen5"), - // Tier: to.Ptr("GeneralPurpose"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DeleteInstancePool.json -func ExampleInstancePoolsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewInstancePoolsClient().BeginDelete(ctx, "group1", "testIP", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/PatchInstancePool.json -func ExampleInstancePoolsClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewInstancePoolsClient().BeginUpdate(ctx, "group1", "testIP", armsql.InstancePoolUpdate{ - Tags: map[string]*string{ - "x": to.Ptr("y"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.InstancePool = armsql.InstancePool{ - // Name: to.Ptr("testIP"), - // Type: to.Ptr("Microsoft.Sql/instancePools"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/instancePools/testIP"), - // Location: to.Ptr("japaneast"), - // Tags: map[string]*string{ - // "x": to.Ptr("y"), - // }, - // Properties: &armsql.InstancePoolProperties{ - // LicenseType: to.Ptr(armsql.InstancePoolLicenseTypeLicenseIncluded), - // SubnetID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Network/virtualNetwork/myvnet/subnets/mysubnet1"), - // VCores: to.Ptr[int32](8), - // }, - // SKU: &armsql.SKU{ - // Name: to.Ptr("GP_Gen5"), - // Family: to.Ptr("Gen5"), - // Tier: to.Ptr("GeneralPurpose"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ListInstancePoolsByResourceGroup.json -func ExampleInstancePoolsClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewInstancePoolsClient().NewListByResourceGroupPager("group1", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.InstancePoolListResult = armsql.InstancePoolListResult{ - // Value: []*armsql.InstancePool{ - // { - // Name: to.Ptr("testIP"), - // Type: to.Ptr("Microsoft.Sql/instancePools"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/instancePools/testIP"), - // Location: to.Ptr("japaneast"), - // Tags: map[string]*string{ - // "a": to.Ptr("b"), - // }, - // Properties: &armsql.InstancePoolProperties{ - // LicenseType: to.Ptr(armsql.InstancePoolLicenseTypeLicenseIncluded), - // SubnetID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Network/virtualNetwork/myvnet/subnets/mysubnet1"), - // VCores: to.Ptr[int32](8), - // }, - // SKU: &armsql.SKU{ - // Name: to.Ptr("GP_Gen5"), - // Family: to.Ptr("Gen5"), - // Tier: to.Ptr("GeneralPurpose"), - // }, - // }, - // { - // Name: to.Ptr("testIP2"), - // Type: to.Ptr("Microsoft.Sql/instancePools"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/instancePools/testIP2"), - // Location: to.Ptr("japaneast"), - // Tags: map[string]*string{ - // "a": to.Ptr("b"), - // }, - // Properties: &armsql.InstancePoolProperties{ - // LicenseType: to.Ptr(armsql.InstancePoolLicenseTypeLicenseIncluded), - // SubnetID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Network/virtualNetwork/myvnet/subnets/mysubnet1"), - // VCores: to.Ptr[int32](8), - // }, - // SKU: &armsql.SKU{ - // Name: to.Ptr("GP_Gen5"), - // Family: to.Ptr("Gen5"), - // Tier: to.Ptr("GeneralPurpose"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ListInstancePoolsBySubscriptionId.json -func ExampleInstancePoolsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewInstancePoolsClient().NewListPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.InstancePoolListResult = armsql.InstancePoolListResult{ - // Value: []*armsql.InstancePool{ - // { - // Name: to.Ptr("testIP"), - // Type: to.Ptr("Microsoft.Sql/instancePools"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/instancePools/testIP"), - // Location: to.Ptr("japaneast"), - // Tags: map[string]*string{ - // "a": to.Ptr("b"), - // }, - // Properties: &armsql.InstancePoolProperties{ - // LicenseType: to.Ptr(armsql.InstancePoolLicenseTypeLicenseIncluded), - // SubnetID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Network/virtualNetwork/myvnet/subnets/mysubnet1"), - // VCores: to.Ptr[int32](8), - // }, - // SKU: &armsql.SKU{ - // Name: to.Ptr("GP_Gen5"), - // Family: to.Ptr("Gen5"), - // Tier: to.Ptr("GeneralPurpose"), - // }, - // }, - // { - // Name: to.Ptr("testIP2"), - // Type: to.Ptr("Microsoft.Sql/instancePools"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group2/providers/Microsoft.Sql/instancePools/testIP2"), - // Location: to.Ptr("japaneast"), - // Tags: map[string]*string{ - // "a": to.Ptr("b"), - // }, - // Properties: &armsql.InstancePoolProperties{ - // LicenseType: to.Ptr(armsql.InstancePoolLicenseTypeLicenseIncluded), - // SubnetID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group2/providers/Microsoft.Network/virtualNetwork/myvnet/subnets/mysubnet1"), - // VCores: to.Ptr[int32](8), - // }, - // SKU: &armsql.SKU{ - // Name: to.Ptr("GP_Gen5"), - // Family: to.Ptr("Gen5"), - // Tier: to.Ptr("GeneralPurpose"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/sql/armsql/ipv6firewallrules_client.go b/sdk/resourcemanager/sql/armsql/ipv6firewallrules_client.go index aaf4351c99d1..c0d474157f8f 100644 --- a/sdk/resourcemanager/sql/armsql/ipv6firewallrules_client.go +++ b/sdk/resourcemanager/sql/armsql/ipv6firewallrules_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armsql @@ -47,7 +46,7 @@ func NewIPv6FirewallRulesClient(subscriptionID string, credential azcore.TokenCr // CreateOrUpdate - Creates or updates an IPv6 firewall rule. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -56,18 +55,21 @@ func NewIPv6FirewallRulesClient(subscriptionID string, credential azcore.TokenCr // - options - IPv6FirewallRulesClientCreateOrUpdateOptions contains the optional parameters for the IPv6FirewallRulesClient.CreateOrUpdate // method. func (client *IPv6FirewallRulesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, firewallRuleName string, parameters IPv6FirewallRule, options *IPv6FirewallRulesClientCreateOrUpdateOptions) (IPv6FirewallRulesClientCreateOrUpdateResponse, error) { + var err error req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, serverName, firewallRuleName, parameters, options) if err != nil { return IPv6FirewallRulesClientCreateOrUpdateResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return IPv6FirewallRulesClientCreateOrUpdateResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { - return IPv6FirewallRulesClientCreateOrUpdateResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return IPv6FirewallRulesClientCreateOrUpdateResponse{}, err } - return client.createOrUpdateHandleResponse(resp) + resp, err := client.createOrUpdateHandleResponse(httpResp) + return resp, err } // createOrUpdateCreateRequest creates the CreateOrUpdate request. @@ -94,10 +96,13 @@ func (client *IPv6FirewallRulesClient) createOrUpdateCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // createOrUpdateHandleResponse handles the CreateOrUpdate response. @@ -112,7 +117,7 @@ func (client *IPv6FirewallRulesClient) createOrUpdateHandleResponse(resp *http.R // Delete - Deletes an IPv6 firewall rule. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -120,16 +125,18 @@ func (client *IPv6FirewallRulesClient) createOrUpdateHandleResponse(resp *http.R // - options - IPv6FirewallRulesClientDeleteOptions contains the optional parameters for the IPv6FirewallRulesClient.Delete // method. func (client *IPv6FirewallRulesClient) Delete(ctx context.Context, resourceGroupName string, serverName string, firewallRuleName string, options *IPv6FirewallRulesClientDeleteOptions) (IPv6FirewallRulesClientDeleteResponse, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, serverName, firewallRuleName, options) if err != nil { return IPv6FirewallRulesClientDeleteResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return IPv6FirewallRulesClientDeleteResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { - return IPv6FirewallRulesClientDeleteResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return IPv6FirewallRulesClientDeleteResponse{}, err } return IPv6FirewallRulesClientDeleteResponse{}, nil } @@ -158,7 +165,7 @@ func (client *IPv6FirewallRulesClient) deleteCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -166,25 +173,28 @@ func (client *IPv6FirewallRulesClient) deleteCreateRequest(ctx context.Context, // Get - Gets an IPv6 firewall rule. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. // - firewallRuleName - The name of the firewall rule. // - options - IPv6FirewallRulesClientGetOptions contains the optional parameters for the IPv6FirewallRulesClient.Get method. func (client *IPv6FirewallRulesClient) Get(ctx context.Context, resourceGroupName string, serverName string, firewallRuleName string, options *IPv6FirewallRulesClientGetOptions) (IPv6FirewallRulesClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, serverName, firewallRuleName, options) if err != nil { return IPv6FirewallRulesClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return IPv6FirewallRulesClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return IPv6FirewallRulesClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return IPv6FirewallRulesClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -211,7 +221,7 @@ func (client *IPv6FirewallRulesClient) getCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -228,7 +238,7 @@ func (client *IPv6FirewallRulesClient) getHandleResponse(resp *http.Response) (I // NewListByServerPager - Gets a list of IPv6 firewall rules. // -// Generated from API version 2021-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -282,7 +292,7 @@ func (client *IPv6FirewallRulesClient) listByServerCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/sql/armsql/ipv6firewallrules_client_example_test.go b/sdk/resourcemanager/sql/armsql/ipv6firewallrules_client_example_test.go deleted file mode 100644 index 2ee5f20d7828..000000000000 --- a/sdk/resourcemanager/sql/armsql/ipv6firewallrules_client_example_test.go +++ /dev/null @@ -1,197 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsql_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sql/armsql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/IPv6FirewallRuleList.json -func ExampleIPv6FirewallRulesClient_NewListByServerPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewIPv6FirewallRulesClient().NewListByServerPager("firewallrulecrudtest-12", "firewallrulecrudtest-6285", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.IPv6FirewallRuleListResult = armsql.IPv6FirewallRuleListResult{ - // Value: []*armsql.IPv6FirewallRule{ - // { - // Name: to.Ptr("firewallrulecrudtest-2304"), - // Type: to.Ptr("Microsoft.Sql/servers/ipv6FirewallRules"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/firewallrulecrudtest-12/providers/Microsoft.Sql/servers/firewallrulecrudtest-6285/ipv6FirewallRules/firewallrulecrudtest-2304"), - // Properties: &armsql.IPv6ServerFirewallRuleProperties{ - // EndIPv6Address: to.Ptr("0000:0000:0000:0000:0000:ffff:0000:0000"), - // StartIPv6Address: to.Ptr("0000:0000:0000:0000:0000:ffff:0000:0000"), - // }, - // }, - // { - // Name: to.Ptr("firewallrulecrudtest-3927"), - // Type: to.Ptr("Microsoft.Sql/servers/ipv6FirewallRules"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/firewallrulecrudtest-12/providers/Microsoft.Sql/servers/firewallrulecrudtest-6285/ipv6FirewallRules/firewallrulecrudtest-3927"), - // Properties: &armsql.IPv6ServerFirewallRuleProperties{ - // EndIPv6Address: to.Ptr("0000:0000:0000:0000:0000:ffff:0000:0001"), - // StartIPv6Address: to.Ptr("0000:0000:0000:0000:0000:ffff:0000:0001"), - // }, - // }, - // { - // Name: to.Ptr("firewallrulecrudtest-5370"), - // Type: to.Ptr("Microsoft.Sql/servers/ipv6FirewallRules"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/firewallrulecrudtest-12/providers/Microsoft.Sql/servers/firewallrulecrudtest-6285/ipv6FirewallRules/firewallrulecrudtest-5370"), - // Properties: &armsql.IPv6ServerFirewallRuleProperties{ - // EndIPv6Address: to.Ptr("0000:0000:0000:0000:0000:ffff:0000:0003"), - // StartIPv6Address: to.Ptr("0000:0000:0000:0000:0000:ffff:0000:0003"), - // }, - // }, - // { - // Name: to.Ptr("firewallrulecrudtest-5767"), - // Type: to.Ptr("Microsoft.Sql/servers/ipv6FirewallRules"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/firewallrulecrudtest-12/providers/Microsoft.Sql/servers/firewallrulecrudtest-6285/ipv6FirewallRules/firewallrulecrudtest-5767"), - // Properties: &armsql.IPv6ServerFirewallRuleProperties{ - // EndIPv6Address: to.Ptr("0000:0000:0000:0000:0000:ffff:0000:0002"), - // StartIPv6Address: to.Ptr("0000:0000:0000:0000:0000:ffff:0000:0002"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/IPv6FirewallRuleGet.json -func ExampleIPv6FirewallRulesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewIPv6FirewallRulesClient().Get(ctx, "firewallrulecrudtest-12", "firewallrulecrudtest-6285", "firewallrulecrudtest-2304", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.IPv6FirewallRule = armsql.IPv6FirewallRule{ - // Name: to.Ptr("firewallrulecrudtest-2304"), - // Type: to.Ptr("Microsoft.Sql/servers/ipv6FirewallRules"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/firewallrulecrudtest-12/providers/Microsoft.Sql/servers/firewallrulecrudtest-6285/ipv6FirewallRules/firewallrulecrudtest-2304"), - // Properties: &armsql.IPv6ServerFirewallRuleProperties{ - // EndIPv6Address: to.Ptr("0000:0000:0000:0000:0000:ffff:0000:0000"), - // StartIPv6Address: to.Ptr("0000:0000:0000:0000:0000:ffff:0000:0000"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/IPv6FirewallRuleCreate.json -func ExampleIPv6FirewallRulesClient_CreateOrUpdate_createAnIPv6FirewallRuleMaxMin() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewIPv6FirewallRulesClient().CreateOrUpdate(ctx, "firewallrulecrudtest-12", "firewallrulecrudtest-6285", "firewallrulecrudtest-5370", armsql.IPv6FirewallRule{ - Properties: &armsql.IPv6ServerFirewallRuleProperties{ - EndIPv6Address: to.Ptr("0000:0000:0000:0000:0000:ffff:0000:0003"), - StartIPv6Address: to.Ptr("0000:0000:0000:0000:0000:ffff:0000:0003"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.IPv6FirewallRule = armsql.IPv6FirewallRule{ - // Name: to.Ptr("firewallrulecrudtest-5370"), - // Type: to.Ptr("Microsoft.Sql/servers/ipv6FirewallRules"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/firewallrulecrudtest-12/providers/Microsoft.Sql/servers/firewallrulecrudtest-6285/ipv6FirewallRules/firewallrulecrudtest-5370"), - // Properties: &armsql.IPv6ServerFirewallRuleProperties{ - // EndIPv6Address: to.Ptr("0000:0000:0000:0000:0000:ffff:0000:0003"), - // StartIPv6Address: to.Ptr("0000:0000:0000:0000:0000:ffff:0000:0003"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/IPv6FirewallRuleUpdate.json -func ExampleIPv6FirewallRulesClient_CreateOrUpdate_updateAnIPv6FirewallRuleMaxMin() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewIPv6FirewallRulesClient().CreateOrUpdate(ctx, "firewallrulecrudtest-12", "firewallrulecrudtest-6285", "firewallrulecrudtest-3927", armsql.IPv6FirewallRule{ - Properties: &armsql.IPv6ServerFirewallRuleProperties{ - EndIPv6Address: to.Ptr("0000:0000:0000:0000:0000:ffff:0000:0001"), - StartIPv6Address: to.Ptr("0000:0000:0000:0000:0000:ffff:0000:0001"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.IPv6FirewallRule = armsql.IPv6FirewallRule{ - // Name: to.Ptr("firewallrulecrudtest-3927"), - // Type: to.Ptr("Microsoft.Sql/servers/ipv6FirewallRules"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/firewallrulecrudtest-12/providers/Microsoft.Sql/servers/firewallrulecrudtest-6285/ipv6FirewallRules/firewallrulecrudtest-3927"), - // Properties: &armsql.IPv6ServerFirewallRuleProperties{ - // EndIPv6Address: to.Ptr("0000:0000:0000:0000:0000:ffff:0000:0001"), - // StartIPv6Address: to.Ptr("0000:0000:0000:0000:0000:ffff:0000:0001"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/IPv6FirewallRuleDelete.json -func ExampleIPv6FirewallRulesClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewIPv6FirewallRulesClient().Delete(ctx, "firewallrulecrudtest-9886", "firewallrulecrudtest-2368", "firewallrulecrudtest-7011", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/sql/armsql/jobagents_client.go b/sdk/resourcemanager/sql/armsql/jobagents_client.go index d14d6a9419d8..9a4a0d61902e 100644 --- a/sdk/resourcemanager/sql/armsql/jobagents_client.go +++ b/sdk/resourcemanager/sql/armsql/jobagents_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armsql @@ -47,7 +46,7 @@ func NewJobAgentsClient(subscriptionID string, credential azcore.TokenCredential // BeginCreateOrUpdate - Creates or updates a job agent. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -61,7 +60,8 @@ func (client *JobAgentsClient) BeginCreateOrUpdate(ctx context.Context, resource if err != nil { return nil, err } - return runtime.NewPoller[JobAgentsClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[JobAgentsClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[JobAgentsClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -70,20 +70,22 @@ func (client *JobAgentsClient) BeginCreateOrUpdate(ctx context.Context, resource // CreateOrUpdate - Creates or updates a job agent. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview func (client *JobAgentsClient) createOrUpdate(ctx context.Context, resourceGroupName string, serverName string, jobAgentName string, parameters JobAgent, options *JobAgentsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, serverName, jobAgentName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createOrUpdateCreateRequest creates the CreateOrUpdate request. @@ -110,16 +112,19 @@ func (client *JobAgentsClient) createOrUpdateCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // BeginDelete - Deletes a job agent. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -131,7 +136,8 @@ func (client *JobAgentsClient) BeginDelete(ctx context.Context, resourceGroupNam if err != nil { return nil, err } - return runtime.NewPoller[JobAgentsClientDeleteResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[JobAgentsClientDeleteResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[JobAgentsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -140,20 +146,22 @@ func (client *JobAgentsClient) BeginDelete(ctx context.Context, resourceGroupNam // Delete - Deletes a job agent. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview func (client *JobAgentsClient) deleteOperation(ctx context.Context, resourceGroupName string, serverName string, jobAgentName string, options *JobAgentsClientBeginDeleteOptions) (*http.Response, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, serverName, jobAgentName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteCreateRequest creates the Delete request. @@ -180,7 +188,7 @@ func (client *JobAgentsClient) deleteCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -188,25 +196,28 @@ func (client *JobAgentsClient) deleteCreateRequest(ctx context.Context, resource // Get - Gets a job agent. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. // - jobAgentName - The name of the job agent to be retrieved. // - options - JobAgentsClientGetOptions contains the optional parameters for the JobAgentsClient.Get method. func (client *JobAgentsClient) Get(ctx context.Context, resourceGroupName string, serverName string, jobAgentName string, options *JobAgentsClientGetOptions) (JobAgentsClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, serverName, jobAgentName, options) if err != nil { return JobAgentsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return JobAgentsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return JobAgentsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return JobAgentsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -233,7 +244,7 @@ func (client *JobAgentsClient) getCreateRequest(ctx context.Context, resourceGro return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -250,7 +261,7 @@ func (client *JobAgentsClient) getHandleResponse(resp *http.Response) (JobAgents // NewListByServerPager - Gets a list of job agents in a server. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -304,7 +315,7 @@ func (client *JobAgentsClient) listByServerCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -322,7 +333,7 @@ func (client *JobAgentsClient) listByServerHandleResponse(resp *http.Response) ( // BeginUpdate - Updates a job agent. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -335,7 +346,8 @@ func (client *JobAgentsClient) BeginUpdate(ctx context.Context, resourceGroupNam if err != nil { return nil, err } - return runtime.NewPoller[JobAgentsClientUpdateResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[JobAgentsClientUpdateResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[JobAgentsClientUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -344,20 +356,22 @@ func (client *JobAgentsClient) BeginUpdate(ctx context.Context, resourceGroupNam // Update - Updates a job agent. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview func (client *JobAgentsClient) update(ctx context.Context, resourceGroupName string, serverName string, jobAgentName string, parameters JobAgentUpdate, options *JobAgentsClientBeginUpdateOptions) (*http.Response, error) { + var err error req, err := client.updateCreateRequest(ctx, resourceGroupName, serverName, jobAgentName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // updateCreateRequest creates the Update request. @@ -384,8 +398,11 @@ func (client *JobAgentsClient) updateCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } diff --git a/sdk/resourcemanager/sql/armsql/jobagents_client_example_test.go b/sdk/resourcemanager/sql/armsql/jobagents_client_example_test.go deleted file mode 100644 index e25362cb7d50..000000000000 --- a/sdk/resourcemanager/sql/armsql/jobagents_client_example_test.go +++ /dev/null @@ -1,209 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsql_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sql/armsql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ListJobAgentsByServer.json -func ExampleJobAgentsClient_NewListByServerPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewJobAgentsClient().NewListByServerPager("group1", "server1", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.JobAgentListResult = armsql.JobAgentListResult{ - // Value: []*armsql.JobAgent{ - // { - // Name: to.Ptr("agent1"), - // Type: to.Ptr("Microsoft.Sql/servers/jobAgents"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/jobAgents/agent1"), - // Location: to.Ptr("southeastasia"), - // Properties: &armsql.JobAgentProperties{ - // DatabaseID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/databases/db1"), - // }, - // SKU: &armsql.SKU{ - // Name: to.Ptr("Agent"), - // Capacity: to.Ptr[int32](200), - // }, - // }, - // { - // Name: to.Ptr("jobAgent2"), - // Type: to.Ptr("Microsoft.Sql/servers/jobAgents"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/jobAgents/jobAgent2"), - // Location: to.Ptr("southeastasia"), - // Properties: &armsql.JobAgentProperties{ - // DatabaseID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/databases/db12"), - // }, - // SKU: &armsql.SKU{ - // Name: to.Ptr("Agent"), - // Capacity: to.Ptr[int32](400), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/GetJobAgent.json -func ExampleJobAgentsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewJobAgentsClient().Get(ctx, "group1", "server1", "agent1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.JobAgent = armsql.JobAgent{ - // Name: to.Ptr("agent1"), - // Type: to.Ptr("Microsoft.Sql/servers/jobAgents"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/jobAgents/agent1"), - // Location: to.Ptr("southeastasia"), - // Properties: &armsql.JobAgentProperties{ - // DatabaseID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/databases/db1"), - // }, - // SKU: &armsql.SKU{ - // Name: to.Ptr("Agent"), - // Capacity: to.Ptr[int32](400), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/CreateOrUpdateJobAgent.json -func ExampleJobAgentsClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewJobAgentsClient().BeginCreateOrUpdate(ctx, "group1", "server1", "agent1", armsql.JobAgent{ - Location: to.Ptr("southeastasia"), - Properties: &armsql.JobAgentProperties{ - DatabaseID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/databases/db1"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.JobAgent = armsql.JobAgent{ - // Name: to.Ptr("agent1"), - // Type: to.Ptr("Microsoft.Sql/servers/jobAgents"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/jobAgents/agent1"), - // Location: to.Ptr("southeastasia"), - // Properties: &armsql.JobAgentProperties{ - // DatabaseID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/databases/db1"), - // }, - // SKU: &armsql.SKU{ - // Name: to.Ptr("Agent"), - // Capacity: to.Ptr[int32](100), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DeleteJobAgent.json -func ExampleJobAgentsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewJobAgentsClient().BeginDelete(ctx, "group1", "server1", "agent1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/UpdateJobAgent.json -func ExampleJobAgentsClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewJobAgentsClient().BeginUpdate(ctx, "group1", "server1", "agent1", armsql.JobAgentUpdate{ - Tags: map[string]*string{ - "mytag1": to.Ptr("myvalue1"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.JobAgent = armsql.JobAgent{ - // Name: to.Ptr("agent1"), - // Type: to.Ptr("Microsoft.Sql/servers/jobAgents"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/jobAgents/agent1"), - // Location: to.Ptr("southeastasia"), - // Tags: map[string]*string{ - // "mytag1": to.Ptr("myvalue1"), - // }, - // Properties: &armsql.JobAgentProperties{ - // DatabaseID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/databases/db1"), - // }, - // } -} diff --git a/sdk/resourcemanager/sql/armsql/jobcredentials_client.go b/sdk/resourcemanager/sql/armsql/jobcredentials_client.go index 66c87de4e6f2..dfdfa7c75cde 100644 --- a/sdk/resourcemanager/sql/armsql/jobcredentials_client.go +++ b/sdk/resourcemanager/sql/armsql/jobcredentials_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armsql @@ -47,7 +46,7 @@ func NewJobCredentialsClient(subscriptionID string, credential azcore.TokenCrede // CreateOrUpdate - Creates or updates a job credential. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -57,18 +56,21 @@ func NewJobCredentialsClient(subscriptionID string, credential azcore.TokenCrede // - options - JobCredentialsClientCreateOrUpdateOptions contains the optional parameters for the JobCredentialsClient.CreateOrUpdate // method. func (client *JobCredentialsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, jobAgentName string, credentialName string, parameters JobCredential, options *JobCredentialsClientCreateOrUpdateOptions) (JobCredentialsClientCreateOrUpdateResponse, error) { + var err error req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, serverName, jobAgentName, credentialName, parameters, options) if err != nil { return JobCredentialsClientCreateOrUpdateResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return JobCredentialsClientCreateOrUpdateResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { - return JobCredentialsClientCreateOrUpdateResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return JobCredentialsClientCreateOrUpdateResponse{}, err } - return client.createOrUpdateHandleResponse(resp) + resp, err := client.createOrUpdateHandleResponse(httpResp) + return resp, err } // createOrUpdateCreateRequest creates the CreateOrUpdate request. @@ -99,10 +101,13 @@ func (client *JobCredentialsClient) createOrUpdateCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // createOrUpdateHandleResponse handles the CreateOrUpdate response. @@ -117,7 +122,7 @@ func (client *JobCredentialsClient) createOrUpdateHandleResponse(resp *http.Resp // Delete - Deletes a job credential. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -125,16 +130,18 @@ func (client *JobCredentialsClient) createOrUpdateHandleResponse(resp *http.Resp // - credentialName - The name of the credential. // - options - JobCredentialsClientDeleteOptions contains the optional parameters for the JobCredentialsClient.Delete method. func (client *JobCredentialsClient) Delete(ctx context.Context, resourceGroupName string, serverName string, jobAgentName string, credentialName string, options *JobCredentialsClientDeleteOptions) (JobCredentialsClientDeleteResponse, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, serverName, jobAgentName, credentialName, options) if err != nil { return JobCredentialsClientDeleteResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return JobCredentialsClientDeleteResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { - return JobCredentialsClientDeleteResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return JobCredentialsClientDeleteResponse{}, err } return JobCredentialsClientDeleteResponse{}, nil } @@ -167,7 +174,7 @@ func (client *JobCredentialsClient) deleteCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -175,7 +182,7 @@ func (client *JobCredentialsClient) deleteCreateRequest(ctx context.Context, res // Get - Gets a jobs credential. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -183,18 +190,21 @@ func (client *JobCredentialsClient) deleteCreateRequest(ctx context.Context, res // - credentialName - The name of the credential. // - options - JobCredentialsClientGetOptions contains the optional parameters for the JobCredentialsClient.Get method. func (client *JobCredentialsClient) Get(ctx context.Context, resourceGroupName string, serverName string, jobAgentName string, credentialName string, options *JobCredentialsClientGetOptions) (JobCredentialsClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, serverName, jobAgentName, credentialName, options) if err != nil { return JobCredentialsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return JobCredentialsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return JobCredentialsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return JobCredentialsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -225,7 +235,7 @@ func (client *JobCredentialsClient) getCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -242,7 +252,7 @@ func (client *JobCredentialsClient) getHandleResponse(resp *http.Response) (JobC // NewListByAgentPager - Gets a list of jobs credentials. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -301,7 +311,7 @@ func (client *JobCredentialsClient) listByAgentCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/sql/armsql/jobcredentials_client_example_test.go b/sdk/resourcemanager/sql/armsql/jobcredentials_client_example_test.go deleted file mode 100644 index 02000671a4d9..000000000000 --- a/sdk/resourcemanager/sql/armsql/jobcredentials_client_example_test.go +++ /dev/null @@ -1,141 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsql_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sql/armsql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ListJobCredentialsByAgent.json -func ExampleJobCredentialsClient_NewListByAgentPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewJobCredentialsClient().NewListByAgentPager("group1", "server1", "agent1", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.JobCredentialListResult = armsql.JobCredentialListResult{ - // Value: []*armsql.JobCredential{ - // { - // Name: to.Ptr("cred1"), - // Type: to.Ptr("Microsoft.Sql/servers/jobAccounts/credentials"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/jobAgents/agent1/credentials/cred1"), - // Properties: &armsql.JobCredentialProperties{ - // Username: to.Ptr("myuser"), - // }, - // }, - // { - // Name: to.Ptr("cred2"), - // Type: to.Ptr("Microsoft.Sql/servers/jobAccounts/credentials"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/jobAgents/agent1/credentials/cred2"), - // Properties: &armsql.JobCredentialProperties{ - // Username: to.Ptr("anotherUser"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/GetJobCredential.json -func ExampleJobCredentialsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewJobCredentialsClient().Get(ctx, "group1", "server1", "agent1", "cred1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.JobCredential = armsql.JobCredential{ - // Name: to.Ptr("cred1"), - // Type: to.Ptr("Microsoft.Sql/servers/jobAccounts/credentials"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/jobAgents/agent1/credentials/cred1"), - // Properties: &armsql.JobCredentialProperties{ - // Username: to.Ptr("myuser"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/CreateOrUpdateJobCredential.json -func ExampleJobCredentialsClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewJobCredentialsClient().CreateOrUpdate(ctx, "group1", "server1", "agent1", "cred1", armsql.JobCredential{ - Properties: &armsql.JobCredentialProperties{ - Password: to.Ptr(""), - Username: to.Ptr("myuser"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.JobCredential = armsql.JobCredential{ - // Name: to.Ptr("cred1"), - // Type: to.Ptr("Microsoft.Sql/servers/jobAccounts/credentials"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/jobAgents/agent1/credentials/cred1"), - // Properties: &armsql.JobCredentialProperties{ - // Username: to.Ptr("myuser"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DeleteJobCredential.json -func ExampleJobCredentialsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewJobCredentialsClient().Delete(ctx, "group1", "server1", "agent1", "cred1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/sql/armsql/jobexecutions_client.go b/sdk/resourcemanager/sql/armsql/jobexecutions_client.go index 14ad840770c1..0bd0101533fd 100644 --- a/sdk/resourcemanager/sql/armsql/jobexecutions_client.go +++ b/sdk/resourcemanager/sql/armsql/jobexecutions_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armsql @@ -49,7 +48,7 @@ func NewJobExecutionsClient(subscriptionID string, credential azcore.TokenCreden // Cancel - Requests cancellation of a job execution. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -58,16 +57,18 @@ func NewJobExecutionsClient(subscriptionID string, credential azcore.TokenCreden // - jobExecutionID - The id of the job execution to cancel. // - options - JobExecutionsClientCancelOptions contains the optional parameters for the JobExecutionsClient.Cancel method. func (client *JobExecutionsClient) Cancel(ctx context.Context, resourceGroupName string, serverName string, jobAgentName string, jobName string, jobExecutionID string, options *JobExecutionsClientCancelOptions) (JobExecutionsClientCancelResponse, error) { + var err error req, err := client.cancelCreateRequest(ctx, resourceGroupName, serverName, jobAgentName, jobName, jobExecutionID, options) if err != nil { return JobExecutionsClientCancelResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return JobExecutionsClientCancelResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return JobExecutionsClientCancelResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return JobExecutionsClientCancelResponse{}, err } return JobExecutionsClientCancelResponse{}, nil } @@ -101,7 +102,7 @@ func (client *JobExecutionsClient) cancelCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -109,7 +110,7 @@ func (client *JobExecutionsClient) cancelCreateRequest(ctx context.Context, reso // BeginCreate - Starts an elastic job execution. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -123,7 +124,8 @@ func (client *JobExecutionsClient) BeginCreate(ctx context.Context, resourceGrou if err != nil { return nil, err } - return runtime.NewPoller[JobExecutionsClientCreateResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[JobExecutionsClientCreateResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[JobExecutionsClientCreateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -132,20 +134,22 @@ func (client *JobExecutionsClient) BeginCreate(ctx context.Context, resourceGrou // Create - Starts an elastic job execution. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview func (client *JobExecutionsClient) create(ctx context.Context, resourceGroupName string, serverName string, jobAgentName string, jobName string, options *JobExecutionsClientBeginCreateOptions) (*http.Response, error) { + var err error req, err := client.createCreateRequest(ctx, resourceGroupName, serverName, jobAgentName, jobName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createCreateRequest creates the Create request. @@ -176,7 +180,7 @@ func (client *JobExecutionsClient) createCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -185,7 +189,7 @@ func (client *JobExecutionsClient) createCreateRequest(ctx context.Context, reso // BeginCreateOrUpdate - Creates or updates a job execution. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -200,7 +204,8 @@ func (client *JobExecutionsClient) BeginCreateOrUpdate(ctx context.Context, reso if err != nil { return nil, err } - return runtime.NewPoller[JobExecutionsClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[JobExecutionsClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[JobExecutionsClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -209,20 +214,22 @@ func (client *JobExecutionsClient) BeginCreateOrUpdate(ctx context.Context, reso // CreateOrUpdate - Creates or updates a job execution. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview func (client *JobExecutionsClient) createOrUpdate(ctx context.Context, resourceGroupName string, serverName string, jobAgentName string, jobName string, jobExecutionID string, options *JobExecutionsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, serverName, jobAgentName, jobName, jobExecutionID, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createOrUpdateCreateRequest creates the CreateOrUpdate request. @@ -254,7 +261,7 @@ func (client *JobExecutionsClient) createOrUpdateCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -263,7 +270,7 @@ func (client *JobExecutionsClient) createOrUpdateCreateRequest(ctx context.Conte // Get - Gets a job execution. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -272,18 +279,21 @@ func (client *JobExecutionsClient) createOrUpdateCreateRequest(ctx context.Conte // - jobExecutionID - The id of the job execution // - options - JobExecutionsClientGetOptions contains the optional parameters for the JobExecutionsClient.Get method. func (client *JobExecutionsClient) Get(ctx context.Context, resourceGroupName string, serverName string, jobAgentName string, jobName string, jobExecutionID string, options *JobExecutionsClientGetOptions) (JobExecutionsClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, serverName, jobAgentName, jobName, jobExecutionID, options) if err != nil { return JobExecutionsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return JobExecutionsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return JobExecutionsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return JobExecutionsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -315,7 +325,7 @@ func (client *JobExecutionsClient) getCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -332,7 +342,7 @@ func (client *JobExecutionsClient) getHandleResponse(resp *http.Response) (JobEx // NewListByAgentPager - Lists all executions in a job agent. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -407,12 +417,12 @@ func (client *JobExecutionsClient) listByAgentCreateRequest(ctx context.Context, reqQP.Set("isActive", strconv.FormatBool(*options.IsActive)) } if options != nil && options.Skip != nil { - reqQP.Set("$skip", strconv.FormatInt(int64(*options.Skip), 10)) + reqQP.Set("$skip", strconv.FormatInt(*options.Skip, 10)) } if options != nil && options.Top != nil { - reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) + reqQP.Set("$top", strconv.FormatInt(*options.Top, 10)) } - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -429,7 +439,7 @@ func (client *JobExecutionsClient) listByAgentHandleResponse(resp *http.Response // NewListByJobPager - Lists a job's executions. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -509,12 +519,12 @@ func (client *JobExecutionsClient) listByJobCreateRequest(ctx context.Context, r reqQP.Set("isActive", strconv.FormatBool(*options.IsActive)) } if options != nil && options.Skip != nil { - reqQP.Set("$skip", strconv.FormatInt(int64(*options.Skip), 10)) + reqQP.Set("$skip", strconv.FormatInt(*options.Skip, 10)) } if options != nil && options.Top != nil { - reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) + reqQP.Set("$top", strconv.FormatInt(*options.Top, 10)) } - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/sql/armsql/jobexecutions_client_example_test.go b/sdk/resourcemanager/sql/armsql/jobexecutions_client_example_test.go deleted file mode 100644 index afeba61a9a9a..000000000000 --- a/sdk/resourcemanager/sql/armsql/jobexecutions_client_example_test.go +++ /dev/null @@ -1,355 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsql_test - -import ( - "context" - "log" - - "time" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sql/armsql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ListJobExecutionsByAgentWithFilter.json -func ExampleJobExecutionsClient_NewListByAgentPager_listAllJobExecutionsInAJobAgentWithFiltering() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewJobExecutionsClient().NewListByAgentPager("group1", "server1", "agent1", &armsql.JobExecutionsClientListByAgentOptions{CreateTimeMin: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-03-21T19:00:00Z"); return t }()), - CreateTimeMax: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-03-21T19:05:00Z"); return t }()), - EndTimeMin: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-03-21T19:20:00Z"); return t }()), - EndTimeMax: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-03-21T19:25:00Z"); return t }()), - IsActive: to.Ptr(false), - Skip: nil, - Top: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.JobExecutionListResult = armsql.JobExecutionListResult{ - // Value: []*armsql.JobExecution{ - // { - // Name: to.Ptr("5555-6666-7777-8888-999999999999"), - // Type: to.Ptr("Microsoft.Sql/servers/jobAgents/jobs/executions"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/jobAgents/agent1/jobs/job1/executions/5555-6666-7777-8888-999999999999"), - // Properties: &armsql.JobExecutionProperties{ - // CreateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-03-21T19:02:00.8707045Z"); return t}()), - // CurrentAttemptStartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-03-21T19:12:00.8707045Z"); return t}()), - // CurrentAttempts: to.Ptr[int32](0), - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-03-21T19:22:00.8707045Z"); return t}()), - // JobExecutionID: to.Ptr("5A86BF65-43AC-F258-2524-9E92992F97CA"), - // JobVersion: to.Ptr[int32](1), - // LastMessage: to.Ptr("Job execution created."), - // Lifecycle: to.Ptr(armsql.JobExecutionLifecycleCreated), - // ProvisioningState: to.Ptr(armsql.ProvisioningStateSucceeded), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-03-21T19:12:00.8707045Z"); return t}()), - // }, - // }, - // { - // Name: to.Ptr("aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee"), - // Type: to.Ptr("Microsoft.Sql/servers/jobAgents/jobs/executions"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/jobAgents/agent1/jobs/job2/executions/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee"), - // Properties: &armsql.JobExecutionProperties{ - // CreateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-12-15T19:02:00.8707045Z"); return t}()), - // CurrentAttempts: to.Ptr[int32](1), - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-12-15T19:22:00.8707045Z"); return t}()), - // JobExecutionID: to.Ptr("aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee"), - // JobVersion: to.Ptr[int32](1), - // LastMessage: to.Ptr("Job execution succeeded."), - // Lifecycle: to.Ptr(armsql.JobExecutionLifecycleSucceeded), - // ProvisioningState: to.Ptr(armsql.ProvisioningStateSucceeded), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-12-15T19:12:00.8707045Z"); return t}()), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ListJobExecutionsByAgent.json -func ExampleJobExecutionsClient_NewListByAgentPager_listAllJobExecutionsInAJobAgent() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewJobExecutionsClient().NewListByAgentPager("group1", "server1", "agent1", &armsql.JobExecutionsClientListByAgentOptions{CreateTimeMin: nil, - CreateTimeMax: nil, - EndTimeMin: nil, - EndTimeMax: nil, - IsActive: nil, - Skip: nil, - Top: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.JobExecutionListResult = armsql.JobExecutionListResult{ - // Value: []*armsql.JobExecution{ - // { - // Name: to.Ptr("5555-6666-7777-8888-999999999999"), - // Type: to.Ptr("Microsoft.Sql/servers/jobAgents/jobs/executions"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/jobAgents/agent1/jobs/job1/executions/5555-6666-7777-8888-999999999999"), - // Properties: &armsql.JobExecutionProperties{ - // CreateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-03-21T19:02:00.8707045Z"); return t}()), - // CurrentAttemptStartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-03-21T19:12:00.8707045Z"); return t}()), - // CurrentAttempts: to.Ptr[int32](0), - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-03-21T19:22:00.8707045Z"); return t}()), - // JobExecutionID: to.Ptr("5A86BF65-43AC-F258-2524-9E92992F97CA"), - // JobVersion: to.Ptr[int32](1), - // LastMessage: to.Ptr("Job execution created."), - // Lifecycle: to.Ptr(armsql.JobExecutionLifecycleCreated), - // ProvisioningState: to.Ptr(armsql.ProvisioningStateSucceeded), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-03-21T19:12:00.8707045Z"); return t}()), - // }, - // }, - // { - // Name: to.Ptr("aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee"), - // Type: to.Ptr("Microsoft.Sql/servers/jobAgents/jobs/executions"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/jobAgents/agent1/jobs/job2/executions/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee"), - // Properties: &armsql.JobExecutionProperties{ - // CreateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-12-15T19:02:00.8707045Z"); return t}()), - // CurrentAttempts: to.Ptr[int32](1), - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-12-15T19:22:00.8707045Z"); return t}()), - // JobExecutionID: to.Ptr("aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee"), - // JobVersion: to.Ptr[int32](1), - // LastMessage: to.Ptr("Job execution succeeded."), - // Lifecycle: to.Ptr(armsql.JobExecutionLifecycleSucceeded), - // ProvisioningState: to.Ptr(armsql.ProvisioningStateSucceeded), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-12-15T19:12:00.8707045Z"); return t}()), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/CancelJobExecution.json -func ExampleJobExecutionsClient_Cancel() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewJobExecutionsClient().Cancel(ctx, "group1", "server1", "agent1", "job1", "5A86BF65-43AC-F258-2524-9E92992F97CA", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/CreateJobExecution.json -func ExampleJobExecutionsClient_BeginCreate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewJobExecutionsClient().BeginCreate(ctx, "group1", "server1", "agent1", "job1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.JobExecution = armsql.JobExecution{ - // Name: to.Ptr("5555-6666-7777-8888-999999999999"), - // Type: to.Ptr("Microsoft.Sql/servers/jobAgents/executions"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/jobAgents/agent1/jobs/job1/executions/5555-6666-7777-8888-999999999999"), - // Properties: &armsql.JobExecutionProperties{ - // CreateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2016-09-23T01:00:00Z"); return t}()), - // CurrentAttempts: to.Ptr[int32](0), - // JobExecutionID: to.Ptr("5A86BF65-43AC-F258-2524-9E92992F97CA"), - // JobVersion: to.Ptr[int32](1), - // LastMessage: to.Ptr("Job execution created."), - // Lifecycle: to.Ptr(armsql.JobExecutionLifecycleCreated), - // ProvisioningState: to.Ptr(armsql.ProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ListJobExecutionsByJob.json -func ExampleJobExecutionsClient_NewListByJobPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewJobExecutionsClient().NewListByJobPager("group1", "server1", "agent1", "job1", &armsql.JobExecutionsClientListByJobOptions{CreateTimeMin: nil, - CreateTimeMax: nil, - EndTimeMin: nil, - EndTimeMax: nil, - IsActive: nil, - Skip: nil, - Top: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.JobExecutionListResult = armsql.JobExecutionListResult{ - // Value: []*armsql.JobExecution{ - // { - // Name: to.Ptr("5555-6666-7777-8888-999999999999"), - // Type: to.Ptr("Microsoft.Sql/servers/jobAgents/jobs/executions"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/jobAgents/agent1/jobs/job1/executions/5555-6666-7777-8888-999999999999"), - // Properties: &armsql.JobExecutionProperties{ - // CreateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-03-21T19:02:00.8707045Z"); return t}()), - // CurrentAttemptStartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-03-21T19:12:00.8707045Z"); return t}()), - // CurrentAttempts: to.Ptr[int32](0), - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-03-21T19:22:00.8707045Z"); return t}()), - // JobExecutionID: to.Ptr("5A86BF65-43AC-F258-2524-9E92992F97CA"), - // JobVersion: to.Ptr[int32](1), - // LastMessage: to.Ptr("Job execution created."), - // Lifecycle: to.Ptr(armsql.JobExecutionLifecycleCreated), - // ProvisioningState: to.Ptr(armsql.ProvisioningStateSucceeded), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-03-21T19:12:00.8707045Z"); return t}()), - // }, - // }, - // { - // Name: to.Ptr("aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee"), - // Type: to.Ptr("Microsoft.Sql/servers/jobAgents/jobs/executions"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/jobAgents/agent1/jobs/job1/executions/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee"), - // Properties: &armsql.JobExecutionProperties{ - // CreateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-12-15T19:02:00.8707045Z"); return t}()), - // CurrentAttempts: to.Ptr[int32](1), - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-12-15T19:22:00.8707045Z"); return t}()), - // JobExecutionID: to.Ptr("aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee"), - // JobVersion: to.Ptr[int32](1), - // LastMessage: to.Ptr("Job execution succeeded."), - // Lifecycle: to.Ptr(armsql.JobExecutionLifecycleSucceeded), - // ProvisioningState: to.Ptr(armsql.ProvisioningStateSucceeded), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-12-15T19:12:00.8707045Z"); return t}()), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/GetJobExecution.json -func ExampleJobExecutionsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewJobExecutionsClient().Get(ctx, "group1", "server1", "agent1", "job1", "5A86BF65-43AC-F258-2524-9E92992F97CA", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.JobExecution = armsql.JobExecution{ - // Name: to.Ptr("5555-6666-7777-8888-999999999999"), - // Type: to.Ptr("Microsoft.Sql/servers/jobAgents/executions"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/jobAgents/agent1/jobs/job1/executions/5555-6666-7777-8888-999999999999"), - // Properties: &armsql.JobExecutionProperties{ - // CreateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-12-21T19:02:00.8707045Z"); return t}()), - // CurrentAttemptStartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-11-13T19:12:00.8707045Z"); return t}()), - // CurrentAttempts: to.Ptr[int32](0), - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-12-21T19:22:00.8707045Z"); return t}()), - // JobExecutionID: to.Ptr("5A86BF65-43AC-F258-2524-9E92992F97CA"), - // JobVersion: to.Ptr[int32](1), - // LastMessage: to.Ptr("Job execution created."), - // Lifecycle: to.Ptr(armsql.JobExecutionLifecycleCreated), - // ProvisioningState: to.Ptr(armsql.ProvisioningStateSucceeded), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-12-21T19:12:00.8707045Z"); return t}()), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/CreateOrUpdateJobExecution.json -func ExampleJobExecutionsClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewJobExecutionsClient().BeginCreateOrUpdate(ctx, "group1", "server1", "agent1", "job1", "5A86BF65-43AC-F258-2524-9E92992F97CA", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.JobExecution = armsql.JobExecution{ - // Name: to.Ptr("5555-6666-7777-8888-999999999999"), - // Type: to.Ptr("Microsoft.Sql/servers/jobAgents/executions"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/jobAgents/agent1/jobs/job1/executions/5555-6666-7777-8888-999999999999"), - // Properties: &armsql.JobExecutionProperties{ - // CreateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-12-18T19:02:00.8707045Z"); return t}()), - // CurrentAttempts: to.Ptr[int32](0), - // JobExecutionID: to.Ptr("5A86BF65-43AC-F258-2524-9E92992F97CA"), - // JobVersion: to.Ptr[int32](1), - // LastMessage: to.Ptr("Job execution created."), - // Lifecycle: to.Ptr(armsql.JobExecutionLifecycleCreated), - // ProvisioningState: to.Ptr(armsql.ProvisioningStateSucceeded), - // }, - // } -} diff --git a/sdk/resourcemanager/sql/armsql/jobs_client.go b/sdk/resourcemanager/sql/armsql/jobs_client.go index 2043d5c52aa7..4e149852a8d9 100644 --- a/sdk/resourcemanager/sql/armsql/jobs_client.go +++ b/sdk/resourcemanager/sql/armsql/jobs_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armsql @@ -47,7 +46,7 @@ func NewJobsClient(subscriptionID string, credential azcore.TokenCredential, opt // CreateOrUpdate - Creates or updates a job. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -56,18 +55,21 @@ func NewJobsClient(subscriptionID string, credential azcore.TokenCredential, opt // - parameters - The requested job state. // - options - JobsClientCreateOrUpdateOptions contains the optional parameters for the JobsClient.CreateOrUpdate method. func (client *JobsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, jobAgentName string, jobName string, parameters Job, options *JobsClientCreateOrUpdateOptions) (JobsClientCreateOrUpdateResponse, error) { + var err error req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, serverName, jobAgentName, jobName, parameters, options) if err != nil { return JobsClientCreateOrUpdateResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return JobsClientCreateOrUpdateResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { - return JobsClientCreateOrUpdateResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return JobsClientCreateOrUpdateResponse{}, err } - return client.createOrUpdateHandleResponse(resp) + resp, err := client.createOrUpdateHandleResponse(httpResp) + return resp, err } // createOrUpdateCreateRequest creates the CreateOrUpdate request. @@ -98,10 +100,13 @@ func (client *JobsClient) createOrUpdateCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // createOrUpdateHandleResponse handles the CreateOrUpdate response. @@ -116,7 +121,7 @@ func (client *JobsClient) createOrUpdateHandleResponse(resp *http.Response) (Job // Delete - Deletes a job. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -124,16 +129,18 @@ func (client *JobsClient) createOrUpdateHandleResponse(resp *http.Response) (Job // - jobName - The name of the job to delete. // - options - JobsClientDeleteOptions contains the optional parameters for the JobsClient.Delete method. func (client *JobsClient) Delete(ctx context.Context, resourceGroupName string, serverName string, jobAgentName string, jobName string, options *JobsClientDeleteOptions) (JobsClientDeleteResponse, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, serverName, jobAgentName, jobName, options) if err != nil { return JobsClientDeleteResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return JobsClientDeleteResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { - return JobsClientDeleteResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return JobsClientDeleteResponse{}, err } return JobsClientDeleteResponse{}, nil } @@ -166,7 +173,7 @@ func (client *JobsClient) deleteCreateRequest(ctx context.Context, resourceGroup return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -174,7 +181,7 @@ func (client *JobsClient) deleteCreateRequest(ctx context.Context, resourceGroup // Get - Gets a job. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -182,18 +189,21 @@ func (client *JobsClient) deleteCreateRequest(ctx context.Context, resourceGroup // - jobName - The name of the job to get. // - options - JobsClientGetOptions contains the optional parameters for the JobsClient.Get method. func (client *JobsClient) Get(ctx context.Context, resourceGroupName string, serverName string, jobAgentName string, jobName string, options *JobsClientGetOptions) (JobsClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, serverName, jobAgentName, jobName, options) if err != nil { return JobsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return JobsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return JobsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return JobsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -224,7 +234,7 @@ func (client *JobsClient) getCreateRequest(ctx context.Context, resourceGroupNam return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -241,7 +251,7 @@ func (client *JobsClient) getHandleResponse(resp *http.Response) (JobsClientGetR // NewListByAgentPager - Gets a list of jobs. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -299,7 +309,7 @@ func (client *JobsClient) listByAgentCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/sql/armsql/jobs_client_example_test.go b/sdk/resourcemanager/sql/armsql/jobs_client_example_test.go deleted file mode 100644 index 1b41ff5284e2..000000000000 --- a/sdk/resourcemanager/sql/armsql/jobs_client_example_test.go +++ /dev/null @@ -1,229 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsql_test - -import ( - "context" - "log" - - "time" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sql/armsql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ListJobsByAgent.json -func ExampleJobsClient_NewListByAgentPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewJobsClient().NewListByAgentPager("group1", "server1", "agent1", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.JobListResult = armsql.JobListResult{ - // Value: []*armsql.Job{ - // { - // Name: to.Ptr("job1"), - // Type: to.Ptr("Microsoft.Sql/servers/jobAccounts/jobs"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/jobAgents/agent1/jobs/job1"), - // Properties: &armsql.JobProperties{ - // Description: to.Ptr("my favourite job"), - // Schedule: &armsql.JobSchedule{ - // Type: to.Ptr(armsql.JobScheduleTypeRecurring), - // Enabled: to.Ptr(true), - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-09-24T23:59:59Z"); return t}()), - // Interval: to.Ptr("PT5M"), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-09-24T18:30:01Z"); return t}()), - // }, - // Version: to.Ptr[int32](0), - // }, - // }, - // { - // Name: to.Ptr("job3"), - // Type: to.Ptr("Microsoft.Sql/servers/jobAccounts/jobs"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/jobAgents/agent1/jobs/job3"), - // Properties: &armsql.JobProperties{ - // Description: to.Ptr("this job will be scheduled once"), - // Schedule: &armsql.JobSchedule{ - // Type: to.Ptr(armsql.JobScheduleTypeOnce), - // Enabled: to.Ptr(true), - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-12-27T06:00:00Z"); return t}()), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-07-01T03:45:00Z"); return t}()), - // }, - // Version: to.Ptr[int32](1), - // }, - // }, - // { - // Name: to.Ptr("job2"), - // Type: to.Ptr("Microsoft.Sql/servers/jobAccounts/jobs"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/jobAgents/agent1/jobs/job2"), - // Properties: &armsql.JobProperties{ - // Description: to.Ptr("this job will never be automatically scheduled"), - // Schedule: &armsql.JobSchedule{ - // Type: to.Ptr(armsql.JobScheduleTypeOnce), - // Enabled: to.Ptr(false), - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-12-27T06:00:00Z"); return t}()), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-07-01T03:45:00Z"); return t}()), - // }, - // Version: to.Ptr[int32](1), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/GetJob.json -func ExampleJobsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewJobsClient().Get(ctx, "group1", "server1", "agent1", "job1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Job = armsql.Job{ - // Name: to.Ptr("job1"), - // Type: to.Ptr("Microsoft.Sql/servers/jobAccounts/jobs"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/jobAgents/agent1/jobs/job1"), - // Properties: &armsql.JobProperties{ - // Description: to.Ptr("my favourite job"), - // Schedule: &armsql.JobSchedule{ - // Type: to.Ptr(armsql.JobScheduleTypeOnce), - // Enabled: to.Ptr(true), - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-09-24T23:59:59Z"); return t}()), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-09-24T18:30:01Z"); return t}()), - // }, - // Version: to.Ptr[int32](0), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/CreateOrUpdateJobMax.json -func ExampleJobsClient_CreateOrUpdate_createAJobWithAllPropertiesSpecified() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewJobsClient().CreateOrUpdate(ctx, "group1", "server1", "agent1", "job1", armsql.Job{ - Properties: &armsql.JobProperties{ - Description: to.Ptr("my favourite job"), - Schedule: &armsql.JobSchedule{ - Type: to.Ptr(armsql.JobScheduleTypeRecurring), - Enabled: to.Ptr(true), - EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-09-24T23:59:59Z"); return t }()), - Interval: to.Ptr("PT5M"), - StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-09-24T18:30:01Z"); return t }()), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Job = armsql.Job{ - // Name: to.Ptr("job1"), - // Type: to.Ptr("Microsoft.Sql/servers/jobAccounts/jobs"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/jobAgents/agent1/jobs/job1"), - // Properties: &armsql.JobProperties{ - // Description: to.Ptr("my favourite job"), - // Schedule: &armsql.JobSchedule{ - // Type: to.Ptr(armsql.JobScheduleTypeRecurring), - // Enabled: to.Ptr(true), - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-09-24T23:59:59Z"); return t}()), - // Interval: to.Ptr("PT5M"), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-09-24T18:30:01Z"); return t}()), - // }, - // Version: to.Ptr[int32](0), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/CreateOrUpdateJobMin.json -func ExampleJobsClient_CreateOrUpdate_createAJobWithDefaultProperties() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewJobsClient().CreateOrUpdate(ctx, "group1", "server1", "agent1", "job1", armsql.Job{}, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Job = armsql.Job{ - // Name: to.Ptr("job1"), - // Type: to.Ptr("Microsoft.Sql/servers/jobAccounts/jobs"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/jobAgents/agent1/jobs/job1"), - // Properties: &armsql.JobProperties{ - // Description: to.Ptr(""), - // Schedule: &armsql.JobSchedule{ - // Type: to.Ptr(armsql.JobScheduleTypeOnce), - // Enabled: to.Ptr(false), - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "9999-12-31T11:59:59Z"); return t}()), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "0001-01-01T00:00:00Z"); return t}()), - // }, - // Version: to.Ptr[int32](0), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DeleteJob.json -func ExampleJobsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewJobsClient().Delete(ctx, "group1", "server1", "agent1", "job1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/sql/armsql/jobstepexecutions_client.go b/sdk/resourcemanager/sql/armsql/jobstepexecutions_client.go index 2276c0b56ce5..9f067aff33c3 100644 --- a/sdk/resourcemanager/sql/armsql/jobstepexecutions_client.go +++ b/sdk/resourcemanager/sql/armsql/jobstepexecutions_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armsql @@ -49,7 +48,7 @@ func NewJobStepExecutionsClient(subscriptionID string, credential azcore.TokenCr // Get - Gets a step execution of a job execution. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -59,18 +58,21 @@ func NewJobStepExecutionsClient(subscriptionID string, credential azcore.TokenCr // - stepName - The name of the step. // - options - JobStepExecutionsClientGetOptions contains the optional parameters for the JobStepExecutionsClient.Get method. func (client *JobStepExecutionsClient) Get(ctx context.Context, resourceGroupName string, serverName string, jobAgentName string, jobName string, jobExecutionID string, stepName string, options *JobStepExecutionsClientGetOptions) (JobStepExecutionsClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, serverName, jobAgentName, jobName, jobExecutionID, stepName, options) if err != nil { return JobStepExecutionsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return JobStepExecutionsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return JobStepExecutionsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return JobStepExecutionsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -106,7 +108,7 @@ func (client *JobStepExecutionsClient) getCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -123,7 +125,7 @@ func (client *JobStepExecutionsClient) getHandleResponse(resp *http.Response) (J // NewListByJobExecutionPager - Lists the step executions of a job execution. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -205,12 +207,12 @@ func (client *JobStepExecutionsClient) listByJobExecutionCreateRequest(ctx conte reqQP.Set("isActive", strconv.FormatBool(*options.IsActive)) } if options != nil && options.Skip != nil { - reqQP.Set("$skip", strconv.FormatInt(int64(*options.Skip), 10)) + reqQP.Set("$skip", strconv.FormatInt(*options.Skip, 10)) } if options != nil && options.Top != nil { - reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) + reqQP.Set("$top", strconv.FormatInt(*options.Top, 10)) } - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/sql/armsql/jobstepexecutions_client_example_test.go b/sdk/resourcemanager/sql/armsql/jobstepexecutions_client_example_test.go deleted file mode 100644 index 79d82521c605..000000000000 --- a/sdk/resourcemanager/sql/armsql/jobstepexecutions_client_example_test.go +++ /dev/null @@ -1,111 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsql_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sql/armsql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ListJobExecutionSteps.json -func ExampleJobStepExecutionsClient_NewListByJobExecutionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewJobStepExecutionsClient().NewListByJobExecutionPager("group1", "server1", "agent1", "job1", "5A86BF65-43AC-F258-2524-9E92992F97CA", &armsql.JobStepExecutionsClientListByJobExecutionOptions{CreateTimeMin: nil, - CreateTimeMax: nil, - EndTimeMin: nil, - EndTimeMax: nil, - IsActive: nil, - Skip: nil, - Top: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.JobExecutionListResult = armsql.JobExecutionListResult{ - // Value: []*armsql.JobExecution{ - // { - // Name: to.Ptr("step1"), - // Type: to.Ptr("Microsoft.Sql/servers/jobAgents/jobs/executions/steps"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/jobAgents/agent1/jobs/job1/executions/5555-6666-7777-8888-999999999999/steps/step1"), - // Properties: &armsql.JobExecutionProperties{ - // CreateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-12-03T04:33:15.7189151Z"); return t}()), - // CurrentAttemptStartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-12-03T04:33:17.4840068Z"); return t}()), - // CurrentAttempts: to.Ptr[int32](1), - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-12-03T04:33:19.0600862Z"); return t}()), - // JobExecutionID: to.Ptr("5A86BF65-43AC-F258-2524-9E92992F97CA"), - // JobVersion: to.Ptr[int32](1), - // LastMessage: to.Ptr("Step 1 succeeded."), - // Lifecycle: to.Ptr(armsql.JobExecutionLifecycleSucceeded), - // ProvisioningState: to.Ptr(armsql.ProvisioningStateSucceeded), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-12-03T04:33:16.176937Z"); return t}()), - // StepID: to.Ptr[int32](1), - // StepName: to.Ptr("step1"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/GetJobExecutionStep.json -func ExampleJobStepExecutionsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewJobStepExecutionsClient().Get(ctx, "group1", "server1", "agent1", "job1", "5A86BF65-43AC-F258-2524-9E92992F97CA", "step1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.JobExecution = armsql.JobExecution{ - // Name: to.Ptr("step1"), - // Type: to.Ptr("Microsoft.Sql/servers/jobAgents/jobs/executions/steps"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/jobAgents/agent1/jobs/job1/executions/5555-6666-7777-8888-999999999999/steps/step1"), - // Properties: &armsql.JobExecutionProperties{ - // CreateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-12-27T04:33:15.7189151Z"); return t}()), - // CurrentAttemptStartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-12-27T04:33:17.4840068Z"); return t}()), - // CurrentAttempts: to.Ptr[int32](1), - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-12-27T04:33:19.0600862Z"); return t}()), - // JobExecutionID: to.Ptr("5A86BF65-43AC-F258-2524-9E92992F97CA"), - // JobVersion: to.Ptr[int32](1), - // LastMessage: to.Ptr("Step 1 succeeded."), - // Lifecycle: to.Ptr(armsql.JobExecutionLifecycleSucceeded), - // ProvisioningState: to.Ptr(armsql.ProvisioningStateSucceeded), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-12-27T04:33:16.176937Z"); return t}()), - // StepID: to.Ptr[int32](1), - // StepName: to.Ptr("step1"), - // }, - // } -} diff --git a/sdk/resourcemanager/sql/armsql/jobsteps_client.go b/sdk/resourcemanager/sql/armsql/jobsteps_client.go index 224ea9f9cfa2..3f486b9e61ec 100644 --- a/sdk/resourcemanager/sql/armsql/jobsteps_client.go +++ b/sdk/resourcemanager/sql/armsql/jobsteps_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armsql @@ -48,7 +47,7 @@ func NewJobStepsClient(subscriptionID string, credential azcore.TokenCredential, // CreateOrUpdate - Creates or updates a job step. This will implicitly create a new job version. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -58,18 +57,21 @@ func NewJobStepsClient(subscriptionID string, credential azcore.TokenCredential, // - parameters - The requested state of the job step. // - options - JobStepsClientCreateOrUpdateOptions contains the optional parameters for the JobStepsClient.CreateOrUpdate method. func (client *JobStepsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, jobAgentName string, jobName string, stepName string, parameters JobStep, options *JobStepsClientCreateOrUpdateOptions) (JobStepsClientCreateOrUpdateResponse, error) { + var err error req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, serverName, jobAgentName, jobName, stepName, parameters, options) if err != nil { return JobStepsClientCreateOrUpdateResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return JobStepsClientCreateOrUpdateResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { - return JobStepsClientCreateOrUpdateResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return JobStepsClientCreateOrUpdateResponse{}, err } - return client.createOrUpdateHandleResponse(resp) + resp, err := client.createOrUpdateHandleResponse(httpResp) + return resp, err } // createOrUpdateCreateRequest creates the CreateOrUpdate request. @@ -104,10 +106,13 @@ func (client *JobStepsClient) createOrUpdateCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // createOrUpdateHandleResponse handles the CreateOrUpdate response. @@ -122,7 +127,7 @@ func (client *JobStepsClient) createOrUpdateHandleResponse(resp *http.Response) // Delete - Deletes a job step. This will implicitly create a new job version. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -131,16 +136,18 @@ func (client *JobStepsClient) createOrUpdateHandleResponse(resp *http.Response) // - stepName - The name of the job step to delete. // - options - JobStepsClientDeleteOptions contains the optional parameters for the JobStepsClient.Delete method. func (client *JobStepsClient) Delete(ctx context.Context, resourceGroupName string, serverName string, jobAgentName string, jobName string, stepName string, options *JobStepsClientDeleteOptions) (JobStepsClientDeleteResponse, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, serverName, jobAgentName, jobName, stepName, options) if err != nil { return JobStepsClientDeleteResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return JobStepsClientDeleteResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { - return JobStepsClientDeleteResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return JobStepsClientDeleteResponse{}, err } return JobStepsClientDeleteResponse{}, nil } @@ -177,7 +184,7 @@ func (client *JobStepsClient) deleteCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -185,7 +192,7 @@ func (client *JobStepsClient) deleteCreateRequest(ctx context.Context, resourceG // Get - Gets a job step in a job's current version. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -194,18 +201,21 @@ func (client *JobStepsClient) deleteCreateRequest(ctx context.Context, resourceG // - stepName - The name of the job step. // - options - JobStepsClientGetOptions contains the optional parameters for the JobStepsClient.Get method. func (client *JobStepsClient) Get(ctx context.Context, resourceGroupName string, serverName string, jobAgentName string, jobName string, stepName string, options *JobStepsClientGetOptions) (JobStepsClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, serverName, jobAgentName, jobName, stepName, options) if err != nil { return JobStepsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return JobStepsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return JobStepsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return JobStepsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -240,7 +250,7 @@ func (client *JobStepsClient) getCreateRequest(ctx context.Context, resourceGrou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -258,7 +268,7 @@ func (client *JobStepsClient) getHandleResponse(resp *http.Response) (JobStepsCl // GetByVersion - Gets the specified version of a job step. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -268,18 +278,21 @@ func (client *JobStepsClient) getHandleResponse(resp *http.Response) (JobStepsCl // - stepName - The name of the job step. // - options - JobStepsClientGetByVersionOptions contains the optional parameters for the JobStepsClient.GetByVersion method. func (client *JobStepsClient) GetByVersion(ctx context.Context, resourceGroupName string, serverName string, jobAgentName string, jobName string, jobVersion int32, stepName string, options *JobStepsClientGetByVersionOptions) (JobStepsClientGetByVersionResponse, error) { + var err error req, err := client.getByVersionCreateRequest(ctx, resourceGroupName, serverName, jobAgentName, jobName, jobVersion, stepName, options) if err != nil { return JobStepsClientGetByVersionResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return JobStepsClientGetByVersionResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return JobStepsClientGetByVersionResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return JobStepsClientGetByVersionResponse{}, err } - return client.getByVersionHandleResponse(resp) + resp, err := client.getByVersionHandleResponse(httpResp) + return resp, err } // getByVersionCreateRequest creates the GetByVersion request. @@ -315,7 +328,7 @@ func (client *JobStepsClient) getByVersionCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -332,7 +345,7 @@ func (client *JobStepsClient) getByVersionHandleResponse(resp *http.Response) (J // NewListByJobPager - Gets all job steps for a job's current version. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -395,7 +408,7 @@ func (client *JobStepsClient) listByJobCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -412,7 +425,7 @@ func (client *JobStepsClient) listByJobHandleResponse(resp *http.Response) (JobS // NewListByVersionPager - Gets all job steps in the specified job version. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -478,7 +491,7 @@ func (client *JobStepsClient) listByVersionCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/sql/armsql/jobsteps_client_example_test.go b/sdk/resourcemanager/sql/armsql/jobsteps_client_example_test.go deleted file mode 100644 index f7702126f9a4..000000000000 --- a/sdk/resourcemanager/sql/armsql/jobsteps_client_example_test.go +++ /dev/null @@ -1,454 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsql_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sql/armsql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ListJobStepsByVersion.json -func ExampleJobStepsClient_NewListByVersionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewJobStepsClient().NewListByVersionPager("group1", "server1", "agent1", "job1", 1, nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.JobStepListResult = armsql.JobStepListResult{ - // Value: []*armsql.JobStep{ - // { - // Name: to.Ptr("step1"), - // Type: to.Ptr("Microsoft.Sql/servers/jobAgents/jobs/versions/steps"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/jobAgents/agent1/jobs/job1/versions/1/steps/step1"), - // Properties: &armsql.JobStepProperties{ - // Action: &armsql.JobStepAction{ - // Type: to.Ptr(armsql.JobStepActionTypeTSQL), - // Source: to.Ptr(armsql.JobStepActionSourceInline), - // Value: to.Ptr("select 2"), - // }, - // Credential: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/jobAgents/agent1/credentials/cred1"), - // ExecutionOptions: &armsql.JobStepExecutionOptions{ - // InitialRetryIntervalSeconds: to.Ptr[int32](11), - // MaximumRetryIntervalSeconds: to.Ptr[int32](222), - // RetryAttempts: to.Ptr[int32](42), - // RetryIntervalBackoffMultiplier: to.Ptr[float32](3), - // TimeoutSeconds: to.Ptr[int32](1234), - // }, - // Output: &armsql.JobStepOutput{ - // Type: to.Ptr(armsql.JobStepOutputTypeSQLDatabase), - // Credential: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/jobAgents/agent1/credentials/cred0"), - // DatabaseName: to.Ptr("database3"), - // ResourceGroupName: to.Ptr("group3"), - // SchemaName: to.Ptr("myschema1234"), - // ServerName: to.Ptr("server3"), - // SubscriptionID: to.Ptr("3501b905-a848-4b5d-96e8-b253f62d735a"), - // TableName: to.Ptr("mytable5678"), - // }, - // StepID: to.Ptr[int32](1), - // TargetGroup: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/jobAgents/agent1/targetGroups/targetGroup1"), - // }, - // }, - // { - // Name: to.Ptr("step2"), - // Type: to.Ptr("Microsoft.Sql/servers/jobAgents/jobs/versions/steps"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/jobAgents/agent1/jobs/job1/versions/1/steps/step2"), - // Properties: &armsql.JobStepProperties{ - // Action: &armsql.JobStepAction{ - // Type: to.Ptr(armsql.JobStepActionTypeTSQL), - // Source: to.Ptr(armsql.JobStepActionSourceInline), - // Value: to.Ptr("select 2"), - // }, - // Credential: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/jobAgents/agent1/credentials/cred1"), - // ExecutionOptions: &armsql.JobStepExecutionOptions{ - // InitialRetryIntervalSeconds: to.Ptr[int32](11), - // MaximumRetryIntervalSeconds: to.Ptr[int32](222), - // RetryAttempts: to.Ptr[int32](42), - // RetryIntervalBackoffMultiplier: to.Ptr[float32](3), - // TimeoutSeconds: to.Ptr[int32](1234), - // }, - // Output: &armsql.JobStepOutput{ - // Type: to.Ptr(armsql.JobStepOutputTypeSQLDatabase), - // Credential: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/jobAgents/agent1/credentials/cred0"), - // DatabaseName: to.Ptr("database3"), - // ResourceGroupName: to.Ptr("group3"), - // SchemaName: to.Ptr("myschema1234"), - // ServerName: to.Ptr("server3"), - // SubscriptionID: to.Ptr("3501b905-a848-4b5d-96e8-b253f62d735a"), - // TableName: to.Ptr("mytable5678"), - // }, - // StepID: to.Ptr[int32](2), - // TargetGroup: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/jobAgents/agent1/targetGroups/targetGroup1"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/GetJobStepByVersion.json -func ExampleJobStepsClient_GetByVersion() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewJobStepsClient().GetByVersion(ctx, "group1", "server1", "agent1", "job1", 1, "step1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.JobStep = armsql.JobStep{ - // Name: to.Ptr("step1"), - // Type: to.Ptr("Microsoft.Sql/servers/jobAgents/jobs/versions/steps"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/jobAgents/agent1/jobs/job1/versions/1/steps/step1"), - // Properties: &armsql.JobStepProperties{ - // Action: &armsql.JobStepAction{ - // Type: to.Ptr(armsql.JobStepActionTypeTSQL), - // Source: to.Ptr(armsql.JobStepActionSourceInline), - // Value: to.Ptr("select 2"), - // }, - // Credential: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/jobAgents/agent1/credentials/cred1"), - // ExecutionOptions: &armsql.JobStepExecutionOptions{ - // InitialRetryIntervalSeconds: to.Ptr[int32](11), - // MaximumRetryIntervalSeconds: to.Ptr[int32](222), - // RetryAttempts: to.Ptr[int32](42), - // RetryIntervalBackoffMultiplier: to.Ptr[float32](3), - // TimeoutSeconds: to.Ptr[int32](1234), - // }, - // Output: &armsql.JobStepOutput{ - // Type: to.Ptr(armsql.JobStepOutputTypeSQLDatabase), - // Credential: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/jobAgents/agent1/credentials/cred0"), - // DatabaseName: to.Ptr("database3"), - // ResourceGroupName: to.Ptr("group3"), - // SchemaName: to.Ptr("myschema1234"), - // ServerName: to.Ptr("server3"), - // SubscriptionID: to.Ptr("3501b905-a848-4b5d-96e8-b253f62d735a"), - // TableName: to.Ptr("mytable5678"), - // }, - // StepID: to.Ptr[int32](1), - // TargetGroup: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/jobAgents/agent1/targetGroups/targetGroup1"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ListJobStepsByJob.json -func ExampleJobStepsClient_NewListByJobPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewJobStepsClient().NewListByJobPager("group1", "server1", "agent1", "job1", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.JobStepListResult = armsql.JobStepListResult{ - // Value: []*armsql.JobStep{ - // { - // Name: to.Ptr("step1"), - // Type: to.Ptr("Microsoft.Sql/servers/jobAgents/jobs/steps"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/jobAgents/agent1/jobs/job1/steps/step1"), - // Properties: &armsql.JobStepProperties{ - // Action: &armsql.JobStepAction{ - // Type: to.Ptr(armsql.JobStepActionTypeTSQL), - // Source: to.Ptr(armsql.JobStepActionSourceInline), - // Value: to.Ptr("select 2"), - // }, - // Credential: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/jobAgents/agent1/credentials/cred1"), - // ExecutionOptions: &armsql.JobStepExecutionOptions{ - // InitialRetryIntervalSeconds: to.Ptr[int32](11), - // MaximumRetryIntervalSeconds: to.Ptr[int32](222), - // RetryAttempts: to.Ptr[int32](42), - // RetryIntervalBackoffMultiplier: to.Ptr[float32](3), - // TimeoutSeconds: to.Ptr[int32](1234), - // }, - // Output: &armsql.JobStepOutput{ - // Type: to.Ptr(armsql.JobStepOutputTypeSQLDatabase), - // Credential: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/jobAgents/agent1/credentials/cred0"), - // DatabaseName: to.Ptr("database3"), - // ResourceGroupName: to.Ptr("group3"), - // SchemaName: to.Ptr("myschema1234"), - // ServerName: to.Ptr("server3"), - // SubscriptionID: to.Ptr("3501b905-a848-4b5d-96e8-b253f62d735a"), - // TableName: to.Ptr("mytable5678"), - // }, - // StepID: to.Ptr[int32](1), - // TargetGroup: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/jobAgents/agent1/targetGroups/targetGroup1"), - // }, - // }, - // { - // Name: to.Ptr("step2"), - // Type: to.Ptr("Microsoft.Sql/servers/jobAgents/jobs/steps"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/jobAgents/agent1/jobs/job1/steps/step2"), - // Properties: &armsql.JobStepProperties{ - // Action: &armsql.JobStepAction{ - // Type: to.Ptr(armsql.JobStepActionTypeTSQL), - // Source: to.Ptr(armsql.JobStepActionSourceInline), - // Value: to.Ptr("select 2"), - // }, - // Credential: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/jobAgents/agent1/credentials/cred1"), - // ExecutionOptions: &armsql.JobStepExecutionOptions{ - // InitialRetryIntervalSeconds: to.Ptr[int32](11), - // MaximumRetryIntervalSeconds: to.Ptr[int32](222), - // RetryAttempts: to.Ptr[int32](42), - // RetryIntervalBackoffMultiplier: to.Ptr[float32](3), - // TimeoutSeconds: to.Ptr[int32](1234), - // }, - // Output: &armsql.JobStepOutput{ - // Type: to.Ptr(armsql.JobStepOutputTypeSQLDatabase), - // Credential: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/jobAgents/agent1/credentials/cred0"), - // DatabaseName: to.Ptr("database3"), - // ResourceGroupName: to.Ptr("group3"), - // SchemaName: to.Ptr("myschema1234"), - // ServerName: to.Ptr("server3"), - // SubscriptionID: to.Ptr("3501b905-a848-4b5d-96e8-b253f62d735a"), - // TableName: to.Ptr("mytable5678"), - // }, - // StepID: to.Ptr[int32](2), - // TargetGroup: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/jobAgents/agent1/targetGroups/targetGroup1"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/GetJobStepByJob.json -func ExampleJobStepsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewJobStepsClient().Get(ctx, "group1", "server1", "agent1", "job1", "step1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.JobStep = armsql.JobStep{ - // Name: to.Ptr("step1"), - // Type: to.Ptr("Microsoft.Sql/servers/jobAgents/jobs/steps"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/jobAgents/agent1/jobs/job1/steps/step1"), - // Properties: &armsql.JobStepProperties{ - // Action: &armsql.JobStepAction{ - // Type: to.Ptr(armsql.JobStepActionTypeTSQL), - // Source: to.Ptr(armsql.JobStepActionSourceInline), - // Value: to.Ptr("select 2"), - // }, - // Credential: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/jobAgents/agent1/credentials/cred1"), - // ExecutionOptions: &armsql.JobStepExecutionOptions{ - // InitialRetryIntervalSeconds: to.Ptr[int32](11), - // MaximumRetryIntervalSeconds: to.Ptr[int32](222), - // RetryAttempts: to.Ptr[int32](42), - // RetryIntervalBackoffMultiplier: to.Ptr[float32](3), - // TimeoutSeconds: to.Ptr[int32](1234), - // }, - // Output: &armsql.JobStepOutput{ - // Type: to.Ptr(armsql.JobStepOutputTypeSQLDatabase), - // Credential: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/jobAgents/agent1/credentials/cred0"), - // DatabaseName: to.Ptr("database3"), - // ResourceGroupName: to.Ptr("group3"), - // SchemaName: to.Ptr("myschema1234"), - // ServerName: to.Ptr("server3"), - // SubscriptionID: to.Ptr("3501b905-a848-4b5d-96e8-b253f62d735a"), - // TableName: to.Ptr("mytable5678"), - // }, - // StepID: to.Ptr[int32](1), - // TargetGroup: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/jobAgents/agent1/targetGroups/targetGroup1"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/CreateOrUpdateJobStepMax.json -func ExampleJobStepsClient_CreateOrUpdate_createOrUpdateAJobStepWithAllPropertiesSpecified() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewJobStepsClient().CreateOrUpdate(ctx, "group1", "server1", "agent1", "job1", "step1", armsql.JobStep{ - Properties: &armsql.JobStepProperties{ - Action: &armsql.JobStepAction{ - Type: to.Ptr(armsql.JobStepActionTypeTSQL), - Source: to.Ptr(armsql.JobStepActionSourceInline), - Value: to.Ptr("select 2"), - }, - Credential: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/jobAgents/agent1/credentials/cred1"), - ExecutionOptions: &armsql.JobStepExecutionOptions{ - InitialRetryIntervalSeconds: to.Ptr[int32](11), - MaximumRetryIntervalSeconds: to.Ptr[int32](222), - RetryAttempts: to.Ptr[int32](42), - RetryIntervalBackoffMultiplier: to.Ptr[float32](3), - TimeoutSeconds: to.Ptr[int32](1234), - }, - Output: &armsql.JobStepOutput{ - Type: to.Ptr(armsql.JobStepOutputTypeSQLDatabase), - Credential: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/jobAgents/agent1/credentials/cred0"), - DatabaseName: to.Ptr("database3"), - ResourceGroupName: to.Ptr("group3"), - SchemaName: to.Ptr("myschema1234"), - ServerName: to.Ptr("server3"), - SubscriptionID: to.Ptr("3501b905-a848-4b5d-96e8-b253f62d735a"), - TableName: to.Ptr("mytable5678"), - }, - StepID: to.Ptr[int32](1), - TargetGroup: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/jobAgents/agent1/targetGroups/targetGroup1"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.JobStep = armsql.JobStep{ - // Name: to.Ptr("step1"), - // Type: to.Ptr("Microsoft.Sql/servers/jobAgents/jobs/steps"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/jobAgents/agent1/jobs/job1/steps/step1"), - // Properties: &armsql.JobStepProperties{ - // Action: &armsql.JobStepAction{ - // Type: to.Ptr(armsql.JobStepActionTypeTSQL), - // Source: to.Ptr(armsql.JobStepActionSourceInline), - // Value: to.Ptr("select 2"), - // }, - // Credential: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/jobAgents/agent1/credentials/cred1"), - // ExecutionOptions: &armsql.JobStepExecutionOptions{ - // InitialRetryIntervalSeconds: to.Ptr[int32](11), - // MaximumRetryIntervalSeconds: to.Ptr[int32](222), - // RetryAttempts: to.Ptr[int32](42), - // RetryIntervalBackoffMultiplier: to.Ptr[float32](3), - // TimeoutSeconds: to.Ptr[int32](1234), - // }, - // Output: &armsql.JobStepOutput{ - // Type: to.Ptr(armsql.JobStepOutputTypeSQLDatabase), - // Credential: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/jobAgents/agent1/credentials/cred0"), - // DatabaseName: to.Ptr("database3"), - // ResourceGroupName: to.Ptr("group3"), - // SchemaName: to.Ptr("myschema1234"), - // ServerName: to.Ptr("server3"), - // SubscriptionID: to.Ptr("3501b905-a848-4b5d-96e8-b253f62d735a"), - // TableName: to.Ptr("mytable5678"), - // }, - // StepID: to.Ptr[int32](1), - // TargetGroup: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/jobAgents/agent1/targetGroups/targetGroup1"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/CreateOrUpdateJobStepMin.json -func ExampleJobStepsClient_CreateOrUpdate_createOrUpdateAJobStepWithMinimalPropertiesSpecified() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewJobStepsClient().CreateOrUpdate(ctx, "group1", "server1", "agent1", "job1", "step1", armsql.JobStep{ - Properties: &armsql.JobStepProperties{ - Action: &armsql.JobStepAction{ - Value: to.Ptr("select 1"), - }, - Credential: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/jobAgents/agent1/credentials/cred0"), - TargetGroup: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/jobAgents/agent1/targetGroups/targetGroup0"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.JobStep = armsql.JobStep{ - // Name: to.Ptr("step1"), - // Type: to.Ptr("Microsoft.Sql/servers/jobAgents/jobs/steps"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/jobAgents/agent1/jobs/job1/steps/step1"), - // Properties: &armsql.JobStepProperties{ - // Action: &armsql.JobStepAction{ - // Type: to.Ptr(armsql.JobStepActionTypeTSQL), - // Source: to.Ptr(armsql.JobStepActionSourceInline), - // Value: to.Ptr("select 1"), - // }, - // Credential: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/jobAgents/agent1/credentials/cred0"), - // ExecutionOptions: &armsql.JobStepExecutionOptions{ - // InitialRetryIntervalSeconds: to.Ptr[int32](1), - // MaximumRetryIntervalSeconds: to.Ptr[int32](120), - // RetryAttempts: to.Ptr[int32](10), - // RetryIntervalBackoffMultiplier: to.Ptr[float32](2), - // TimeoutSeconds: to.Ptr[int32](43200), - // }, - // StepID: to.Ptr[int32](1), - // TargetGroup: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/jobAgents/agent1/targetGroups/targetGroup0"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DeleteJobStep.json -func ExampleJobStepsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewJobStepsClient().Delete(ctx, "group1", "server1", "agent1", "job1", "step1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/sql/armsql/jobtargetexecutions_client.go b/sdk/resourcemanager/sql/armsql/jobtargetexecutions_client.go index ec7cf6e8b8c7..91bb313365ca 100644 --- a/sdk/resourcemanager/sql/armsql/jobtargetexecutions_client.go +++ b/sdk/resourcemanager/sql/armsql/jobtargetexecutions_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armsql @@ -49,7 +48,7 @@ func NewJobTargetExecutionsClient(subscriptionID string, credential azcore.Token // Get - Gets a target execution. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -60,18 +59,21 @@ func NewJobTargetExecutionsClient(subscriptionID string, credential azcore.Token // - targetID - The target id. // - options - JobTargetExecutionsClientGetOptions contains the optional parameters for the JobTargetExecutionsClient.Get method. func (client *JobTargetExecutionsClient) Get(ctx context.Context, resourceGroupName string, serverName string, jobAgentName string, jobName string, jobExecutionID string, stepName string, targetID string, options *JobTargetExecutionsClientGetOptions) (JobTargetExecutionsClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, serverName, jobAgentName, jobName, jobExecutionID, stepName, targetID, options) if err != nil { return JobTargetExecutionsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return JobTargetExecutionsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return JobTargetExecutionsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return JobTargetExecutionsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -108,7 +110,7 @@ func (client *JobTargetExecutionsClient) getCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -125,7 +127,7 @@ func (client *JobTargetExecutionsClient) getHandleResponse(resp *http.Response) // NewListByJobExecutionPager - Lists target executions for all steps of a job execution. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -207,12 +209,12 @@ func (client *JobTargetExecutionsClient) listByJobExecutionCreateRequest(ctx con reqQP.Set("isActive", strconv.FormatBool(*options.IsActive)) } if options != nil && options.Skip != nil { - reqQP.Set("$skip", strconv.FormatInt(int64(*options.Skip), 10)) + reqQP.Set("$skip", strconv.FormatInt(*options.Skip, 10)) } if options != nil && options.Top != nil { - reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) + reqQP.Set("$top", strconv.FormatInt(*options.Top, 10)) } - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -229,7 +231,7 @@ func (client *JobTargetExecutionsClient) listByJobExecutionHandleResponse(resp * // NewListByStepPager - Lists the target executions of a job step execution. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -316,12 +318,12 @@ func (client *JobTargetExecutionsClient) listByStepCreateRequest(ctx context.Con reqQP.Set("isActive", strconv.FormatBool(*options.IsActive)) } if options != nil && options.Skip != nil { - reqQP.Set("$skip", strconv.FormatInt(int64(*options.Skip), 10)) + reqQP.Set("$skip", strconv.FormatInt(*options.Skip, 10)) } if options != nil && options.Top != nil { - reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) + reqQP.Set("$top", strconv.FormatInt(*options.Top, 10)) } - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/sql/armsql/jobtargetexecutions_client_example_test.go b/sdk/resourcemanager/sql/armsql/jobtargetexecutions_client_example_test.go deleted file mode 100644 index 9cc24129bbb8..000000000000 --- a/sdk/resourcemanager/sql/armsql/jobtargetexecutions_client_example_test.go +++ /dev/null @@ -1,180 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsql_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sql/armsql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ListJobExecutionTargetsByExecution.json -func ExampleJobTargetExecutionsClient_NewListByJobExecutionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewJobTargetExecutionsClient().NewListByJobExecutionPager("group1", "server1", "agent1", "job1", "5A86BF65-43AC-F258-2524-9E92992F97CA", &armsql.JobTargetExecutionsClientListByJobExecutionOptions{CreateTimeMin: nil, - CreateTimeMax: nil, - EndTimeMin: nil, - EndTimeMax: nil, - IsActive: nil, - Skip: nil, - Top: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.JobExecutionListResult = armsql.JobExecutionListResult{ - // Value: []*armsql.JobExecution{ - // { - // Name: to.Ptr("aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee"), - // Type: to.Ptr("Microsoft.Sql/servers/jobAgents/jobs/executions/steps/targets"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/jobAgents/agent1/jobs/job1/executions/5555-6666-7777-8888-999999999999/steps/step1/targets/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee"), - // Properties: &armsql.JobExecutionProperties{ - // CreateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-07-01T04:33:17.5133333Z"); return t}()), - // CurrentAttemptStartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-07-01T04:33:18.2391013Z"); return t}()), - // CurrentAttempts: to.Ptr[int32](1), - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-07-01T04:33:18.7031029Z"); return t}()), - // JobExecutionID: to.Ptr("5A86BF65-43AC-F258-2524-9E92992F97CA"), - // JobVersion: to.Ptr[int32](1), - // LastMessage: to.Ptr("Step 1 succeeded execution on target (server 'server1', database 'database1')."), - // Lifecycle: to.Ptr(armsql.JobExecutionLifecycleSucceeded), - // ProvisioningState: to.Ptr(armsql.ProvisioningStateSucceeded), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-07-01T04:33:18.1230403Z"); return t}()), - // StepID: to.Ptr[int32](1), - // StepName: to.Ptr("step1"), - // Target: &armsql.JobExecutionTarget{ - // Type: to.Ptr(armsql.JobTargetTypeSQLDatabase), - // DatabaseName: to.Ptr("database1"), - // ServerName: to.Ptr("server1"), - // }, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ListJobExecutionTargetsByStep.json -func ExampleJobTargetExecutionsClient_NewListByStepPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewJobTargetExecutionsClient().NewListByStepPager("group1", "server1", "agent1", "job1", "5A86BF65-43AC-F258-2524-9E92992F97CA", "step1", &armsql.JobTargetExecutionsClientListByStepOptions{CreateTimeMin: nil, - CreateTimeMax: nil, - EndTimeMin: nil, - EndTimeMax: nil, - IsActive: nil, - Skip: nil, - Top: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.JobExecutionListResult = armsql.JobExecutionListResult{ - // Value: []*armsql.JobExecution{ - // { - // Name: to.Ptr("aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee"), - // Type: to.Ptr("Microsoft.Sql/servers/jobAgents/jobs/executions/steps/targets"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/jobAgents/agent1/jobs/job1/executions/5555-6666-7777-8888-999999999999/steps/step1/targets/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee"), - // Properties: &armsql.JobExecutionProperties{ - // CreateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-07-01T04:33:17.5133333Z"); return t}()), - // CurrentAttemptStartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-07-01T04:33:18.2391013Z"); return t}()), - // CurrentAttempts: to.Ptr[int32](1), - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-07-01T04:33:18.7031029Z"); return t}()), - // JobExecutionID: to.Ptr("5A86BF65-43AC-F258-2524-9E92992F97CA"), - // JobVersion: to.Ptr[int32](1), - // LastMessage: to.Ptr("Step 1 succeeded execution on target (server 'server1', database 'database1')."), - // Lifecycle: to.Ptr(armsql.JobExecutionLifecycleSucceeded), - // ProvisioningState: to.Ptr(armsql.ProvisioningStateSucceeded), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-07-01T04:33:18.1230403Z"); return t}()), - // StepID: to.Ptr[int32](1), - // StepName: to.Ptr("step1"), - // Target: &armsql.JobExecutionTarget{ - // Type: to.Ptr(armsql.JobTargetTypeSQLDatabase), - // DatabaseName: to.Ptr("database1"), - // ServerName: to.Ptr("server1"), - // }, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/GetJobExecutionTarget.json -func ExampleJobTargetExecutionsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewJobTargetExecutionsClient().Get(ctx, "group1", "server1", "agent1", "job1", "5A86BF65-43AC-F258-2524-9E92992F97CA", "step1", "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.JobExecution = armsql.JobExecution{ - // Name: to.Ptr("aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee"), - // Type: to.Ptr("Microsoft.Sql/servers/jobAgents/jobs/executions/steps/targets"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/jobAgents/agent1/jobs/job1/executions/5555-6666-7777-8888-999999999999/steps/step1/targets/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee"), - // Properties: &armsql.JobExecutionProperties{ - // CreateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-11-05T04:33:17.5133333Z"); return t}()), - // CurrentAttemptStartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-11-05T04:33:18.2391013Z"); return t}()), - // CurrentAttempts: to.Ptr[int32](1), - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-11-05T04:33:18.7031029Z"); return t}()), - // JobExecutionID: to.Ptr("5A86BF65-43AC-F258-2524-9E92992F97CA"), - // JobVersion: to.Ptr[int32](1), - // LastMessage: to.Ptr("Step 1 succeeded execution on target (server 'server1', database 'database1')."), - // Lifecycle: to.Ptr(armsql.JobExecutionLifecycleSucceeded), - // ProvisioningState: to.Ptr(armsql.ProvisioningStateSucceeded), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-11-05T04:33:18.1230403Z"); return t}()), - // StepID: to.Ptr[int32](1), - // StepName: to.Ptr("step1"), - // Target: &armsql.JobExecutionTarget{ - // Type: to.Ptr(armsql.JobTargetTypeSQLDatabase), - // DatabaseName: to.Ptr("database1"), - // ServerName: to.Ptr("server1"), - // }, - // }, - // } -} diff --git a/sdk/resourcemanager/sql/armsql/jobtargetgroups_client.go b/sdk/resourcemanager/sql/armsql/jobtargetgroups_client.go index 40c84f719cb9..7dd2668a0a84 100644 --- a/sdk/resourcemanager/sql/armsql/jobtargetgroups_client.go +++ b/sdk/resourcemanager/sql/armsql/jobtargetgroups_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armsql @@ -47,7 +46,7 @@ func NewJobTargetGroupsClient(subscriptionID string, credential azcore.TokenCred // CreateOrUpdate - Creates or updates a target group. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -57,18 +56,21 @@ func NewJobTargetGroupsClient(subscriptionID string, credential azcore.TokenCred // - options - JobTargetGroupsClientCreateOrUpdateOptions contains the optional parameters for the JobTargetGroupsClient.CreateOrUpdate // method. func (client *JobTargetGroupsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, jobAgentName string, targetGroupName string, parameters JobTargetGroup, options *JobTargetGroupsClientCreateOrUpdateOptions) (JobTargetGroupsClientCreateOrUpdateResponse, error) { + var err error req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, serverName, jobAgentName, targetGroupName, parameters, options) if err != nil { return JobTargetGroupsClientCreateOrUpdateResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return JobTargetGroupsClientCreateOrUpdateResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { - return JobTargetGroupsClientCreateOrUpdateResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return JobTargetGroupsClientCreateOrUpdateResponse{}, err } - return client.createOrUpdateHandleResponse(resp) + resp, err := client.createOrUpdateHandleResponse(httpResp) + return resp, err } // createOrUpdateCreateRequest creates the CreateOrUpdate request. @@ -99,10 +101,13 @@ func (client *JobTargetGroupsClient) createOrUpdateCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // createOrUpdateHandleResponse handles the CreateOrUpdate response. @@ -117,7 +122,7 @@ func (client *JobTargetGroupsClient) createOrUpdateHandleResponse(resp *http.Res // Delete - Deletes a target group. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -125,16 +130,18 @@ func (client *JobTargetGroupsClient) createOrUpdateHandleResponse(resp *http.Res // - targetGroupName - The name of the target group. // - options - JobTargetGroupsClientDeleteOptions contains the optional parameters for the JobTargetGroupsClient.Delete method. func (client *JobTargetGroupsClient) Delete(ctx context.Context, resourceGroupName string, serverName string, jobAgentName string, targetGroupName string, options *JobTargetGroupsClientDeleteOptions) (JobTargetGroupsClientDeleteResponse, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, serverName, jobAgentName, targetGroupName, options) if err != nil { return JobTargetGroupsClientDeleteResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return JobTargetGroupsClientDeleteResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { - return JobTargetGroupsClientDeleteResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return JobTargetGroupsClientDeleteResponse{}, err } return JobTargetGroupsClientDeleteResponse{}, nil } @@ -167,7 +174,7 @@ func (client *JobTargetGroupsClient) deleteCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -175,7 +182,7 @@ func (client *JobTargetGroupsClient) deleteCreateRequest(ctx context.Context, re // Get - Gets a target group. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -183,18 +190,21 @@ func (client *JobTargetGroupsClient) deleteCreateRequest(ctx context.Context, re // - targetGroupName - The name of the target group. // - options - JobTargetGroupsClientGetOptions contains the optional parameters for the JobTargetGroupsClient.Get method. func (client *JobTargetGroupsClient) Get(ctx context.Context, resourceGroupName string, serverName string, jobAgentName string, targetGroupName string, options *JobTargetGroupsClientGetOptions) (JobTargetGroupsClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, serverName, jobAgentName, targetGroupName, options) if err != nil { return JobTargetGroupsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return JobTargetGroupsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return JobTargetGroupsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return JobTargetGroupsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -225,7 +235,7 @@ func (client *JobTargetGroupsClient) getCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -242,7 +252,7 @@ func (client *JobTargetGroupsClient) getHandleResponse(resp *http.Response) (Job // NewListByAgentPager - Gets all target groups in an agent. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -301,7 +311,7 @@ func (client *JobTargetGroupsClient) listByAgentCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/sql/armsql/jobtargetgroups_client_example_test.go b/sdk/resourcemanager/sql/armsql/jobtargetgroups_client_example_test.go deleted file mode 100644 index 2adc3e856259..000000000000 --- a/sdk/resourcemanager/sql/armsql/jobtargetgroups_client_example_test.go +++ /dev/null @@ -1,269 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsql_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sql/armsql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ListJobTargetGroups.json -func ExampleJobTargetGroupsClient_NewListByAgentPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewJobTargetGroupsClient().NewListByAgentPager("group1", "server1", "agent1", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.JobTargetGroupListResult = armsql.JobTargetGroupListResult{ - // Value: []*armsql.JobTargetGroup{ - // { - // Name: to.Ptr("targetGroup1"), - // Type: to.Ptr("Microsoft.Sql/servers/jobAgents/targetGroups"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/jobAgents/agent1/targetGroups/targetGroup1"), - // Properties: &armsql.JobTargetGroupProperties{ - // Members: []*armsql.JobTarget{ - // { - // Type: to.Ptr(armsql.JobTargetTypeSQLDatabase), - // DatabaseName: to.Ptr("database1"), - // MembershipType: to.Ptr(armsql.JobTargetGroupMembershipTypeExclude), - // ServerName: to.Ptr("server1"), - // }, - // { - // Type: to.Ptr(armsql.JobTargetTypeSQLServer), - // MembershipType: to.Ptr(armsql.JobTargetGroupMembershipTypeInclude), - // RefreshCredential: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/jobAgents/agent1/credentials/testCredential"), - // ServerName: to.Ptr("server1"), - // }, - // { - // Type: to.Ptr(armsql.JobTargetTypeSQLElasticPool), - // ElasticPoolName: to.Ptr("pool1"), - // MembershipType: to.Ptr(armsql.JobTargetGroupMembershipTypeInclude), - // RefreshCredential: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/jobAgents/agent1/credentials/testCredential"), - // ServerName: to.Ptr("server2"), - // }, - // { - // Type: to.Ptr(armsql.JobTargetTypeSQLShardMap), - // MembershipType: to.Ptr(armsql.JobTargetGroupMembershipTypeInclude), - // RefreshCredential: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/jobAgents/agent1/credentials/testCredential"), - // ServerName: to.Ptr("server3"), - // ShardMapName: to.Ptr("shardMap1"), - // }}, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/GetJobTargetGroup.json -func ExampleJobTargetGroupsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewJobTargetGroupsClient().Get(ctx, "group1", "server1", "agent1", "targetGroup1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.JobTargetGroup = armsql.JobTargetGroup{ - // Name: to.Ptr("targetGroup1"), - // Type: to.Ptr("Microsoft.Sql/servers/jobAgents/targetGroups"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/jobAgents/agent1/targetGroups/targetGroup1"), - // Properties: &armsql.JobTargetGroupProperties{ - // Members: []*armsql.JobTarget{ - // { - // Type: to.Ptr(armsql.JobTargetTypeSQLDatabase), - // DatabaseName: to.Ptr("database1"), - // MembershipType: to.Ptr(armsql.JobTargetGroupMembershipTypeExclude), - // ServerName: to.Ptr("server1"), - // }, - // { - // Type: to.Ptr(armsql.JobTargetTypeSQLServer), - // MembershipType: to.Ptr(armsql.JobTargetGroupMembershipTypeInclude), - // RefreshCredential: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/jobAgents/agent1/credentials/testCredential"), - // ServerName: to.Ptr("server1"), - // }, - // { - // Type: to.Ptr(armsql.JobTargetTypeSQLElasticPool), - // ElasticPoolName: to.Ptr("pool1"), - // MembershipType: to.Ptr(armsql.JobTargetGroupMembershipTypeInclude), - // RefreshCredential: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/jobAgents/agent1/credentials/testCredential"), - // ServerName: to.Ptr("server2"), - // }, - // { - // Type: to.Ptr(armsql.JobTargetTypeSQLShardMap), - // MembershipType: to.Ptr(armsql.JobTargetGroupMembershipTypeInclude), - // RefreshCredential: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/jobAgents/agent1/credentials/testCredential"), - // ServerName: to.Ptr("server3"), - // ShardMapName: to.Ptr("shardMap1"), - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/CreateOrUpdateJobTargetGroupMax.json -func ExampleJobTargetGroupsClient_CreateOrUpdate_createOrUpdateATargetGroupWithAllProperties() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewJobTargetGroupsClient().CreateOrUpdate(ctx, "group1", "server1", "agent1", "targetGroup1", armsql.JobTargetGroup{ - Properties: &armsql.JobTargetGroupProperties{ - Members: []*armsql.JobTarget{ - { - Type: to.Ptr(armsql.JobTargetTypeSQLDatabase), - DatabaseName: to.Ptr("database1"), - MembershipType: to.Ptr(armsql.JobTargetGroupMembershipTypeExclude), - ServerName: to.Ptr("server1"), - }, - { - Type: to.Ptr(armsql.JobTargetTypeSQLServer), - MembershipType: to.Ptr(armsql.JobTargetGroupMembershipTypeInclude), - RefreshCredential: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/jobAgents/agent1/credentials/testCredential"), - ServerName: to.Ptr("server1"), - }, - { - Type: to.Ptr(armsql.JobTargetTypeSQLElasticPool), - ElasticPoolName: to.Ptr("pool1"), - MembershipType: to.Ptr(armsql.JobTargetGroupMembershipTypeInclude), - RefreshCredential: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/jobAgents/agent1/credentials/testCredential"), - ServerName: to.Ptr("server2"), - }, - { - Type: to.Ptr(armsql.JobTargetTypeSQLShardMap), - MembershipType: to.Ptr(armsql.JobTargetGroupMembershipTypeInclude), - RefreshCredential: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/jobAgents/agent1/credentials/testCredential"), - ServerName: to.Ptr("server3"), - ShardMapName: to.Ptr("shardMap1"), - }}, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.JobTargetGroup = armsql.JobTargetGroup{ - // Name: to.Ptr("targetGroup1"), - // Type: to.Ptr("Microsoft.Sql/servers/jobAgents/targetGroups"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/jobAgents/agent1/targetGroups/targetGroup1"), - // Properties: &armsql.JobTargetGroupProperties{ - // Members: []*armsql.JobTarget{ - // { - // Type: to.Ptr(armsql.JobTargetTypeSQLDatabase), - // DatabaseName: to.Ptr("database1"), - // MembershipType: to.Ptr(armsql.JobTargetGroupMembershipTypeExclude), - // ServerName: to.Ptr("server1"), - // }, - // { - // Type: to.Ptr(armsql.JobTargetTypeSQLServer), - // MembershipType: to.Ptr(armsql.JobTargetGroupMembershipTypeInclude), - // RefreshCredential: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/jobAgents/agent1/credentials/testCredential"), - // ServerName: to.Ptr("server1"), - // }, - // { - // Type: to.Ptr(armsql.JobTargetTypeSQLElasticPool), - // ElasticPoolName: to.Ptr("pool1"), - // MembershipType: to.Ptr(armsql.JobTargetGroupMembershipTypeInclude), - // RefreshCredential: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/jobAgents/agent1/credentials/testCredential"), - // ServerName: to.Ptr("server2"), - // }, - // { - // Type: to.Ptr(armsql.JobTargetTypeSQLShardMap), - // MembershipType: to.Ptr(armsql.JobTargetGroupMembershipTypeInclude), - // RefreshCredential: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/jobAgents/agent1/credentials/testCredential"), - // ServerName: to.Ptr("server3"), - // ShardMapName: to.Ptr("shardMap1"), - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/CreateOrUpdateJobTargetGroupMin.json -func ExampleJobTargetGroupsClient_CreateOrUpdate_createOrUpdateATargetGroupWithMinimalProperties() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewJobTargetGroupsClient().CreateOrUpdate(ctx, "group1", "server1", "agent1", "targetGroup1", armsql.JobTargetGroup{ - Properties: &armsql.JobTargetGroupProperties{ - Members: []*armsql.JobTarget{}, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.JobTargetGroup = armsql.JobTargetGroup{ - // Name: to.Ptr("targetGroup1"), - // Type: to.Ptr("Microsoft.Sql/servers/jobAgents/targetGroups"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/jobAgents/agent1/targetGroups/targetGroup1"), - // Properties: &armsql.JobTargetGroupProperties{ - // Members: []*armsql.JobTarget{ - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DeleteJobTargetGroup.json -func ExampleJobTargetGroupsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewJobTargetGroupsClient().Delete(ctx, "group1", "server1", "agent1", "targetGroup1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/sql/armsql/jobversions_client.go b/sdk/resourcemanager/sql/armsql/jobversions_client.go index 11aad5ec0799..7c5dbb10a02e 100644 --- a/sdk/resourcemanager/sql/armsql/jobversions_client.go +++ b/sdk/resourcemanager/sql/armsql/jobversions_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armsql @@ -48,7 +47,7 @@ func NewJobVersionsClient(subscriptionID string, credential azcore.TokenCredenti // Get - Gets a job version. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -57,18 +56,21 @@ func NewJobVersionsClient(subscriptionID string, credential azcore.TokenCredenti // - jobVersion - The version of the job to get. // - options - JobVersionsClientGetOptions contains the optional parameters for the JobVersionsClient.Get method. func (client *JobVersionsClient) Get(ctx context.Context, resourceGroupName string, serverName string, jobAgentName string, jobName string, jobVersion int32, options *JobVersionsClientGetOptions) (JobVersionsClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, serverName, jobAgentName, jobName, jobVersion, options) if err != nil { return JobVersionsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return JobVersionsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return JobVersionsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return JobVersionsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -100,7 +102,7 @@ func (client *JobVersionsClient) getCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -117,7 +119,7 @@ func (client *JobVersionsClient) getHandleResponse(resp *http.Response) (JobVers // NewListByJobPager - Gets all versions of a job. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -181,7 +183,7 @@ func (client *JobVersionsClient) listByJobCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/sql/armsql/jobversions_client_example_test.go b/sdk/resourcemanager/sql/armsql/jobversions_client_example_test.go deleted file mode 100644 index 1a0d4e7e8e7f..000000000000 --- a/sdk/resourcemanager/sql/armsql/jobversions_client_example_test.go +++ /dev/null @@ -1,81 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsql_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sql/armsql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ListJobVersions.json -func ExampleJobVersionsClient_NewListByJobPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewJobVersionsClient().NewListByJobPager("group1", "server1", "agent1", "job1", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.JobVersionListResult = armsql.JobVersionListResult{ - // Value: []*armsql.JobVersion{ - // { - // Name: to.Ptr("1"), - // Type: to.Ptr("Microsoft.Sql/servers/jobAgents/jobs/versions"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/jobAgents/agent1/jobs/job1/versions/1"), - // }, - // { - // Name: to.Ptr("2"), - // Type: to.Ptr("Microsoft.Sql/servers/jobAgents/jobs/versions"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/jobAgents/agent1/jobs/job1/versions/2"), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/GetJobVersion.json -func ExampleJobVersionsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewJobVersionsClient().Get(ctx, "group1", "server1", "agent1", "job1", 1, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.JobVersion = armsql.JobVersion{ - // Name: to.Ptr("1"), - // Type: to.Ptr("Microsoft.Sql/servers/jobAgents/jobs/versions"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/jobAgents/agent1/jobs/job1/versions/1"), - // } -} diff --git a/sdk/resourcemanager/sql/armsql/ledgerdigestuploads_client.go b/sdk/resourcemanager/sql/armsql/ledgerdigestuploads_client.go index 7d0712bae366..acd0cccd06ef 100644 --- a/sdk/resourcemanager/sql/armsql/ledgerdigestuploads_client.go +++ b/sdk/resourcemanager/sql/armsql/ledgerdigestuploads_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armsql @@ -47,7 +46,7 @@ func NewLedgerDigestUploadsClient(subscriptionID string, credential azcore.Token // BeginCreateOrUpdate - Enables upload ledger digests to an Azure Storage account or an Azure Confidential Ledger instance. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-02-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -60,7 +59,8 @@ func (client *LedgerDigestUploadsClient) BeginCreateOrUpdate(ctx context.Context if err != nil { return nil, err } - return runtime.NewPoller[LedgerDigestUploadsClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[LedgerDigestUploadsClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[LedgerDigestUploadsClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -69,20 +69,22 @@ func (client *LedgerDigestUploadsClient) BeginCreateOrUpdate(ctx context.Context // CreateOrUpdate - Enables upload ledger digests to an Azure Storage account or an Azure Confidential Ledger instance. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-02-01-preview +// Generated from API version 2022-11-01-preview func (client *LedgerDigestUploadsClient) createOrUpdate(ctx context.Context, resourceGroupName string, serverName string, databaseName string, ledgerDigestUploads LedgerDigestUploadsName, parameters LedgerDigestUploads, options *LedgerDigestUploadsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, serverName, databaseName, ledgerDigestUploads, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createOrUpdateCreateRequest creates the CreateOrUpdate request. @@ -113,16 +115,19 @@ func (client *LedgerDigestUploadsClient) createOrUpdateCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-02-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // BeginDisable - Disables uploading ledger digests to an Azure Storage account or an Azure Confidential Ledger instance. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-02-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -135,7 +140,8 @@ func (client *LedgerDigestUploadsClient) BeginDisable(ctx context.Context, resou if err != nil { return nil, err } - return runtime.NewPoller[LedgerDigestUploadsClientDisableResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[LedgerDigestUploadsClientDisableResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[LedgerDigestUploadsClientDisableResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -144,20 +150,22 @@ func (client *LedgerDigestUploadsClient) BeginDisable(ctx context.Context, resou // Disable - Disables uploading ledger digests to an Azure Storage account or an Azure Confidential Ledger instance. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-02-01-preview +// Generated from API version 2022-11-01-preview func (client *LedgerDigestUploadsClient) disable(ctx context.Context, resourceGroupName string, serverName string, databaseName string, ledgerDigestUploads LedgerDigestUploadsName, options *LedgerDigestUploadsClientBeginDisableOptions) (*http.Response, error) { + var err error req, err := client.disableCreateRequest(ctx, resourceGroupName, serverName, databaseName, ledgerDigestUploads, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // disableCreateRequest creates the Disable request. @@ -188,7 +196,7 @@ func (client *LedgerDigestUploadsClient) disableCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-02-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -197,25 +205,28 @@ func (client *LedgerDigestUploadsClient) disableCreateRequest(ctx context.Contex // Get - Gets the current ledger digest upload configuration for a database. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-02-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. // - databaseName - The name of the database. // - options - LedgerDigestUploadsClientGetOptions contains the optional parameters for the LedgerDigestUploadsClient.Get method. func (client *LedgerDigestUploadsClient) Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string, ledgerDigestUploads LedgerDigestUploadsName, options *LedgerDigestUploadsClientGetOptions) (LedgerDigestUploadsClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, serverName, databaseName, ledgerDigestUploads, options) if err != nil { return LedgerDigestUploadsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return LedgerDigestUploadsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return LedgerDigestUploadsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return LedgerDigestUploadsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -246,7 +257,7 @@ func (client *LedgerDigestUploadsClient) getCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-02-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -263,7 +274,7 @@ func (client *LedgerDigestUploadsClient) getHandleResponse(resp *http.Response) // NewListByDatabasePager - Gets all ledger digest upload settings on a database. // -// Generated from API version 2021-02-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -322,7 +333,7 @@ func (client *LedgerDigestUploadsClient) listByDatabaseCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-02-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/sql/armsql/ledgerdigestuploads_client_example_test.go b/sdk/resourcemanager/sql/armsql/ledgerdigestuploads_client_example_test.go deleted file mode 100644 index 49e4efcc7dcb..000000000000 --- a/sdk/resourcemanager/sql/armsql/ledgerdigestuploads_client_example_test.go +++ /dev/null @@ -1,154 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsql_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sql/armsql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/LedgerDigestUploadsGet.json -func ExampleLedgerDigestUploadsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewLedgerDigestUploadsClient().Get(ctx, "ledgertestrg", "ledgertestserver", "testdb", armsql.LedgerDigestUploadsNameCurrent, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.LedgerDigestUploads = armsql.LedgerDigestUploads{ - // Name: to.Ptr("current"), - // Type: to.Ptr("Microsoft.Sql/servers/databases/ledgerDigestUploads"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/ledgertestrg/providers/Microsoft.Sql/servers/ledgertestserver/databases/testdb/current"), - // Properties: &armsql.LedgerDigestUploadsProperties{ - // DigestStorageEndpoint: to.Ptr("https://mystorage.blob.core.windows.net"), - // State: to.Ptr(armsql.LedgerDigestUploadsStateEnabled), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/LedgerDigestUploadsEnable.json -func ExampleLedgerDigestUploadsClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewLedgerDigestUploadsClient().BeginCreateOrUpdate(ctx, "ledgertestrg", "ledgertestserver", "testdb", armsql.LedgerDigestUploadsNameCurrent, armsql.LedgerDigestUploads{ - Properties: &armsql.LedgerDigestUploadsProperties{ - DigestStorageEndpoint: to.Ptr("https://MyAccount.blob.core.windows.net"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.LedgerDigestUploads = armsql.LedgerDigestUploads{ - // Name: to.Ptr("current"), - // Type: to.Ptr("Microsoft.Sql/servers/databases/ledgerDigestUploads"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/ledgertestrg/providers/Microsoft.Sql/servers/ledgertestserver/databases/testdb/ledgerDigestUpload/current"), - // Properties: &armsql.LedgerDigestUploadsProperties{ - // DigestStorageEndpoint: to.Ptr("https://mystorage.blob.core.windows.net"), - // State: to.Ptr(armsql.LedgerDigestUploadsStateEnabled), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/LedgerDigestUploadsList.json -func ExampleLedgerDigestUploadsClient_NewListByDatabasePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewLedgerDigestUploadsClient().NewListByDatabasePager("ledgertestrg", "ledgertestserver", "testdb", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.LedgerDigestUploadsListResult = armsql.LedgerDigestUploadsListResult{ - // Value: []*armsql.LedgerDigestUploads{ - // { - // Name: to.Ptr("current"), - // Type: to.Ptr("Microsoft.Sql/servers/databases/ledgerDigestUploads"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/ledgertestrg/providers/Microsoft.Sql/servers/ledgertestserver/databases/testdb/current"), - // Properties: &armsql.LedgerDigestUploadsProperties{ - // DigestStorageEndpoint: to.Ptr("https://mystorage.blob.core.windows.net"), - // State: to.Ptr(armsql.LedgerDigestUploadsStateEnabled), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/LedgerDigestUploadsDisable.json -func ExampleLedgerDigestUploadsClient_BeginDisable() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewLedgerDigestUploadsClient().BeginDisable(ctx, "ledgertestrg", "ledgertestserver", "testdb", armsql.LedgerDigestUploadsNameCurrent, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.LedgerDigestUploads = armsql.LedgerDigestUploads{ - // Name: to.Ptr("current"), - // Type: to.Ptr("Microsoft.Sql/servers/databases/ledgerDigestUploads"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/ledgertestrg/providers/Microsoft.Sql/servers/ledgertestserver/databases/testdb/ledgerDigestUpload/current/disable"), - // Properties: &armsql.LedgerDigestUploadsProperties{ - // State: to.Ptr(armsql.LedgerDigestUploadsStateDisabled), - // }, - // } -} diff --git a/sdk/resourcemanager/sql/armsql/longtermretentionbackups_client.go b/sdk/resourcemanager/sql/armsql/longtermretentionbackups_client.go index aca8458c57e8..165cf14f6abd 100644 --- a/sdk/resourcemanager/sql/armsql/longtermretentionbackups_client.go +++ b/sdk/resourcemanager/sql/armsql/longtermretentionbackups_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armsql @@ -48,7 +47,7 @@ func NewLongTermRetentionBackupsClient(subscriptionID string, credential azcore. // BeginCopy - Copy an existing long term retention backup. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-05-01-preview +// Generated from API version 2022-11-01-preview // - locationName - The location of the database. // - longTermRetentionServerName - The name of the server // - longTermRetentionDatabaseName - The name of the database @@ -62,7 +61,8 @@ func (client *LongTermRetentionBackupsClient) BeginCopy(ctx context.Context, loc if err != nil { return nil, err } - return runtime.NewPoller[LongTermRetentionBackupsClientCopyResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[LongTermRetentionBackupsClientCopyResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[LongTermRetentionBackupsClientCopyResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -71,20 +71,22 @@ func (client *LongTermRetentionBackupsClient) BeginCopy(ctx context.Context, loc // Copy - Copy an existing long term retention backup. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-05-01-preview +// Generated from API version 2022-11-01-preview func (client *LongTermRetentionBackupsClient) copyOperation(ctx context.Context, locationName string, longTermRetentionServerName string, longTermRetentionDatabaseName string, backupName string, parameters CopyLongTermRetentionBackupParameters, options *LongTermRetentionBackupsClientBeginCopyOptions) (*http.Response, error) { + var err error req, err := client.copyCreateRequest(ctx, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // copyCreateRequest creates the Copy request. @@ -115,16 +117,19 @@ func (client *LongTermRetentionBackupsClient) copyCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-05-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // BeginCopyByResourceGroup - Copy an existing long term retention backup to a different server. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-05-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - locationName - The location of the database. @@ -140,7 +145,8 @@ func (client *LongTermRetentionBackupsClient) BeginCopyByResourceGroup(ctx conte if err != nil { return nil, err } - return runtime.NewPoller[LongTermRetentionBackupsClientCopyByResourceGroupResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[LongTermRetentionBackupsClientCopyByResourceGroupResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[LongTermRetentionBackupsClientCopyByResourceGroupResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -149,20 +155,22 @@ func (client *LongTermRetentionBackupsClient) BeginCopyByResourceGroup(ctx conte // CopyByResourceGroup - Copy an existing long term retention backup to a different server. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-05-01-preview +// Generated from API version 2022-11-01-preview func (client *LongTermRetentionBackupsClient) copyByResourceGroup(ctx context.Context, resourceGroupName string, locationName string, longTermRetentionServerName string, longTermRetentionDatabaseName string, backupName string, parameters CopyLongTermRetentionBackupParameters, options *LongTermRetentionBackupsClientBeginCopyByResourceGroupOptions) (*http.Response, error) { + var err error req, err := client.copyByResourceGroupCreateRequest(ctx, resourceGroupName, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // copyByResourceGroupCreateRequest creates the CopyByResourceGroup request. @@ -197,16 +205,19 @@ func (client *LongTermRetentionBackupsClient) copyByResourceGroupCreateRequest(c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-05-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // BeginDelete - Deletes a long term retention backup. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-05-01-preview +// Generated from API version 2022-11-01-preview // - locationName - The location of the database // - longTermRetentionServerName - The name of the server // - longTermRetentionDatabaseName - The name of the database @@ -219,7 +230,8 @@ func (client *LongTermRetentionBackupsClient) BeginDelete(ctx context.Context, l if err != nil { return nil, err } - return runtime.NewPoller[LongTermRetentionBackupsClientDeleteResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[LongTermRetentionBackupsClientDeleteResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[LongTermRetentionBackupsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -228,20 +240,22 @@ func (client *LongTermRetentionBackupsClient) BeginDelete(ctx context.Context, l // Delete - Deletes a long term retention backup. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-05-01-preview +// Generated from API version 2022-11-01-preview func (client *LongTermRetentionBackupsClient) deleteOperation(ctx context.Context, locationName string, longTermRetentionServerName string, longTermRetentionDatabaseName string, backupName string, options *LongTermRetentionBackupsClientBeginDeleteOptions) (*http.Response, error) { + var err error req, err := client.deleteCreateRequest(ctx, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteCreateRequest creates the Delete request. @@ -272,7 +286,7 @@ func (client *LongTermRetentionBackupsClient) deleteCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-05-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -280,7 +294,7 @@ func (client *LongTermRetentionBackupsClient) deleteCreateRequest(ctx context.Co // BeginDeleteByResourceGroup - Deletes a long term retention backup. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-05-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - locationName - The location of the database @@ -295,7 +309,8 @@ func (client *LongTermRetentionBackupsClient) BeginDeleteByResourceGroup(ctx con if err != nil { return nil, err } - return runtime.NewPoller[LongTermRetentionBackupsClientDeleteByResourceGroupResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[LongTermRetentionBackupsClientDeleteByResourceGroupResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[LongTermRetentionBackupsClientDeleteByResourceGroupResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -304,20 +319,22 @@ func (client *LongTermRetentionBackupsClient) BeginDeleteByResourceGroup(ctx con // DeleteByResourceGroup - Deletes a long term retention backup. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-05-01-preview +// Generated from API version 2022-11-01-preview func (client *LongTermRetentionBackupsClient) deleteByResourceGroup(ctx context.Context, resourceGroupName string, locationName string, longTermRetentionServerName string, longTermRetentionDatabaseName string, backupName string, options *LongTermRetentionBackupsClientBeginDeleteByResourceGroupOptions) (*http.Response, error) { + var err error req, err := client.deleteByResourceGroupCreateRequest(ctx, resourceGroupName, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteByResourceGroupCreateRequest creates the DeleteByResourceGroup request. @@ -352,7 +369,7 @@ func (client *LongTermRetentionBackupsClient) deleteByResourceGroupCreateRequest return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-05-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -360,7 +377,7 @@ func (client *LongTermRetentionBackupsClient) deleteByResourceGroupCreateRequest // Get - Gets a long term retention backup. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-05-01-preview +// Generated from API version 2022-11-01-preview // - locationName - The location of the database. // - longTermRetentionServerName - The name of the server // - longTermRetentionDatabaseName - The name of the database @@ -368,18 +385,21 @@ func (client *LongTermRetentionBackupsClient) deleteByResourceGroupCreateRequest // - options - LongTermRetentionBackupsClientGetOptions contains the optional parameters for the LongTermRetentionBackupsClient.Get // method. func (client *LongTermRetentionBackupsClient) Get(ctx context.Context, locationName string, longTermRetentionServerName string, longTermRetentionDatabaseName string, backupName string, options *LongTermRetentionBackupsClientGetOptions) (LongTermRetentionBackupsClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, options) if err != nil { return LongTermRetentionBackupsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return LongTermRetentionBackupsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return LongTermRetentionBackupsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return LongTermRetentionBackupsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -410,7 +430,7 @@ func (client *LongTermRetentionBackupsClient) getCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-05-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -428,7 +448,7 @@ func (client *LongTermRetentionBackupsClient) getHandleResponse(resp *http.Respo // GetByResourceGroup - Gets a long term retention backup. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-05-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - locationName - The location of the database. @@ -438,18 +458,21 @@ func (client *LongTermRetentionBackupsClient) getHandleResponse(resp *http.Respo // - options - LongTermRetentionBackupsClientGetByResourceGroupOptions contains the optional parameters for the LongTermRetentionBackupsClient.GetByResourceGroup // method. func (client *LongTermRetentionBackupsClient) GetByResourceGroup(ctx context.Context, resourceGroupName string, locationName string, longTermRetentionServerName string, longTermRetentionDatabaseName string, backupName string, options *LongTermRetentionBackupsClientGetByResourceGroupOptions) (LongTermRetentionBackupsClientGetByResourceGroupResponse, error) { + var err error req, err := client.getByResourceGroupCreateRequest(ctx, resourceGroupName, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, options) if err != nil { return LongTermRetentionBackupsClientGetByResourceGroupResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return LongTermRetentionBackupsClientGetByResourceGroupResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return LongTermRetentionBackupsClientGetByResourceGroupResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return LongTermRetentionBackupsClientGetByResourceGroupResponse{}, err } - return client.getByResourceGroupHandleResponse(resp) + resp, err := client.getByResourceGroupHandleResponse(httpResp) + return resp, err } // getByResourceGroupCreateRequest creates the GetByResourceGroup request. @@ -484,7 +507,7 @@ func (client *LongTermRetentionBackupsClient) getByResourceGroupCreateRequest(ct return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-05-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -501,7 +524,7 @@ func (client *LongTermRetentionBackupsClient) getByResourceGroupHandleResponse(r // NewListByDatabasePager - Lists all long term retention backups for a database. // -// Generated from API version 2021-05-01-preview +// Generated from API version 2022-11-01-preview // - locationName - The location of the database // - longTermRetentionServerName - The name of the server // - longTermRetentionDatabaseName - The name of the database @@ -565,7 +588,7 @@ func (client *LongTermRetentionBackupsClient) listByDatabaseCreateRequest(ctx co if options != nil && options.DatabaseState != nil { reqQP.Set("databaseState", string(*options.DatabaseState)) } - reqQP.Set("api-version", "2021-05-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -582,7 +605,7 @@ func (client *LongTermRetentionBackupsClient) listByDatabaseHandleResponse(resp // NewListByLocationPager - Lists the long term retention backups for a given location. // -// Generated from API version 2021-05-01-preview +// Generated from API version 2022-11-01-preview // - locationName - The location of the database // - options - LongTermRetentionBackupsClientListByLocationOptions contains the optional parameters for the LongTermRetentionBackupsClient.NewListByLocationPager // method. @@ -636,7 +659,7 @@ func (client *LongTermRetentionBackupsClient) listByLocationCreateRequest(ctx co if options != nil && options.DatabaseState != nil { reqQP.Set("databaseState", string(*options.DatabaseState)) } - reqQP.Set("api-version", "2021-05-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -653,7 +676,7 @@ func (client *LongTermRetentionBackupsClient) listByLocationHandleResponse(resp // NewListByResourceGroupDatabasePager - Lists all long term retention backups for a database. // -// Generated from API version 2021-05-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - locationName - The location of the database @@ -723,7 +746,7 @@ func (client *LongTermRetentionBackupsClient) listByResourceGroupDatabaseCreateR if options != nil && options.DatabaseState != nil { reqQP.Set("databaseState", string(*options.DatabaseState)) } - reqQP.Set("api-version", "2021-05-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -740,7 +763,7 @@ func (client *LongTermRetentionBackupsClient) listByResourceGroupDatabaseHandleR // NewListByResourceGroupLocationPager - Lists the long term retention backups for a given location. // -// Generated from API version 2021-05-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - locationName - The location of the database @@ -800,7 +823,7 @@ func (client *LongTermRetentionBackupsClient) listByResourceGroupLocationCreateR if options != nil && options.DatabaseState != nil { reqQP.Set("databaseState", string(*options.DatabaseState)) } - reqQP.Set("api-version", "2021-05-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -817,7 +840,7 @@ func (client *LongTermRetentionBackupsClient) listByResourceGroupLocationHandleR // NewListByResourceGroupServerPager - Lists the long term retention backups for a given server. // -// Generated from API version 2021-05-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - locationName - The location of the database @@ -882,7 +905,7 @@ func (client *LongTermRetentionBackupsClient) listByResourceGroupServerCreateReq if options != nil && options.DatabaseState != nil { reqQP.Set("databaseState", string(*options.DatabaseState)) } - reqQP.Set("api-version", "2021-05-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -899,7 +922,7 @@ func (client *LongTermRetentionBackupsClient) listByResourceGroupServerHandleRes // NewListByServerPager - Lists the long term retention backups for a given server. // -// Generated from API version 2021-05-01-preview +// Generated from API version 2022-11-01-preview // - locationName - The location of the database // - longTermRetentionServerName - The name of the server // - options - LongTermRetentionBackupsClientListByServerOptions contains the optional parameters for the LongTermRetentionBackupsClient.NewListByServerPager @@ -958,7 +981,7 @@ func (client *LongTermRetentionBackupsClient) listByServerCreateRequest(ctx cont if options != nil && options.DatabaseState != nil { reqQP.Set("databaseState", string(*options.DatabaseState)) } - reqQP.Set("api-version", "2021-05-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -976,7 +999,7 @@ func (client *LongTermRetentionBackupsClient) listByServerHandleResponse(resp *h // BeginUpdate - Updates an existing long term retention backup. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-05-01-preview +// Generated from API version 2022-11-01-preview // - locationName - The location of the database. // - longTermRetentionServerName - The name of the server // - longTermRetentionDatabaseName - The name of the database @@ -990,7 +1013,8 @@ func (client *LongTermRetentionBackupsClient) BeginUpdate(ctx context.Context, l if err != nil { return nil, err } - return runtime.NewPoller[LongTermRetentionBackupsClientUpdateResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[LongTermRetentionBackupsClientUpdateResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[LongTermRetentionBackupsClientUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -999,20 +1023,22 @@ func (client *LongTermRetentionBackupsClient) BeginUpdate(ctx context.Context, l // Update - Updates an existing long term retention backup. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-05-01-preview +// Generated from API version 2022-11-01-preview func (client *LongTermRetentionBackupsClient) update(ctx context.Context, locationName string, longTermRetentionServerName string, longTermRetentionDatabaseName string, backupName string, parameters UpdateLongTermRetentionBackupParameters, options *LongTermRetentionBackupsClientBeginUpdateOptions) (*http.Response, error) { + var err error req, err := client.updateCreateRequest(ctx, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // updateCreateRequest creates the Update request. @@ -1043,16 +1069,19 @@ func (client *LongTermRetentionBackupsClient) updateCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-05-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // BeginUpdateByResourceGroup - Updates an existing long term retention backup. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-05-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - locationName - The location of the database. @@ -1068,7 +1097,8 @@ func (client *LongTermRetentionBackupsClient) BeginUpdateByResourceGroup(ctx con if err != nil { return nil, err } - return runtime.NewPoller[LongTermRetentionBackupsClientUpdateByResourceGroupResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[LongTermRetentionBackupsClientUpdateByResourceGroupResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[LongTermRetentionBackupsClientUpdateByResourceGroupResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -1077,20 +1107,22 @@ func (client *LongTermRetentionBackupsClient) BeginUpdateByResourceGroup(ctx con // UpdateByResourceGroup - Updates an existing long term retention backup. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-05-01-preview +// Generated from API version 2022-11-01-preview func (client *LongTermRetentionBackupsClient) updateByResourceGroup(ctx context.Context, resourceGroupName string, locationName string, longTermRetentionServerName string, longTermRetentionDatabaseName string, backupName string, parameters UpdateLongTermRetentionBackupParameters, options *LongTermRetentionBackupsClientBeginUpdateByResourceGroupOptions) (*http.Response, error) { + var err error req, err := client.updateByResourceGroupCreateRequest(ctx, resourceGroupName, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // updateByResourceGroupCreateRequest creates the UpdateByResourceGroup request. @@ -1125,8 +1157,11 @@ func (client *LongTermRetentionBackupsClient) updateByResourceGroupCreateRequest return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-05-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } diff --git a/sdk/resourcemanager/sql/armsql/longtermretentionbackups_client_example_test.go b/sdk/resourcemanager/sql/armsql/longtermretentionbackups_client_example_test.go deleted file mode 100644 index 67843ead9281..000000000000 --- a/sdk/resourcemanager/sql/armsql/longtermretentionbackups_client_example_test.go +++ /dev/null @@ -1,689 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsql_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sql/armsql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/LongTermRetentionBackupCopy.json -func ExampleLongTermRetentionBackupsClient_BeginCopy() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewLongTermRetentionBackupsClient().BeginCopy(ctx, "japaneast", "testserver", "testDatabase", "55555555-6666-7777-8888-999999999999;131637960820000000", armsql.CopyLongTermRetentionBackupParameters{ - Properties: &armsql.CopyLongTermRetentionBackupParametersProperties{ - TargetBackupStorageRedundancy: to.Ptr(armsql.BackupStorageRedundancyGeo), - TargetDatabaseName: to.Ptr("testDatabase2"), - TargetServerResourceID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/providers/Microsoft.Sql/resourceGroups/resourceGroup/servers/testserver2"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.LongTermRetentionBackupOperationResult = armsql.LongTermRetentionBackupOperationResult{ - // Name: to.Ptr("a1aa7c77-961b-4fbb-bcd6-aa9acfcd1706"), - // Type: to.Ptr("Microsoft.Sql/locations/longTermRetentionBackupOperationResults"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/providers/Microsoft.Sql/locations/japanEast/longTermRetentionBackupOperationResults/a1aa7c77-961b-4fbb-bcd6-aa9acfcd1706"), - // Properties: &armsql.LongTermRetentionOperationResultProperties{ - // FromBackupResourceID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/providers/Microsoft.Sql/locations/japanEast/longTermRetentionServers/testserver/longterRetentionDatabases/testDatabase/longTermRetentionBackups/55555555-6666-7777-8888-999999999999;131637960820000000"), - // OperationType: to.Ptr("CopyBackup"), - // RequestID: to.Ptr("a1aa7c77-961b-4fbb-bcd6-aa9acfcd1706"), - // Status: to.Ptr("Succeeded"), - // TargetBackupStorageRedundancy: to.Ptr(armsql.BackupStorageRedundancyGeo), - // ToBackupResourceID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/resourceGroup/providers/Microsoft.Sql/locations/japanEast/longTermRetentionServers/testserver2/longterRetentionDatabases/testDatabase2/longTermRetentionBackups/55555555-6666-7777-8888-111111111111;131637960820000000"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/LongTermRetentionBackupUpdate.json -func ExampleLongTermRetentionBackupsClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewLongTermRetentionBackupsClient().BeginUpdate(ctx, "japaneast", "testserver", "testDatabase", "55555555-6666-7777-8888-999999999999;131637960820000000", armsql.UpdateLongTermRetentionBackupParameters{ - Properties: &armsql.UpdateLongTermRetentionBackupParametersProperties{ - RequestedBackupStorageRedundancy: to.Ptr(armsql.BackupStorageRedundancyGeo), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.LongTermRetentionBackupOperationResult = armsql.LongTermRetentionBackupOperationResult{ - // Name: to.Ptr("a1aa7c77-961b-4fbb-bcd6-aa9acfcd1706"), - // Type: to.Ptr("Microsoft.Sql/locations/longTermRetentionBackupOperationResults"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/providers/Microsoft.Sql/locations/japanEast/longTermRetentionBackupOperationResults/a1aa7c77-961b-4fbb-bcd6-aa9acfcd1706"), - // Properties: &armsql.LongTermRetentionOperationResultProperties{ - // FromBackupResourceID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/providers/Microsoft.Sql/locations/japanEast/longTermRetentionServers/testserver/longterRetentionDatabases/testDatabase/longTermRetentionBackups/55555555-6666-7777-8888-999999999999;131637960820000000"), - // OperationType: to.Ptr("UpdateBackup"), - // RequestID: to.Ptr("a1aa7c77-961b-4fbb-bcd6-aa9acfcd1706"), - // Status: to.Ptr("Succeeded"), - // TargetBackupStorageRedundancy: to.Ptr(armsql.BackupStorageRedundancyGeo), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/LongTermRetentionBackupGet.json -func ExampleLongTermRetentionBackupsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewLongTermRetentionBackupsClient().Get(ctx, "japaneast", "testserver", "testDatabase", "55555555-6666-7777-8888-999999999999;131637960820000000", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.LongTermRetentionBackup = armsql.LongTermRetentionBackup{ - // Name: to.Ptr("2017-03-10T08:00:00.000Z;55555555-6666-7777-8888-999999999999;131637960820000000"), - // Type: to.Ptr("Microsoft.Sql/locations/longTermRetentionServers/longTermRetentionDatabases/longTermRetentionBackups"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/providers/Microsoft.Sql/locations/japaneast/longTermRetentionServers/testserver/longTermRetentionDatabases/testDatabase/longTermRetentionBackups/2017-03-10T08:00:00.000Z;55555555-6666-7777-8888-999999999999;2017-09-06T08:00:00.000Z"), - // Properties: &armsql.LongTermRetentionBackupProperties{ - // BackupStorageRedundancy: to.Ptr(armsql.BackupStorageRedundancyGeo), - // BackupTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-09-06T08:00:00Z"); return t}()), - // DatabaseName: to.Ptr("testDatabase"), - // ServerCreateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-03-10T08:00:00Z"); return t}()), - // ServerName: to.Ptr("testserver"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/LongTermRetentionBackupDelete.json -func ExampleLongTermRetentionBackupsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewLongTermRetentionBackupsClient().BeginDelete(ctx, "japaneast", "testserver", "testDatabase", "55555555-6666-7777-8888-999999999999;131637960820000000", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/LongTermRetentionBackupListByDatabase.json -func ExampleLongTermRetentionBackupsClient_NewListByDatabasePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewLongTermRetentionBackupsClient().NewListByDatabasePager("japaneast", "testserver", "testDatabase", &armsql.LongTermRetentionBackupsClientListByDatabaseOptions{OnlyLatestPerDatabase: nil, - DatabaseState: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.LongTermRetentionBackupListResult = armsql.LongTermRetentionBackupListResult{ - // Value: []*armsql.LongTermRetentionBackup{ - // { - // Name: to.Ptr("55555555-6666-7777-8888-999999999999;131637960820000000"), - // Type: to.Ptr("Microsoft.Sql/locations/longTermRetentionServers/longTermRetentionDatabases/longTermRetentionBackups"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/providers/Microsoft.Sql/locations/japaneast/longTermRetentionServers/testserver/longTermRetentionDatabases/testDatabase/longTermRetentionBackups/55555555-6666-7777-8888-999999999999;131637960820000000"), - // Properties: &armsql.LongTermRetentionBackupProperties{ - // BackupStorageRedundancy: to.Ptr(armsql.BackupStorageRedundancyGeo), - // BackupTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-08-23T08:00:00Z"); return t}()), - // DatabaseName: to.Ptr("testDatabase"), - // ServerCreateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-03-10T08:00:00Z"); return t}()), - // ServerName: to.Ptr("testserver"), - // }, - // }, - // { - // Name: to.Ptr("55555555-6666-7777-8888-999999999999;131657960820000000"), - // Type: to.Ptr("Microsoft.Sql/locations/longTermRetentionServers/longTermRetentionDatabases/longTermRetentionBackups"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/providers/Microsoft.Sql/locations/japaneast/longTermRetentionServers/testserver/longTermRetentionDatabases/testDatabase/longTermRetentionBackups/55555555-6666-7777-8888-999999999999;131657960820000000"), - // Properties: &armsql.LongTermRetentionBackupProperties{ - // BackupStorageRedundancy: to.Ptr(armsql.BackupStorageRedundancyGeo), - // BackupTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-08-30T08:00:00Z"); return t}()), - // DatabaseName: to.Ptr("testDatabase"), - // ServerCreateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-03-10T08:00:00Z"); return t}()), - // ServerName: to.Ptr("testserver"), - // }, - // }, - // { - // Name: to.Ptr("55555555-6666-7777-8888-999999999999;131677960820000000"), - // Type: to.Ptr("Microsoft.Sql/locations/longTermRetentionServers/longTermRetentionDatabases/longTermRetentionBackups"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/providers/Microsoft.Sql/locations/japaneast/longTermRetentionServers/testserver/longTermRetentionDatabases/testDatabase/longTermRetentionBackups/55555555-6666-7777-8888-999999999999;131677960820000000"), - // Properties: &armsql.LongTermRetentionBackupProperties{ - // BackupStorageRedundancy: to.Ptr(armsql.BackupStorageRedundancyGeo), - // BackupTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-09-06T08:00:00Z"); return t}()), - // DatabaseDeletionTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-09-07T08:00:00Z"); return t}()), - // DatabaseName: to.Ptr("testDatabase"), - // ServerCreateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-03-10T08:00:00Z"); return t}()), - // ServerName: to.Ptr("testserver"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/LongTermRetentionBackupListByLocation.json -func ExampleLongTermRetentionBackupsClient_NewListByLocationPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewLongTermRetentionBackupsClient().NewListByLocationPager("japaneast", &armsql.LongTermRetentionBackupsClientListByLocationOptions{OnlyLatestPerDatabase: nil, - DatabaseState: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.LongTermRetentionBackupListResult = armsql.LongTermRetentionBackupListResult{ - // Value: []*armsql.LongTermRetentionBackup{ - // { - // Name: to.Ptr("55555555-6666-7777-8888-999999999999;2017-08-23T08:00:00.000Z"), - // Type: to.Ptr("Microsoft.Sql/locations/longTermRetentionServers/longTermRetentionDatabases/longTermRetentionBackups"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/providers/Microsoft.Sql/locations/japaneast/longTermRetentionServers/testserver1/longTermRetentionDatabases/testDatabase1/longTermRetentionBackups/55555555-6666-7777-8888-999999999999;131637960820000000"), - // Properties: &armsql.LongTermRetentionBackupProperties{ - // BackupStorageRedundancy: to.Ptr(armsql.BackupStorageRedundancyGeo), - // BackupTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-08-23T08:00:00Z"); return t}()), - // DatabaseName: to.Ptr("testDatabase1"), - // ServerCreateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-03-10T08:00:00Z"); return t}()), - // ServerName: to.Ptr("testserver1"), - // }, - // }, - // { - // Name: to.Ptr("12341234-1234-1234-1234-123123123123;2017-08-30T08:00:00.000Z"), - // Type: to.Ptr("Microsoft.Sql/locations/longTermRetentionServers/longTermRetentionDatabases/longTermRetentionBackups"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/providers/Microsoft.Sql/locations/japaneast/longTermRetentionServers/testserver2/longTermRetentionDatabases/testDatabase2/longTermRetentionBackups/12341234-1234-1234-1234-123123123123;131657960820000000"), - // Properties: &armsql.LongTermRetentionBackupProperties{ - // BackupStorageRedundancy: to.Ptr(armsql.BackupStorageRedundancyGeo), - // BackupTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-08-30T08:00:00Z"); return t}()), - // DatabaseName: to.Ptr("testDatabase2"), - // ServerCreateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-04-10T08:00:00Z"); return t}()), - // ServerName: to.Ptr("testserver2"), - // }, - // }, - // { - // Name: to.Ptr("43214321-4321-4321-4321-321321321321;2017-09-06T08:00:00.000Z"), - // Type: to.Ptr("Microsoft.Sql/locations/longTermRetentionServers/longTermRetentionDatabases/longTermRetentionBackups"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/providers/Microsoft.Sql/locations/japaneast/longTermRetentionServers/testserver3/longTermRetentionDatabases/testDatabase3/longTermRetentionBackups/43214321-4321-4321-4321-321321321321;131677960820000000"), - // Properties: &armsql.LongTermRetentionBackupProperties{ - // BackupStorageRedundancy: to.Ptr(armsql.BackupStorageRedundancyGeo), - // BackupTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-09-06T08:00:00Z"); return t}()), - // DatabaseName: to.Ptr("testDatabase3"), - // ServerCreateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-05-10T08:00:00Z"); return t}()), - // ServerName: to.Ptr("testserver3"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/LongTermRetentionBackupListByServer.json -func ExampleLongTermRetentionBackupsClient_NewListByServerPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewLongTermRetentionBackupsClient().NewListByServerPager("japaneast", "testserver", &armsql.LongTermRetentionBackupsClientListByServerOptions{OnlyLatestPerDatabase: nil, - DatabaseState: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.LongTermRetentionBackupListResult = armsql.LongTermRetentionBackupListResult{ - // Value: []*armsql.LongTermRetentionBackup{ - // { - // Name: to.Ptr("55555555-6666-7777-8888-999999999999;131637960820000000"), - // Type: to.Ptr("Microsoft.Sql/locations/longTermRetentionServers/longTermRetentionDatabases/longTermRetentionBackups"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/providers/Microsoft.Sql/locations/japaneast/longTermRetentionServers/testserver/longTermRetentionDatabases/testDatabase1/longTermRetentionBackups/55555555-6666-7777-8888-999999999999;131637960820000000"), - // Properties: &armsql.LongTermRetentionBackupProperties{ - // BackupStorageRedundancy: to.Ptr(armsql.BackupStorageRedundancyGeo), - // BackupTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-08-23T08:00:00Z"); return t}()), - // DatabaseName: to.Ptr("testDatabase1"), - // ServerCreateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-03-10T08:00:00Z"); return t}()), - // ServerName: to.Ptr("testserver"), - // }, - // }, - // { - // Name: to.Ptr("12341234-1234-1234-1234-123123123123;131657960820000000"), - // Type: to.Ptr("Microsoft.Sql/locations/longTermRetentionServers/longTermRetentionDatabases/longTermRetentionBackups"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/providers/Microsoft.Sql/locations/japaneast/longTermRetentionServers/testserver/longTermRetentionDatabases/testDatabase2/longTermRetentionBackups/12341234-1234-1234-1234-123123123123;131657960820000000"), - // Properties: &armsql.LongTermRetentionBackupProperties{ - // BackupStorageRedundancy: to.Ptr(armsql.BackupStorageRedundancyGeo), - // BackupTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-08-30T08:00:00Z"); return t}()), - // DatabaseName: to.Ptr("testDatabase2"), - // ServerCreateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-03-10T08:00:00Z"); return t}()), - // ServerName: to.Ptr("testserver"), - // }, - // }, - // { - // Name: to.Ptr("43214321-4321-4321-4321-321321321321;131667960820000000"), - // Type: to.Ptr("Microsoft.Sql/locations/longTermRetentionServers/longTermRetentionDatabases/longTermRetentionBackups"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/providers/Microsoft.Sql/locations/japaneast/longTermRetentionServers/testserver/longTermRetentionDatabases/testDatabase3/longTermRetentionBackups/43214321-4321-4321-4321-321321321321;131677960820000000"), - // Properties: &armsql.LongTermRetentionBackupProperties{ - // BackupStorageRedundancy: to.Ptr(armsql.BackupStorageRedundancyGeo), - // BackupTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-09-06T08:00:00Z"); return t}()), - // DatabaseName: to.Ptr("testDatabase3"), - // ServerCreateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-03-10T08:00:00Z"); return t}()), - // ServerName: to.Ptr("testserver"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ResourceGroupBasedLongTermRetentionBackupCopy.json -func ExampleLongTermRetentionBackupsClient_BeginCopyByResourceGroup() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewLongTermRetentionBackupsClient().BeginCopyByResourceGroup(ctx, "testResourceGroup", "japaneast", "testserver", "testDatabase", "55555555-6666-7777-8888-999999999999;131637960820000000", armsql.CopyLongTermRetentionBackupParameters{ - Properties: &armsql.CopyLongTermRetentionBackupParametersProperties{ - TargetBackupStorageRedundancy: to.Ptr(armsql.BackupStorageRedundancyGeo), - TargetDatabaseName: to.Ptr("testDatabase2"), - TargetServerResourceID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/providers/Microsoft.Sql/resourceGroups/resourceGroup/servers/testserver2"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.LongTermRetentionBackupOperationResult = armsql.LongTermRetentionBackupOperationResult{ - // Name: to.Ptr("a1aa7c77-961b-4fbb-bcd6-aa9acfcd1706"), - // Type: to.Ptr("Microsoft.Sql/locations/longTermRetentionBackupOperationResults"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testResourceGroup/providers/Microsoft.Sql/locations/japanEast/longTermRetentionBackupOperationResults/a1aa7c77-961b-4fbb-bcd6-aa9acfcd1706"), - // Properties: &armsql.LongTermRetentionOperationResultProperties{ - // FromBackupResourceID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testResourceGroup/providers/Microsoft.Sql/locations/japanEast/longTermRetentionServers/testserver/longterRetentionDatabases/testDatabase/longTermRetentionBackups/55555555-6666-7777-8888-999999999999;131637960820000000"), - // OperationType: to.Ptr("CopyBackup"), - // RequestID: to.Ptr("a1aa7c77-961b-4fbb-bcd6-aa9acfcd1706"), - // Status: to.Ptr("Succeeded"), - // TargetBackupStorageRedundancy: to.Ptr(armsql.BackupStorageRedundancyGeo), - // ToBackupResourceID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/resourceGroup/providers/Microsoft.Sql/locations/japanEast/longTermRetentionServers/testserver2/longterRetentionDatabases/testDatabase2/longTermRetentionBackups/55555555-6666-7777-8888-111111111111;131637960820000000"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ResourceGroupBasedLongTermRetentionBackupUpdate.json -func ExampleLongTermRetentionBackupsClient_BeginUpdateByResourceGroup() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewLongTermRetentionBackupsClient().BeginUpdateByResourceGroup(ctx, "testResourceGroup", "japaneast", "testserver", "testDatabase", "55555555-6666-7777-8888-999999999999;131637960820000000", armsql.UpdateLongTermRetentionBackupParameters{ - Properties: &armsql.UpdateLongTermRetentionBackupParametersProperties{ - RequestedBackupStorageRedundancy: to.Ptr(armsql.BackupStorageRedundancyGeo), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.LongTermRetentionBackupOperationResult = armsql.LongTermRetentionBackupOperationResult{ - // Name: to.Ptr("a1aa7c77-961b-4fbb-bcd6-aa9acfcd1706"), - // Type: to.Ptr("Microsoft.Sql/locations/longTermRetentionBackupOperationResults"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testResourceGroup/providers/Microsoft.Sql/locations/japanEast/longTermRetentionBackupOperationResults/a1aa7c77-961b-4fbb-bcd6-aa9acfcd1706"), - // Properties: &armsql.LongTermRetentionOperationResultProperties{ - // FromBackupResourceID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testResourceGroup/providers/Microsoft.Sql/locations/japanEast/longTermRetentionServers/testserver/longterRetentionDatabases/testDatabase/longTermRetentionBackups/55555555-6666-7777-8888-999999999999;131637960820000000"), - // OperationType: to.Ptr("UpdateBackup"), - // RequestID: to.Ptr("a1aa7c77-961b-4fbb-bcd6-aa9acfcd1706"), - // Status: to.Ptr("Succeeded"), - // TargetBackupStorageRedundancy: to.Ptr(armsql.BackupStorageRedundancyGeo), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ResourceGroupBasedLongTermRetentionBackupGet.json -func ExampleLongTermRetentionBackupsClient_GetByResourceGroup() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewLongTermRetentionBackupsClient().GetByResourceGroup(ctx, "testResourceGroup", "japaneast", "testserver", "testDatabase", "55555555-6666-7777-8888-999999999999;131637960820000000", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.LongTermRetentionBackup = armsql.LongTermRetentionBackup{ - // Name: to.Ptr("2017-03-10T08:00:00.000Z;55555555-6666-7777-8888-999999999999;131637960820000000"), - // Type: to.Ptr("Microsoft.Sql/locations/longTermRetentionServers/longTermRetentionDatabases/longTermRetentionBackups"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testResourceGroup/providers/Microsoft.Sql/locations/japaneast/longTermRetentionServers/testserver/longTermRetentionDatabases/testDatabase/longTermRetentionBackups/2017-03-10T08:00:00.000Z;55555555-6666-7777-8888-999999999999;2017-09-06T08:00:00.000Z"), - // Properties: &armsql.LongTermRetentionBackupProperties{ - // BackupStorageRedundancy: to.Ptr(armsql.BackupStorageRedundancyGeo), - // BackupTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-09-06T08:00:00Z"); return t}()), - // DatabaseName: to.Ptr("testDatabase"), - // ServerCreateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-03-10T08:00:00Z"); return t}()), - // ServerName: to.Ptr("testserver"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ResourceGroupBasedLongTermRetentionBackupDelete.json -func ExampleLongTermRetentionBackupsClient_BeginDeleteByResourceGroup() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewLongTermRetentionBackupsClient().BeginDeleteByResourceGroup(ctx, "testResourceGroup", "japaneast", "testserver", "testDatabase", "55555555-6666-7777-8888-999999999999;131637960820000000", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ResourceGroupBasedLongTermRetentionBackupListByDatabase.json -func ExampleLongTermRetentionBackupsClient_NewListByResourceGroupDatabasePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewLongTermRetentionBackupsClient().NewListByResourceGroupDatabasePager("testResourceGroup", "japaneast", "testserver", "testDatabase", &armsql.LongTermRetentionBackupsClientListByResourceGroupDatabaseOptions{OnlyLatestPerDatabase: nil, - DatabaseState: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.LongTermRetentionBackupListResult = armsql.LongTermRetentionBackupListResult{ - // Value: []*armsql.LongTermRetentionBackup{ - // { - // Name: to.Ptr("55555555-6666-7777-8888-999999999999;131637960820000000"), - // Type: to.Ptr("Microsoft.Sql/locations/longTermRetentionServers/longTermRetentionDatabases/longTermRetentionBackups"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testResourceGroup/providers/Microsoft.Sql/locations/japaneast/longTermRetentionServers/testserver/longTermRetentionDatabases/testDatabase/longTermRetentionBackups/55555555-6666-7777-8888-999999999999;131637960820000000"), - // Properties: &armsql.LongTermRetentionBackupProperties{ - // BackupStorageRedundancy: to.Ptr(armsql.BackupStorageRedundancyGeo), - // BackupTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-08-23T08:00:00Z"); return t}()), - // DatabaseName: to.Ptr("testDatabase"), - // ServerCreateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-03-10T08:00:00Z"); return t}()), - // ServerName: to.Ptr("testserver"), - // }, - // }, - // { - // Name: to.Ptr("55555555-6666-7777-8888-999999999999;131657960820000000"), - // Type: to.Ptr("Microsoft.Sql/locations/longTermRetentionServers/longTermRetentionDatabases/longTermRetentionBackups"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testResourceGroup/providers/Microsoft.Sql/locations/japaneast/longTermRetentionServers/testserver/longTermRetentionDatabases/testDatabase/longTermRetentionBackups/55555555-6666-7777-8888-999999999999;131657960820000000"), - // Properties: &armsql.LongTermRetentionBackupProperties{ - // BackupStorageRedundancy: to.Ptr(armsql.BackupStorageRedundancyGeo), - // BackupTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-08-30T08:00:00Z"); return t}()), - // DatabaseName: to.Ptr("testDatabase"), - // ServerCreateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-03-10T08:00:00Z"); return t}()), - // ServerName: to.Ptr("testserver"), - // }, - // }, - // { - // Name: to.Ptr("55555555-6666-7777-8888-999999999999;131677960820000000"), - // Type: to.Ptr("Microsoft.Sql/locations/longTermRetentionServers/longTermRetentionDatabases/longTermRetentionBackups"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testResourceGroup/providers/Microsoft.Sql/locations/japaneast/longTermRetentionServers/testserver/longTermRetentionDatabases/testDatabase/longTermRetentionBackups/55555555-6666-7777-8888-999999999999;131677960820000000"), - // Properties: &armsql.LongTermRetentionBackupProperties{ - // BackupStorageRedundancy: to.Ptr(armsql.BackupStorageRedundancyGeo), - // BackupTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-09-06T08:00:00Z"); return t}()), - // DatabaseDeletionTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-09-07T08:00:00Z"); return t}()), - // DatabaseName: to.Ptr("testDatabase"), - // ServerCreateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-03-10T08:00:00Z"); return t}()), - // ServerName: to.Ptr("testserver"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ResourceGroupBasedLongTermRetentionBackupListByLocation.json -func ExampleLongTermRetentionBackupsClient_NewListByResourceGroupLocationPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewLongTermRetentionBackupsClient().NewListByResourceGroupLocationPager("testResourceGroup", "japaneast", &armsql.LongTermRetentionBackupsClientListByResourceGroupLocationOptions{OnlyLatestPerDatabase: nil, - DatabaseState: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.LongTermRetentionBackupListResult = armsql.LongTermRetentionBackupListResult{ - // Value: []*armsql.LongTermRetentionBackup{ - // { - // Name: to.Ptr("55555555-6666-7777-8888-999999999999;2017-08-23T08:00:00.000Z"), - // Type: to.Ptr("Microsoft.Sql/locations/longTermRetentionServers/longTermRetentionDatabases/longTermRetentionBackups"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testResourceGroup/providers/Microsoft.Sql/locations/japaneast/longTermRetentionServers/testserver1/longTermRetentionDatabases/testDatabase1/longTermRetentionBackups/55555555-6666-7777-8888-999999999999;131637960820000000"), - // Properties: &armsql.LongTermRetentionBackupProperties{ - // BackupStorageRedundancy: to.Ptr(armsql.BackupStorageRedundancyGeo), - // BackupTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-08-23T08:00:00Z"); return t}()), - // DatabaseName: to.Ptr("testDatabase1"), - // ServerCreateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-03-10T08:00:00Z"); return t}()), - // ServerName: to.Ptr("testserver1"), - // }, - // }, - // { - // Name: to.Ptr("12341234-1234-1234-1234-123123123123;2017-08-30T08:00:00.000Z"), - // Type: to.Ptr("Microsoft.Sql/locations/longTermRetentionServers/longTermRetentionDatabases/longTermRetentionBackups"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testResourceGroup/providers/Microsoft.Sql/locations/japaneast/longTermRetentionServers/testserver2/longTermRetentionDatabases/testDatabase2/longTermRetentionBackups/12341234-1234-1234-1234-123123123123;131657960820000000"), - // Properties: &armsql.LongTermRetentionBackupProperties{ - // BackupStorageRedundancy: to.Ptr(armsql.BackupStorageRedundancyGeo), - // BackupTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-08-30T08:00:00Z"); return t}()), - // DatabaseName: to.Ptr("testDatabase2"), - // ServerCreateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-04-10T08:00:00Z"); return t}()), - // ServerName: to.Ptr("testserver2"), - // }, - // }, - // { - // Name: to.Ptr("43214321-4321-4321-4321-321321321321;2017-09-06T08:00:00.000Z"), - // Type: to.Ptr("Microsoft.Sql/locations/longTermRetentionServers/longTermRetentionDatabases/longTermRetentionBackups"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testResourceGroup/providers/Microsoft.Sql/locations/japaneast/longTermRetentionServers/testserver3/longTermRetentionDatabases/testDatabase3/longTermRetentionBackups/43214321-4321-4321-4321-321321321321;131677960820000000"), - // Properties: &armsql.LongTermRetentionBackupProperties{ - // BackupStorageRedundancy: to.Ptr(armsql.BackupStorageRedundancyGeo), - // BackupTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-09-06T08:00:00Z"); return t}()), - // DatabaseName: to.Ptr("testDatabase3"), - // ServerCreateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-05-10T08:00:00Z"); return t}()), - // ServerName: to.Ptr("testserver3"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ResourceGroupBasedLongTermRetentionBackupListByServer.json -func ExampleLongTermRetentionBackupsClient_NewListByResourceGroupServerPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewLongTermRetentionBackupsClient().NewListByResourceGroupServerPager("testResourceGroup", "japaneast", "testserver", &armsql.LongTermRetentionBackupsClientListByResourceGroupServerOptions{OnlyLatestPerDatabase: nil, - DatabaseState: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.LongTermRetentionBackupListResult = armsql.LongTermRetentionBackupListResult{ - // Value: []*armsql.LongTermRetentionBackup{ - // { - // Name: to.Ptr("55555555-6666-7777-8888-999999999999;131637960820000000"), - // Type: to.Ptr("Microsoft.Sql/locations/longTermRetentionServers/longTermRetentionDatabases/longTermRetentionBackups"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testResourceGroup/providers/Microsoft.Sql/locations/japaneast/longTermRetentionServers/testserver/longTermRetentionDatabases/testDatabase1/longTermRetentionBackups/55555555-6666-7777-8888-999999999999;131637960820000000"), - // Properties: &armsql.LongTermRetentionBackupProperties{ - // BackupStorageRedundancy: to.Ptr(armsql.BackupStorageRedundancyGeo), - // BackupTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-08-23T08:00:00Z"); return t}()), - // DatabaseName: to.Ptr("testDatabase1"), - // ServerCreateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-03-10T08:00:00Z"); return t}()), - // ServerName: to.Ptr("testserver"), - // }, - // }, - // { - // Name: to.Ptr("12341234-1234-1234-1234-123123123123;131657960820000000"), - // Type: to.Ptr("Microsoft.Sql/locations/longTermRetentionServers/longTermRetentionDatabases/longTermRetentionBackups"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testResourceGroup/providers/Microsoft.Sql/locations/japaneast/longTermRetentionServers/testserver/longTermRetentionDatabases/testDatabase2/longTermRetentionBackups/12341234-1234-1234-1234-123123123123;131657960820000000"), - // Properties: &armsql.LongTermRetentionBackupProperties{ - // BackupStorageRedundancy: to.Ptr(armsql.BackupStorageRedundancyGeo), - // BackupTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-08-30T08:00:00Z"); return t}()), - // DatabaseName: to.Ptr("testDatabase2"), - // ServerCreateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-03-10T08:00:00Z"); return t}()), - // ServerName: to.Ptr("testserver"), - // }, - // }, - // { - // Name: to.Ptr("43214321-4321-4321-4321-321321321321;131667960820000000"), - // Type: to.Ptr("Microsoft.Sql/locations/longTermRetentionServers/longTermRetentionDatabases/longTermRetentionBackups"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testResourceGroup/providers/Microsoft.Sql/locations/japaneast/longTermRetentionServers/testserver/longTermRetentionDatabases/testDatabase3/longTermRetentionBackups/43214321-4321-4321-4321-321321321321;131677960820000000"), - // Properties: &armsql.LongTermRetentionBackupProperties{ - // BackupStorageRedundancy: to.Ptr(armsql.BackupStorageRedundancyGeo), - // BackupTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-09-06T08:00:00Z"); return t}()), - // DatabaseName: to.Ptr("testDatabase3"), - // ServerCreateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-03-10T08:00:00Z"); return t}()), - // ServerName: to.Ptr("testserver"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/sql/armsql/longtermretentionmanagedinstancebackups_client.go b/sdk/resourcemanager/sql/armsql/longtermretentionmanagedinstancebackups_client.go index bc2257544cd6..67bbcab5e821 100644 --- a/sdk/resourcemanager/sql/armsql/longtermretentionmanagedinstancebackups_client.go +++ b/sdk/resourcemanager/sql/armsql/longtermretentionmanagedinstancebackups_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armsql @@ -48,7 +47,7 @@ func NewLongTermRetentionManagedInstanceBackupsClient(subscriptionID string, cre // BeginDelete - Deletes a long term retention backup. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-05-01-preview +// Generated from API version 2022-11-01-preview // - locationName - The location of the database. // - managedInstanceName - The name of the managed instance. // - databaseName - The name of the managed database. @@ -61,7 +60,8 @@ func (client *LongTermRetentionManagedInstanceBackupsClient) BeginDelete(ctx con if err != nil { return nil, err } - return runtime.NewPoller[LongTermRetentionManagedInstanceBackupsClientDeleteResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[LongTermRetentionManagedInstanceBackupsClientDeleteResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[LongTermRetentionManagedInstanceBackupsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -70,20 +70,22 @@ func (client *LongTermRetentionManagedInstanceBackupsClient) BeginDelete(ctx con // Delete - Deletes a long term retention backup. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-05-01-preview +// Generated from API version 2022-11-01-preview func (client *LongTermRetentionManagedInstanceBackupsClient) deleteOperation(ctx context.Context, locationName string, managedInstanceName string, databaseName string, backupName string, options *LongTermRetentionManagedInstanceBackupsClientBeginDeleteOptions) (*http.Response, error) { + var err error req, err := client.deleteCreateRequest(ctx, locationName, managedInstanceName, databaseName, backupName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteCreateRequest creates the Delete request. @@ -114,7 +116,7 @@ func (client *LongTermRetentionManagedInstanceBackupsClient) deleteCreateRequest return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-05-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -122,7 +124,7 @@ func (client *LongTermRetentionManagedInstanceBackupsClient) deleteCreateRequest // BeginDeleteByResourceGroup - Deletes a long term retention backup. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-05-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - locationName - The location of the database @@ -137,7 +139,8 @@ func (client *LongTermRetentionManagedInstanceBackupsClient) BeginDeleteByResour if err != nil { return nil, err } - return runtime.NewPoller[LongTermRetentionManagedInstanceBackupsClientDeleteByResourceGroupResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[LongTermRetentionManagedInstanceBackupsClientDeleteByResourceGroupResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[LongTermRetentionManagedInstanceBackupsClientDeleteByResourceGroupResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -146,20 +149,22 @@ func (client *LongTermRetentionManagedInstanceBackupsClient) BeginDeleteByResour // DeleteByResourceGroup - Deletes a long term retention backup. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-05-01-preview +// Generated from API version 2022-11-01-preview func (client *LongTermRetentionManagedInstanceBackupsClient) deleteByResourceGroup(ctx context.Context, resourceGroupName string, locationName string, managedInstanceName string, databaseName string, backupName string, options *LongTermRetentionManagedInstanceBackupsClientBeginDeleteByResourceGroupOptions) (*http.Response, error) { + var err error req, err := client.deleteByResourceGroupCreateRequest(ctx, resourceGroupName, locationName, managedInstanceName, databaseName, backupName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteByResourceGroupCreateRequest creates the DeleteByResourceGroup request. @@ -194,7 +199,7 @@ func (client *LongTermRetentionManagedInstanceBackupsClient) deleteByResourceGro return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-05-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -202,7 +207,7 @@ func (client *LongTermRetentionManagedInstanceBackupsClient) deleteByResourceGro // Get - Gets a long term retention backup for a managed database. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-05-01-preview +// Generated from API version 2022-11-01-preview // - locationName - The location of the database. // - managedInstanceName - The name of the managed instance. // - databaseName - The name of the managed database. @@ -210,18 +215,21 @@ func (client *LongTermRetentionManagedInstanceBackupsClient) deleteByResourceGro // - options - LongTermRetentionManagedInstanceBackupsClientGetOptions contains the optional parameters for the LongTermRetentionManagedInstanceBackupsClient.Get // method. func (client *LongTermRetentionManagedInstanceBackupsClient) Get(ctx context.Context, locationName string, managedInstanceName string, databaseName string, backupName string, options *LongTermRetentionManagedInstanceBackupsClientGetOptions) (LongTermRetentionManagedInstanceBackupsClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, locationName, managedInstanceName, databaseName, backupName, options) if err != nil { return LongTermRetentionManagedInstanceBackupsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return LongTermRetentionManagedInstanceBackupsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return LongTermRetentionManagedInstanceBackupsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return LongTermRetentionManagedInstanceBackupsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -252,7 +260,7 @@ func (client *LongTermRetentionManagedInstanceBackupsClient) getCreateRequest(ct return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-05-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -270,7 +278,7 @@ func (client *LongTermRetentionManagedInstanceBackupsClient) getHandleResponse(r // GetByResourceGroup - Gets a long term retention backup for a managed database. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-05-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - locationName - The location of the database. @@ -280,18 +288,21 @@ func (client *LongTermRetentionManagedInstanceBackupsClient) getHandleResponse(r // - options - LongTermRetentionManagedInstanceBackupsClientGetByResourceGroupOptions contains the optional parameters for the // LongTermRetentionManagedInstanceBackupsClient.GetByResourceGroup method. func (client *LongTermRetentionManagedInstanceBackupsClient) GetByResourceGroup(ctx context.Context, resourceGroupName string, locationName string, managedInstanceName string, databaseName string, backupName string, options *LongTermRetentionManagedInstanceBackupsClientGetByResourceGroupOptions) (LongTermRetentionManagedInstanceBackupsClientGetByResourceGroupResponse, error) { + var err error req, err := client.getByResourceGroupCreateRequest(ctx, resourceGroupName, locationName, managedInstanceName, databaseName, backupName, options) if err != nil { return LongTermRetentionManagedInstanceBackupsClientGetByResourceGroupResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return LongTermRetentionManagedInstanceBackupsClientGetByResourceGroupResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return LongTermRetentionManagedInstanceBackupsClientGetByResourceGroupResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return LongTermRetentionManagedInstanceBackupsClientGetByResourceGroupResponse{}, err } - return client.getByResourceGroupHandleResponse(resp) + resp, err := client.getByResourceGroupHandleResponse(httpResp) + return resp, err } // getByResourceGroupCreateRequest creates the GetByResourceGroup request. @@ -326,7 +337,7 @@ func (client *LongTermRetentionManagedInstanceBackupsClient) getByResourceGroupC return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-05-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -343,7 +354,7 @@ func (client *LongTermRetentionManagedInstanceBackupsClient) getByResourceGroupH // NewListByDatabasePager - Lists all long term retention backups for a managed database. // -// Generated from API version 2021-05-01-preview +// Generated from API version 2022-11-01-preview // - locationName - The location of the database. // - managedInstanceName - The name of the managed instance. // - databaseName - The name of the managed database. @@ -407,7 +418,7 @@ func (client *LongTermRetentionManagedInstanceBackupsClient) listByDatabaseCreat if options != nil && options.DatabaseState != nil { reqQP.Set("databaseState", string(*options.DatabaseState)) } - reqQP.Set("api-version", "2021-05-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -424,7 +435,7 @@ func (client *LongTermRetentionManagedInstanceBackupsClient) listByDatabaseHandl // NewListByInstancePager - Lists the long term retention backups for a given managed instance. // -// Generated from API version 2021-05-01-preview +// Generated from API version 2022-11-01-preview // - locationName - The location of the database // - managedInstanceName - The name of the managed instance. // - options - LongTermRetentionManagedInstanceBackupsClientListByInstanceOptions contains the optional parameters for the LongTermRetentionManagedInstanceBackupsClient.NewListByInstancePager @@ -483,7 +494,7 @@ func (client *LongTermRetentionManagedInstanceBackupsClient) listByInstanceCreat if options != nil && options.DatabaseState != nil { reqQP.Set("databaseState", string(*options.DatabaseState)) } - reqQP.Set("api-version", "2021-05-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -500,7 +511,7 @@ func (client *LongTermRetentionManagedInstanceBackupsClient) listByInstanceHandl // NewListByLocationPager - Lists the long term retention backups for managed databases in a given location. // -// Generated from API version 2021-05-01-preview +// Generated from API version 2022-11-01-preview // - locationName - The location of the database. // - options - LongTermRetentionManagedInstanceBackupsClientListByLocationOptions contains the optional parameters for the LongTermRetentionManagedInstanceBackupsClient.NewListByLocationPager // method. @@ -554,7 +565,7 @@ func (client *LongTermRetentionManagedInstanceBackupsClient) listByLocationCreat if options != nil && options.DatabaseState != nil { reqQP.Set("databaseState", string(*options.DatabaseState)) } - reqQP.Set("api-version", "2021-05-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -571,7 +582,7 @@ func (client *LongTermRetentionManagedInstanceBackupsClient) listByLocationHandl // NewListByResourceGroupDatabasePager - Lists all long term retention backups for a managed database. // -// Generated from API version 2021-05-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - locationName - The location of the database @@ -641,7 +652,7 @@ func (client *LongTermRetentionManagedInstanceBackupsClient) listByResourceGroup if options != nil && options.DatabaseState != nil { reqQP.Set("databaseState", string(*options.DatabaseState)) } - reqQP.Set("api-version", "2021-05-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -658,7 +669,7 @@ func (client *LongTermRetentionManagedInstanceBackupsClient) listByResourceGroup // NewListByResourceGroupInstancePager - Lists the long term retention backups for a given managed instance. // -// Generated from API version 2021-05-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - locationName - The location of the database. @@ -723,7 +734,7 @@ func (client *LongTermRetentionManagedInstanceBackupsClient) listByResourceGroup if options != nil && options.DatabaseState != nil { reqQP.Set("databaseState", string(*options.DatabaseState)) } - reqQP.Set("api-version", "2021-05-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -740,7 +751,7 @@ func (client *LongTermRetentionManagedInstanceBackupsClient) listByResourceGroup // NewListByResourceGroupLocationPager - Lists the long term retention backups for managed databases in a given location. // -// Generated from API version 2021-05-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - locationName - The location of the database. @@ -800,7 +811,7 @@ func (client *LongTermRetentionManagedInstanceBackupsClient) listByResourceGroup if options != nil && options.DatabaseState != nil { reqQP.Set("databaseState", string(*options.DatabaseState)) } - reqQP.Set("api-version", "2021-05-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/sql/armsql/longtermretentionmanagedinstancebackups_client_example_test.go b/sdk/resourcemanager/sql/armsql/longtermretentionmanagedinstancebackups_client_example_test.go deleted file mode 100644 index e79d22b8ca5d..000000000000 --- a/sdk/resourcemanager/sql/armsql/longtermretentionmanagedinstancebackups_client_example_test.go +++ /dev/null @@ -1,522 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsql_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sql/armsql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ManagedInstanceLongTermRetentionBackupGet.json -func ExampleLongTermRetentionManagedInstanceBackupsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewLongTermRetentionManagedInstanceBackupsClient().Get(ctx, "japaneast", "testInstance", "testDatabase", "55555555-6666-7777-8888-999999999999;131637960820000000", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ManagedInstanceLongTermRetentionBackup = armsql.ManagedInstanceLongTermRetentionBackup{ - // Name: to.Ptr("55555555-6666-7777-8888-999999999999;131637960820000000"), - // Type: to.Ptr("Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/providers/Microsoft.Sql/Locations/japaneast/longTermRetentionManagedInstances/testInstance/longTermRetentionDatabases/testDatabase/longTermRetentionManagedInstanceBackups/55555555-6666-7777-8888-999999999999;131637960820000000"), - // Properties: &armsql.ManagedInstanceLongTermRetentionBackupProperties{ - // BackupStorageRedundancy: to.Ptr(armsql.BackupStorageRedundancyGeo), - // BackupTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-08-23T08:00:00Z"); return t}()), - // DatabaseName: to.Ptr("testDatabase"), - // ManagedInstanceCreateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-09-01T08:00:00Z"); return t}()), - // ManagedInstanceName: to.Ptr("testInstance"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ManagedInstanceLongTermRetentionBackupDelete.json -func ExampleLongTermRetentionManagedInstanceBackupsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewLongTermRetentionManagedInstanceBackupsClient().BeginDelete(ctx, "japaneast", "testInstance", "testDatabase", "55555555-6666-7777-8888-999999999999;131637960820000000", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ManagedInstanceLongTermRetentionBackupListByDatabase.json -func ExampleLongTermRetentionManagedInstanceBackupsClient_NewListByDatabasePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewLongTermRetentionManagedInstanceBackupsClient().NewListByDatabasePager("japaneast", "testInstance", "testDatabase", &armsql.LongTermRetentionManagedInstanceBackupsClientListByDatabaseOptions{OnlyLatestPerDatabase: nil, - DatabaseState: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ManagedInstanceLongTermRetentionBackupListResult = armsql.ManagedInstanceLongTermRetentionBackupListResult{ - // Value: []*armsql.ManagedInstanceLongTermRetentionBackup{ - // { - // Name: to.Ptr("2018-06-01T08:00:00.000Z;55555555-6666-7777-8888-999999999999;2018-08-23T08:00:00.000Z"), - // Type: to.Ptr("Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/providers/Microsoft.Sql/Locations/japaneast/longTermRetentionManagedInstances/testInstance/longTermRetentionDatabases/testDatabase/longTermRetentionManagedInstanceBackups/2018-06-01T08:00:00.000Z;55555555-6666-7777-8888-999999999999;2018-08-23T08:00:00.000Z"), - // Properties: &armsql.ManagedInstanceLongTermRetentionBackupProperties{ - // BackupStorageRedundancy: to.Ptr(armsql.BackupStorageRedundancyGeo), - // BackupTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-08-23T08:00:00Z"); return t}()), - // DatabaseName: to.Ptr("testDatabase"), - // ManagedInstanceCreateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-03-10T08:00:00Z"); return t}()), - // ManagedInstanceName: to.Ptr("testInstance"), - // }, - // }, - // { - // Name: to.Ptr("2018-06-01T08:00:00.000Z;55555555-6666-7777-8888-999999999999;2018-08-30T08:00:00.000Z"), - // Type: to.Ptr("Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/providers/Microsoft.Sql/Locations/japaneast/longTermRetentionManagedInstances/testInstance/longTermRetentionDatabases/testDatabase/longTermRetentionManagedInstanceBackups/2018-06-01T08:00:00.000Z;55555555-6666-7777-8888-999999999999;2018-08-30T08:00:00.000Z"), - // Properties: &armsql.ManagedInstanceLongTermRetentionBackupProperties{ - // BackupStorageRedundancy: to.Ptr(armsql.BackupStorageRedundancyGeo), - // BackupTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-08-30T08:00:00Z"); return t}()), - // DatabaseName: to.Ptr("testDatabase"), - // ManagedInstanceCreateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-03-10T08:00:00Z"); return t}()), - // ManagedInstanceName: to.Ptr("testInstance"), - // }, - // }, - // { - // Name: to.Ptr("2018-06-01T08:00:00.000Z;55555555-6666-7777-8888-999999999999;2018-09-06T08:00:00.000Z"), - // Type: to.Ptr("Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/providers/Microsoft.Sql/Locations/japaneast/longTermRetentionManagedInstances/testInstance/longTermRetentionDatabases/testDatabase/longTermRetentionManagedInstanceBackups/2018-06-01T08:00:00.000Z;55555555-6666-7777-8888-999999999999;2018-09-06T08:00:00.000Z"), - // Properties: &armsql.ManagedInstanceLongTermRetentionBackupProperties{ - // BackupStorageRedundancy: to.Ptr(armsql.BackupStorageRedundancyGeo), - // BackupTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-09-06T08:00:00Z"); return t}()), - // DatabaseDeletionTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-09-07T08:00:00Z"); return t}()), - // DatabaseName: to.Ptr("testDatabase"), - // ManagedInstanceCreateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-03-10T08:00:00Z"); return t}()), - // ManagedInstanceName: to.Ptr("testInstance"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ManagedInstanceLongTermRetentionBackupListByInstance.json -func ExampleLongTermRetentionManagedInstanceBackupsClient_NewListByInstancePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewLongTermRetentionManagedInstanceBackupsClient().NewListByInstancePager("japaneast", "testInstance", &armsql.LongTermRetentionManagedInstanceBackupsClientListByInstanceOptions{OnlyLatestPerDatabase: nil, - DatabaseState: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ManagedInstanceLongTermRetentionBackupListResult = armsql.ManagedInstanceLongTermRetentionBackupListResult{ - // Value: []*armsql.ManagedInstanceLongTermRetentionBackup{ - // { - // Name: to.Ptr("55555555-6666-7777-8888-999999999999;131637960820000000"), - // Type: to.Ptr("Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/providers/Microsoft.Sql/locations/japaneast/longTermRetentionManagedInstances/testInstance/longTermRetentionDatabases/testDatabase1/longTermRetentionManagedInstanceBackups/55555555-6666-7777-8888-999999999999;131637960820000000"), - // Properties: &armsql.ManagedInstanceLongTermRetentionBackupProperties{ - // BackupStorageRedundancy: to.Ptr(armsql.BackupStorageRedundancyGeo), - // BackupTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-08-23T08:00:00Z"); return t}()), - // DatabaseName: to.Ptr("testDatabase1"), - // ManagedInstanceCreateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-03-10T08:00:00Z"); return t}()), - // ManagedInstanceName: to.Ptr("testInstance"), - // }, - // }, - // { - // Name: to.Ptr("12341234-1234-1234-1234-123123123123;131657960820000000"), - // Type: to.Ptr("Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/providers/Microsoft.Sql/locations/japaneast/longTermRetentionManagedInstances/testInstance/longTermRetentionDatabases/testDatabase2/longTermRetentionManagedInstanceBackups/12341234-1234-1234-1234-123123123123;131657960820000000"), - // Properties: &armsql.ManagedInstanceLongTermRetentionBackupProperties{ - // BackupStorageRedundancy: to.Ptr(armsql.BackupStorageRedundancyGeo), - // BackupTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-08-30T08:00:00Z"); return t}()), - // DatabaseName: to.Ptr("testDatabase2"), - // ManagedInstanceCreateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-03-10T08:00:00Z"); return t}()), - // ManagedInstanceName: to.Ptr("testInstance"), - // }, - // }, - // { - // Name: to.Ptr("43214321-4321-4321-4321-321321321321;131667960820000000"), - // Type: to.Ptr("Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/providers/Microsoft.Sql/locations/japaneast/longTermRetentionManagedInstances/testInstance/longTermRetentionDatabases/testDatabase3/longTermRetentionManagedInstanceBackups/43214321-4321-4321-4321-321321321321;131677960820000000"), - // Properties: &armsql.ManagedInstanceLongTermRetentionBackupProperties{ - // BackupStorageRedundancy: to.Ptr(armsql.BackupStorageRedundancyGeo), - // BackupTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-09-06T08:00:00Z"); return t}()), - // DatabaseName: to.Ptr("testDatabase3"), - // ManagedInstanceCreateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-03-10T08:00:00Z"); return t}()), - // ManagedInstanceName: to.Ptr("testInstance"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ManagedInstanceLongTermRetentionBackupListByLocation.json -func ExampleLongTermRetentionManagedInstanceBackupsClient_NewListByLocationPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewLongTermRetentionManagedInstanceBackupsClient().NewListByLocationPager("japaneast", &armsql.LongTermRetentionManagedInstanceBackupsClientListByLocationOptions{OnlyLatestPerDatabase: nil, - DatabaseState: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ManagedInstanceLongTermRetentionBackupListResult = armsql.ManagedInstanceLongTermRetentionBackupListResult{ - // Value: []*armsql.ManagedInstanceLongTermRetentionBackup{ - // { - // Name: to.Ptr("55555555-6666-7777-8888-999999999999;2017-08-23T08:00:00.000Z"), - // Type: to.Ptr("Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionBackups"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/providers/Microsoft.Sql/locations/japaneast/longTermRetentionManagedInstances/testserver1/longTermRetentionDatabases/testDatabase1/longTermRetentionManagedInstanceBackups/55555555-6666-7777-8888-999999999999;131637960820000000"), - // Properties: &armsql.ManagedInstanceLongTermRetentionBackupProperties{ - // BackupStorageRedundancy: to.Ptr(armsql.BackupStorageRedundancyGeo), - // BackupTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-08-23T08:00:00Z"); return t}()), - // DatabaseName: to.Ptr("testDatabase1"), - // ManagedInstanceCreateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-03-10T08:00:00Z"); return t}()), - // ManagedInstanceName: to.Ptr("testInstance1"), - // }, - // }, - // { - // Name: to.Ptr("12341234-1234-1234-1234-123123123123;2017-08-30T08:00:00.000Z"), - // Type: to.Ptr("Microsoft.Sql/locations/longTermRetentionServers/longTermRetentionDatabases/longTermRetentionBackups"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/providers/Microsoft.Sql/locations/japaneast/longTermRetentionManagedInstances/testserver2/longTermRetentionDatabases/testDatabase2/longTermRetentionManagedInstanceBackups/12341234-1234-1234-1234-123123123123;131657960820000000"), - // Properties: &armsql.ManagedInstanceLongTermRetentionBackupProperties{ - // BackupStorageRedundancy: to.Ptr(armsql.BackupStorageRedundancyGeo), - // BackupTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-08-30T08:00:00Z"); return t}()), - // DatabaseName: to.Ptr("testDatabase2"), - // ManagedInstanceCreateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-04-10T08:00:00Z"); return t}()), - // ManagedInstanceName: to.Ptr("testInstance2"), - // }, - // }, - // { - // Name: to.Ptr("43214321-4321-4321-4321-321321321321;2017-09-06T08:00:00.000Z"), - // Type: to.Ptr("Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/providers/Microsoft.Sql/locations/japaneast/longTermRetentionManagedInstances/testserver3/longTermRetentionDatabases/testDatabase3/longTermRetentionManagedInstanceBackups/43214321-4321-4321-4321-321321321321;131677960820000000"), - // Properties: &armsql.ManagedInstanceLongTermRetentionBackupProperties{ - // BackupStorageRedundancy: to.Ptr(armsql.BackupStorageRedundancyGeo), - // BackupTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-09-06T08:00:00Z"); return t}()), - // DatabaseName: to.Ptr("testDatabase3"), - // ManagedInstanceCreateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-05-10T08:00:00Z"); return t}()), - // ManagedInstanceName: to.Ptr("testInstance3"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ResourceGroupBasedManagedInstanceLongTermRetentionBackupGet.json -func ExampleLongTermRetentionManagedInstanceBackupsClient_GetByResourceGroup() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewLongTermRetentionManagedInstanceBackupsClient().GetByResourceGroup(ctx, "testResourceGroup", "japaneast", "testInstance", "testDatabase", "55555555-6666-7777-8888-999999999999;131637960820000000", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ManagedInstanceLongTermRetentionBackup = armsql.ManagedInstanceLongTermRetentionBackup{ - // Name: to.Ptr("55555555-6666-7777-8888-999999999999;131637960820000000"), - // Type: to.Ptr("Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testResourceGroup/providers/Microsoft.Sql/Locations/japaneast/longTermRetentionManagedInstances/testInstance/longTermRetentionDatabases/testDatabase/longTermRetentionManagedInstanceBackups/55555555-6666-7777-8888-999999999999;131637960820000000"), - // Properties: &armsql.ManagedInstanceLongTermRetentionBackupProperties{ - // BackupStorageRedundancy: to.Ptr(armsql.BackupStorageRedundancyGeo), - // BackupTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-09-06T08:00:00Z"); return t}()), - // DatabaseName: to.Ptr("testDatabase"), - // ManagedInstanceCreateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-03-10T08:00:00Z"); return t}()), - // ManagedInstanceName: to.Ptr("testInstance"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ResourceGroupBasedManagedInstanceLongTermRetentionBackupDelete.json -func ExampleLongTermRetentionManagedInstanceBackupsClient_BeginDeleteByResourceGroup() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewLongTermRetentionManagedInstanceBackupsClient().BeginDeleteByResourceGroup(ctx, "testResourceGroup", "japaneast", "testInstance", "testDatabase", "55555555-6666-7777-8888-999999999999;131637960820000000", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ResourceGroupBasedManagedInstanceLongTermRetentionBackupListByDatabase.json -func ExampleLongTermRetentionManagedInstanceBackupsClient_NewListByResourceGroupDatabasePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewLongTermRetentionManagedInstanceBackupsClient().NewListByResourceGroupDatabasePager("testResourceGroup", "japaneast", "testInstance", "testDatabase", &armsql.LongTermRetentionManagedInstanceBackupsClientListByResourceGroupDatabaseOptions{OnlyLatestPerDatabase: nil, - DatabaseState: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ManagedInstanceLongTermRetentionBackupListResult = armsql.ManagedInstanceLongTermRetentionBackupListResult{ - // Value: []*armsql.ManagedInstanceLongTermRetentionBackup{ - // { - // Name: to.Ptr("2018-06-01T08:00:00.000Z;55555555-6666-7777-8888-999999999999;2018-08-23T08:00:00.000Z"), - // Type: to.Ptr("Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testResourceGroup/providers/Microsoft.Sql/Locations/japaneast/longTermRetentionManagedInstances/testInstance/longTermRetentionDatabases/testDatabase/longTermRetentionManagedInstanceBackups/2018-06-01T08:00:00.000Z;55555555-6666-7777-8888-999999999999;2018-08-23T08:00:00.000Z"), - // Properties: &armsql.ManagedInstanceLongTermRetentionBackupProperties{ - // BackupStorageRedundancy: to.Ptr(armsql.BackupStorageRedundancyGeo), - // BackupTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-08-23T08:00:00Z"); return t}()), - // DatabaseName: to.Ptr("testDatabase"), - // ManagedInstanceCreateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-03-10T08:00:00Z"); return t}()), - // ManagedInstanceName: to.Ptr("testInstance"), - // }, - // }, - // { - // Name: to.Ptr("2018-06-01T08:00:00.000Z;55555555-6666-7777-8888-999999999999;2018-08-30T08:00:00.000Z"), - // Type: to.Ptr("Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testResourceGroup/providers/Microsoft.Sql/Locations/japaneast/longTermRetentionManagedInstances/testInstance/longTermRetentionDatabases/testDatabase/longTermRetentionManagedInstanceBackups/2018-06-01T08:00:00.000Z;55555555-6666-7777-8888-999999999999;2018-08-30T08:00:00.000Z"), - // Properties: &armsql.ManagedInstanceLongTermRetentionBackupProperties{ - // BackupStorageRedundancy: to.Ptr(armsql.BackupStorageRedundancyGeo), - // BackupTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-08-30T08:00:00Z"); return t}()), - // DatabaseName: to.Ptr("testDatabase"), - // ManagedInstanceCreateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-03-10T08:00:00Z"); return t}()), - // ManagedInstanceName: to.Ptr("testInstance"), - // }, - // }, - // { - // Name: to.Ptr("2018-06-01T08:00:00.000Z;55555555-6666-7777-8888-999999999999;2018-09-06T08:00:00.000Z"), - // Type: to.Ptr("Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testResourceGroup/providers/Microsoft.Sql/Locations/japaneast/longTermRetentionManagedInstances/testInstance/longTermRetentionDatabases/testDatabase/longTermRetentionManagedInstanceBackups/2018-06-01T08:00:00.000Z;55555555-6666-7777-8888-999999999999;2018-09-06T08:00:00.000Z"), - // Properties: &armsql.ManagedInstanceLongTermRetentionBackupProperties{ - // BackupStorageRedundancy: to.Ptr(armsql.BackupStorageRedundancyGeo), - // BackupTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-09-06T08:00:00Z"); return t}()), - // DatabaseDeletionTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-09-07T08:00:00Z"); return t}()), - // DatabaseName: to.Ptr("testDatabase"), - // ManagedInstanceCreateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-03-10T08:00:00Z"); return t}()), - // ManagedInstanceName: to.Ptr("testInstance"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ResourceGroupBasedManagedInstanceLongTermRetentionBackupListByInstance.json -func ExampleLongTermRetentionManagedInstanceBackupsClient_NewListByResourceGroupInstancePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewLongTermRetentionManagedInstanceBackupsClient().NewListByResourceGroupInstancePager("testResourceGroup", "japaneast", "testInstance", &armsql.LongTermRetentionManagedInstanceBackupsClientListByResourceGroupInstanceOptions{OnlyLatestPerDatabase: nil, - DatabaseState: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ManagedInstanceLongTermRetentionBackupListResult = armsql.ManagedInstanceLongTermRetentionBackupListResult{ - // Value: []*armsql.ManagedInstanceLongTermRetentionBackup{ - // { - // Name: to.Ptr("55555555-6666-7777-8888-999999999999;131637960820000000"), - // Type: to.Ptr("Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testResourceGroup/providers/Microsoft.Sql/locations/japaneast/longTermRetentionManagedInstances/testInstance/longTermRetentionDatabases/testDatabase1/longTermRetentionManagedInstanceBackups/55555555-6666-7777-8888-999999999999;131637960820000000"), - // Properties: &armsql.ManagedInstanceLongTermRetentionBackupProperties{ - // BackupStorageRedundancy: to.Ptr(armsql.BackupStorageRedundancyGeo), - // BackupTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-08-23T08:00:00Z"); return t}()), - // DatabaseName: to.Ptr("testDatabase1"), - // ManagedInstanceCreateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-03-10T08:00:00Z"); return t}()), - // ManagedInstanceName: to.Ptr("testInstance"), - // }, - // }, - // { - // Name: to.Ptr("12341234-1234-1234-1234-123123123123;131657960820000000"), - // Type: to.Ptr("Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testResourceGroup/providers/Microsoft.Sql/locations/japaneast/longTermRetentionManagedInstances/testInstance/longTermRetentionDatabases/testDatabase2/longTermRetentionManagedInstanceBackups/12341234-1234-1234-1234-123123123123;131657960820000000"), - // Properties: &armsql.ManagedInstanceLongTermRetentionBackupProperties{ - // BackupStorageRedundancy: to.Ptr(armsql.BackupStorageRedundancyGeo), - // BackupTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-08-30T08:00:00Z"); return t}()), - // DatabaseName: to.Ptr("testDatabase2"), - // ManagedInstanceCreateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-03-10T08:00:00Z"); return t}()), - // ManagedInstanceName: to.Ptr("testInstance"), - // }, - // }, - // { - // Name: to.Ptr("43214321-4321-4321-4321-321321321321;131667960820000000"), - // Type: to.Ptr("Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testResourceGroup/providers/Microsoft.Sql/locations/japaneast/longTermRetentionManagedInstances/testInstance/longTermRetentionDatabases/testDatabase3/longTermRetentionManagedInstanceBackups/43214321-4321-4321-4321-321321321321;131677960820000000"), - // Properties: &armsql.ManagedInstanceLongTermRetentionBackupProperties{ - // BackupStorageRedundancy: to.Ptr(armsql.BackupStorageRedundancyGeo), - // BackupTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-09-06T08:00:00Z"); return t}()), - // DatabaseName: to.Ptr("testDatabase3"), - // ManagedInstanceCreateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-03-10T08:00:00Z"); return t}()), - // ManagedInstanceName: to.Ptr("testInstance"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ResourceGroupBasedManagedInstanceLongTermRetentionBackupListByLocation.json -func ExampleLongTermRetentionManagedInstanceBackupsClient_NewListByResourceGroupLocationPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewLongTermRetentionManagedInstanceBackupsClient().NewListByResourceGroupLocationPager("testResourceGroup", "japaneast", &armsql.LongTermRetentionManagedInstanceBackupsClientListByResourceGroupLocationOptions{OnlyLatestPerDatabase: nil, - DatabaseState: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ManagedInstanceLongTermRetentionBackupListResult = armsql.ManagedInstanceLongTermRetentionBackupListResult{ - // Value: []*armsql.ManagedInstanceLongTermRetentionBackup{ - // { - // Name: to.Ptr("55555555-6666-7777-8888-999999999999;2017-08-23T08:00:00.000Z"), - // Type: to.Ptr("Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testResourceGroup/providers/Microsoft.Sql/locations/japaneast/longTermRetentionManagedInstances/testInstance1/longTermRetentionDatabases/testDatabase1/longTermRetentionManagedInstanceBackups/55555555-6666-7777-8888-999999999999;131637960820000000"), - // Properties: &armsql.ManagedInstanceLongTermRetentionBackupProperties{ - // BackupStorageRedundancy: to.Ptr(armsql.BackupStorageRedundancyGeo), - // BackupTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-08-23T08:00:00Z"); return t}()), - // DatabaseName: to.Ptr("testDatabase1"), - // ManagedInstanceCreateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-03-10T08:00:00Z"); return t}()), - // ManagedInstanceName: to.Ptr("testInstance1"), - // }, - // }, - // { - // Name: to.Ptr("12341234-1234-1234-1234-123123123123;2017-08-30T08:00:00.000Z"), - // Type: to.Ptr("Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testResourceGroup/providers/Microsoft.Sql/locations/japaneast/longTermRetentionManagedInstances/testInstance2/longTermRetentionDatabases/testDatabase2/longTermRetentionManagedInstanceBackups/12341234-1234-1234-1234-123123123123;131657960820000000"), - // Properties: &armsql.ManagedInstanceLongTermRetentionBackupProperties{ - // BackupStorageRedundancy: to.Ptr(armsql.BackupStorageRedundancyGeo), - // BackupTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-08-30T08:00:00Z"); return t}()), - // DatabaseName: to.Ptr("testDatabase2"), - // ManagedInstanceCreateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-04-10T08:00:00Z"); return t}()), - // ManagedInstanceName: to.Ptr("testInstance2"), - // }, - // }, - // { - // Name: to.Ptr("43214321-4321-4321-4321-321321321321;2017-09-06T08:00:00.000Z"), - // Type: to.Ptr("Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testResourceGroup/providers/Microsoft.Sql/locations/japaneast/longTermRetentionManagedInstances/testInstance3/longTermRetentionDatabases/testDatabase3/longTermRetentionManagedInstanceBackups/43214321-4321-4321-4321-321321321321;131677960820000000"), - // Properties: &armsql.ManagedInstanceLongTermRetentionBackupProperties{ - // BackupStorageRedundancy: to.Ptr(armsql.BackupStorageRedundancyGeo), - // BackupTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-09-06T08:00:00Z"); return t}()), - // DatabaseName: to.Ptr("testDatabase3"), - // ManagedInstanceCreateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-05-10T08:00:00Z"); return t}()), - // ManagedInstanceName: to.Ptr("testInstance3"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/sql/armsql/longtermretentionpolicies_client.go b/sdk/resourcemanager/sql/armsql/longtermretentionpolicies_client.go index 7ab6e88d6b9a..fb73bb652abf 100644 --- a/sdk/resourcemanager/sql/armsql/longtermretentionpolicies_client.go +++ b/sdk/resourcemanager/sql/armsql/longtermretentionpolicies_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armsql @@ -47,7 +46,7 @@ func NewLongTermRetentionPoliciesClient(subscriptionID string, credential azcore // BeginCreateOrUpdate - Sets a database's long term retention policy. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -62,7 +61,8 @@ func (client *LongTermRetentionPoliciesClient) BeginCreateOrUpdate(ctx context.C if err != nil { return nil, err } - return runtime.NewPoller[LongTermRetentionPoliciesClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[LongTermRetentionPoliciesClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[LongTermRetentionPoliciesClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -71,20 +71,22 @@ func (client *LongTermRetentionPoliciesClient) BeginCreateOrUpdate(ctx context.C // CreateOrUpdate - Sets a database's long term retention policy. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview func (client *LongTermRetentionPoliciesClient) createOrUpdate(ctx context.Context, resourceGroupName string, serverName string, databaseName string, policyName LongTermRetentionPolicyName, parameters LongTermRetentionPolicy, options *LongTermRetentionPoliciesClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, serverName, databaseName, policyName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createOrUpdateCreateRequest creates the CreateOrUpdate request. @@ -115,16 +117,19 @@ func (client *LongTermRetentionPoliciesClient) createOrUpdateCreateRequest(ctx c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // Get - Gets a database's long term retention policy. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -133,18 +138,21 @@ func (client *LongTermRetentionPoliciesClient) createOrUpdateCreateRequest(ctx c // - options - LongTermRetentionPoliciesClientGetOptions contains the optional parameters for the LongTermRetentionPoliciesClient.Get // method. func (client *LongTermRetentionPoliciesClient) Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string, policyName LongTermRetentionPolicyName, options *LongTermRetentionPoliciesClientGetOptions) (LongTermRetentionPoliciesClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, serverName, databaseName, policyName, options) if err != nil { return LongTermRetentionPoliciesClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return LongTermRetentionPoliciesClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return LongTermRetentionPoliciesClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return LongTermRetentionPoliciesClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -175,7 +183,7 @@ func (client *LongTermRetentionPoliciesClient) getCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -192,7 +200,7 @@ func (client *LongTermRetentionPoliciesClient) getHandleResponse(resp *http.Resp // NewListByDatabasePager - Gets a database's long term retention policy. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -251,7 +259,7 @@ func (client *LongTermRetentionPoliciesClient) listByDatabaseCreateRequest(ctx c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/sql/armsql/longtermretentionpolicies_client_example_test.go b/sdk/resourcemanager/sql/armsql/longtermretentionpolicies_client_example_test.go deleted file mode 100644 index a9ae686cd0cb..000000000000 --- a/sdk/resourcemanager/sql/armsql/longtermretentionpolicies_client_example_test.go +++ /dev/null @@ -1,131 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsql_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sql/armsql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/LongTermRetentionPolicyGet.json -func ExampleLongTermRetentionPoliciesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewLongTermRetentionPoliciesClient().Get(ctx, "resourceGroup", "testserver", "testDatabase", armsql.LongTermRetentionPolicyNameDefault, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.LongTermRetentionPolicy = armsql.LongTermRetentionPolicy{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.Sql/resourceGroups/servers/databases/backupLongTermRetentionPolicies"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/providers/Microsoft.Sql/resourceGroups/resourceGroup/servers/testserver/databases/testDatabase/backupLongTermRetentionPolicies/default"), - // Properties: &armsql.BaseLongTermRetentionPolicyProperties{ - // MonthlyRetention: to.Ptr("P1Y"), - // WeekOfYear: to.Ptr[int32](5), - // WeeklyRetention: to.Ptr("P1M"), - // YearlyRetention: to.Ptr("P5Y"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/LongTermRetentionPolicyCreateOrUpdate.json -func ExampleLongTermRetentionPoliciesClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewLongTermRetentionPoliciesClient().BeginCreateOrUpdate(ctx, "resourceGroup", "testserver", "testDatabase", armsql.LongTermRetentionPolicyNameDefault, armsql.LongTermRetentionPolicy{ - Properties: &armsql.BaseLongTermRetentionPolicyProperties{ - MonthlyRetention: to.Ptr("P1Y"), - WeekOfYear: to.Ptr[int32](5), - WeeklyRetention: to.Ptr("P1M"), - YearlyRetention: to.Ptr("P5Y"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.LongTermRetentionPolicy = armsql.LongTermRetentionPolicy{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.Sql/resourceGroups/servers/databases/backupLongTermRetentionPolicies"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/providers/Microsoft.Sql/resourceGroups/resourceGroup/servers/testserver/databases/testDatabase/backupLongTermRetentionPolicies/default"), - // Properties: &armsql.BaseLongTermRetentionPolicyProperties{ - // MonthlyRetention: to.Ptr("P1Y"), - // WeekOfYear: to.Ptr[int32](5), - // WeeklyRetention: to.Ptr("P1M"), - // YearlyRetention: to.Ptr("P5Y"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/LongTermRetentionPolicyListByDatabase.json -func ExampleLongTermRetentionPoliciesClient_NewListByDatabasePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewLongTermRetentionPoliciesClient().NewListByDatabasePager("resourceGroup", "testserver", "testDatabase", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.LongTermRetentionPolicyListResult = armsql.LongTermRetentionPolicyListResult{ - // Value: []*armsql.LongTermRetentionPolicy{ - // { - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.Sql/resourceGroups/servers/databases/backupLongTermRetentionPolicies"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/providers/Microsoft.Sql/resourceGroups/resourceGroup/servers/testserver/databases/testDatabase/backupLongTermRetentionPolicies/default"), - // Properties: &armsql.BaseLongTermRetentionPolicyProperties{ - // MonthlyRetention: to.Ptr("P1Y"), - // WeekOfYear: to.Ptr[int32](5), - // WeeklyRetention: to.Ptr("P1M"), - // YearlyRetention: to.Ptr("P5Y"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/sql/armsql/maintenancewindowoptions_client.go b/sdk/resourcemanager/sql/armsql/maintenancewindowoptions_client.go index 2984cf31b923..7e71bcf6fb0a 100644 --- a/sdk/resourcemanager/sql/armsql/maintenancewindowoptions_client.go +++ b/sdk/resourcemanager/sql/armsql/maintenancewindowoptions_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armsql @@ -47,7 +46,7 @@ func NewMaintenanceWindowOptionsClient(subscriptionID string, credential azcore. // Get - Gets a list of available maintenance windows. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -56,18 +55,21 @@ func NewMaintenanceWindowOptionsClient(subscriptionID string, credential azcore. // - options - MaintenanceWindowOptionsClientGetOptions contains the optional parameters for the MaintenanceWindowOptionsClient.Get // method. func (client *MaintenanceWindowOptionsClient) Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string, maintenanceWindowOptionsName string, options *MaintenanceWindowOptionsClientGetOptions) (MaintenanceWindowOptionsClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, serverName, databaseName, maintenanceWindowOptionsName, options) if err != nil { return MaintenanceWindowOptionsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return MaintenanceWindowOptionsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return MaintenanceWindowOptionsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return MaintenanceWindowOptionsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -95,7 +97,7 @@ func (client *MaintenanceWindowOptionsClient) getCreateRequest(ctx context.Conte } reqQP := req.Raw().URL.Query() reqQP.Set("maintenanceWindowOptionsName", maintenanceWindowOptionsName) - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/sql/armsql/maintenancewindowoptions_client_example_test.go b/sdk/resourcemanager/sql/armsql/maintenancewindowoptions_client_example_test.go deleted file mode 100644 index 3eb3511fd8e3..000000000000 --- a/sdk/resourcemanager/sql/armsql/maintenancewindowoptions_client_example_test.go +++ /dev/null @@ -1,57 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsql_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sql/armsql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/GetMaintenanceWindowOptions.json -func ExampleMaintenanceWindowOptionsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewMaintenanceWindowOptionsClient().Get(ctx, "Default-SQL-SouthEastAsia", "testsvr", "testdb", "current", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.MaintenanceWindowOptions = armsql.MaintenanceWindowOptions{ - // Name: to.Ptr("current"), - // Type: to.Ptr("Microsoft.Sql/servers/databases/maintenancewindows"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/servers/testsvr/databases/testdb/maintenancewindowoptions/current"), - // Properties: &armsql.MaintenanceWindowOptionsProperties{ - // AllowMultipleMaintenanceWindowsPerCycle: to.Ptr(true), - // DefaultDurationInMinutes: to.Ptr[int32](120), - // IsEnabled: to.Ptr(true), - // MaintenanceWindowCycles: []*armsql.MaintenanceWindowTimeRange{ - // { - // DayOfWeek: to.Ptr(armsql.DayOfWeekSaturday), - // Duration: to.Ptr("PT60M"), - // StartTime: to.Ptr("00:00:00"), - // }}, - // MinCycles: to.Ptr[int32](2), - // MinDurationInMinutes: to.Ptr[int32](60), - // TimeGranularityInMinutes: to.Ptr[int32](5), - // }, - // } -} diff --git a/sdk/resourcemanager/sql/armsql/maintenancewindows_client.go b/sdk/resourcemanager/sql/armsql/maintenancewindows_client.go index fe9533355f3d..ee48f755862a 100644 --- a/sdk/resourcemanager/sql/armsql/maintenancewindows_client.go +++ b/sdk/resourcemanager/sql/armsql/maintenancewindows_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armsql @@ -47,7 +46,7 @@ func NewMaintenanceWindowsClient(subscriptionID string, credential azcore.TokenC // CreateOrUpdate - Sets maintenance windows settings for a database. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -56,16 +55,18 @@ func NewMaintenanceWindowsClient(subscriptionID string, credential azcore.TokenC // - options - MaintenanceWindowsClientCreateOrUpdateOptions contains the optional parameters for the MaintenanceWindowsClient.CreateOrUpdate // method. func (client *MaintenanceWindowsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, databaseName string, maintenanceWindowName string, parameters MaintenanceWindows, options *MaintenanceWindowsClientCreateOrUpdateOptions) (MaintenanceWindowsClientCreateOrUpdateResponse, error) { + var err error req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, serverName, databaseName, maintenanceWindowName, parameters, options) if err != nil { return MaintenanceWindowsClientCreateOrUpdateResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return MaintenanceWindowsClientCreateOrUpdateResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return MaintenanceWindowsClientCreateOrUpdateResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return MaintenanceWindowsClientCreateOrUpdateResponse{}, err } return MaintenanceWindowsClientCreateOrUpdateResponse{}, nil } @@ -95,15 +96,18 @@ func (client *MaintenanceWindowsClient) createOrUpdateCreateRequest(ctx context. } reqQP := req.Raw().URL.Query() reqQP.Set("maintenanceWindowName", maintenanceWindowName) - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // Get - Gets maintenance windows settings for a database. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -111,18 +115,21 @@ func (client *MaintenanceWindowsClient) createOrUpdateCreateRequest(ctx context. // - maintenanceWindowName - Maintenance window name. // - options - MaintenanceWindowsClientGetOptions contains the optional parameters for the MaintenanceWindowsClient.Get method. func (client *MaintenanceWindowsClient) Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string, maintenanceWindowName string, options *MaintenanceWindowsClientGetOptions) (MaintenanceWindowsClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, serverName, databaseName, maintenanceWindowName, options) if err != nil { return MaintenanceWindowsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return MaintenanceWindowsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return MaintenanceWindowsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return MaintenanceWindowsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -150,7 +157,7 @@ func (client *MaintenanceWindowsClient) getCreateRequest(ctx context.Context, re } reqQP := req.Raw().URL.Query() reqQP.Set("maintenanceWindowName", maintenanceWindowName) - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/sql/armsql/maintenancewindows_client_example_test.go b/sdk/resourcemanager/sql/armsql/maintenancewindows_client_example_test.go deleted file mode 100644 index 01b2cac90d26..000000000000 --- a/sdk/resourcemanager/sql/armsql/maintenancewindows_client_example_test.go +++ /dev/null @@ -1,78 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsql_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sql/armsql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/GetMaintenanceWindows.json -func ExampleMaintenanceWindowsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewMaintenanceWindowsClient().Get(ctx, "Default-SQL-SouthEastAsia", "testsvr", "testdb", "current", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.MaintenanceWindows = armsql.MaintenanceWindows{ - // Name: to.Ptr("current"), - // Type: to.Ptr("Microsoft.Sql/servers/databases/maintenancewindows"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/servers/testsvr/databases/testdb/maintenancewindows/current"), - // Properties: &armsql.MaintenanceWindowsProperties{ - // TimeRanges: []*armsql.MaintenanceWindowTimeRange{ - // { - // DayOfWeek: to.Ptr(armsql.DayOfWeekSaturday), - // Duration: to.Ptr("PT60M"), - // StartTime: to.Ptr("00:00:00"), - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/CreateOrUpdateMaintenanceWindows.json -func ExampleMaintenanceWindowsClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewMaintenanceWindowsClient().CreateOrUpdate(ctx, "Default-SQL-SouthEastAsia", "testsvr", "testdwdb", "current", armsql.MaintenanceWindows{ - Properties: &armsql.MaintenanceWindowsProperties{ - TimeRanges: []*armsql.MaintenanceWindowTimeRange{ - { - DayOfWeek: to.Ptr(armsql.DayOfWeekSaturday), - Duration: to.Ptr("PT60M"), - StartTime: to.Ptr("00:00:00"), - }}, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/sql/armsql/managedbackupshorttermretentionpolicies_client.go b/sdk/resourcemanager/sql/armsql/managedbackupshorttermretentionpolicies_client.go index 6b2c5d25771b..713db6d2c21a 100644 --- a/sdk/resourcemanager/sql/armsql/managedbackupshorttermretentionpolicies_client.go +++ b/sdk/resourcemanager/sql/armsql/managedbackupshorttermretentionpolicies_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armsql @@ -47,7 +46,7 @@ func NewManagedBackupShortTermRetentionPoliciesClient(subscriptionID string, cre // BeginCreateOrUpdate - Updates a managed database's short term retention policy. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - managedInstanceName - The name of the managed instance. @@ -62,7 +61,8 @@ func (client *ManagedBackupShortTermRetentionPoliciesClient) BeginCreateOrUpdate if err != nil { return nil, err } - return runtime.NewPoller[ManagedBackupShortTermRetentionPoliciesClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[ManagedBackupShortTermRetentionPoliciesClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[ManagedBackupShortTermRetentionPoliciesClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -71,20 +71,22 @@ func (client *ManagedBackupShortTermRetentionPoliciesClient) BeginCreateOrUpdate // CreateOrUpdate - Updates a managed database's short term retention policy. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview func (client *ManagedBackupShortTermRetentionPoliciesClient) createOrUpdate(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, policyName ManagedShortTermRetentionPolicyName, parameters ManagedBackupShortTermRetentionPolicy, options *ManagedBackupShortTermRetentionPoliciesClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, managedInstanceName, databaseName, policyName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createOrUpdateCreateRequest creates the CreateOrUpdate request. @@ -115,16 +117,19 @@ func (client *ManagedBackupShortTermRetentionPoliciesClient) createOrUpdateCreat return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // Get - Gets a managed database's short term retention policy. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - managedInstanceName - The name of the managed instance. @@ -133,18 +138,21 @@ func (client *ManagedBackupShortTermRetentionPoliciesClient) createOrUpdateCreat // - options - ManagedBackupShortTermRetentionPoliciesClientGetOptions contains the optional parameters for the ManagedBackupShortTermRetentionPoliciesClient.Get // method. func (client *ManagedBackupShortTermRetentionPoliciesClient) Get(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, policyName ManagedShortTermRetentionPolicyName, options *ManagedBackupShortTermRetentionPoliciesClientGetOptions) (ManagedBackupShortTermRetentionPoliciesClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, managedInstanceName, databaseName, policyName, options) if err != nil { return ManagedBackupShortTermRetentionPoliciesClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ManagedBackupShortTermRetentionPoliciesClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ManagedBackupShortTermRetentionPoliciesClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ManagedBackupShortTermRetentionPoliciesClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -175,7 +183,7 @@ func (client *ManagedBackupShortTermRetentionPoliciesClient) getCreateRequest(ct return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -192,7 +200,7 @@ func (client *ManagedBackupShortTermRetentionPoliciesClient) getHandleResponse(r // NewListByDatabasePager - Gets a managed database's short term retention policy list. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - managedInstanceName - The name of the managed instance. @@ -251,7 +259,7 @@ func (client *ManagedBackupShortTermRetentionPoliciesClient) listByDatabaseCreat return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -269,7 +277,7 @@ func (client *ManagedBackupShortTermRetentionPoliciesClient) listByDatabaseHandl // BeginUpdate - Updates a managed database's short term retention policy. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - managedInstanceName - The name of the managed instance. @@ -284,7 +292,8 @@ func (client *ManagedBackupShortTermRetentionPoliciesClient) BeginUpdate(ctx con if err != nil { return nil, err } - return runtime.NewPoller[ManagedBackupShortTermRetentionPoliciesClientUpdateResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[ManagedBackupShortTermRetentionPoliciesClientUpdateResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[ManagedBackupShortTermRetentionPoliciesClientUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -293,20 +302,22 @@ func (client *ManagedBackupShortTermRetentionPoliciesClient) BeginUpdate(ctx con // Update - Updates a managed database's short term retention policy. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview func (client *ManagedBackupShortTermRetentionPoliciesClient) update(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, policyName ManagedShortTermRetentionPolicyName, parameters ManagedBackupShortTermRetentionPolicy, options *ManagedBackupShortTermRetentionPoliciesClientBeginUpdateOptions) (*http.Response, error) { + var err error req, err := client.updateCreateRequest(ctx, resourceGroupName, managedInstanceName, databaseName, policyName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // updateCreateRequest creates the Update request. @@ -337,8 +348,11 @@ func (client *ManagedBackupShortTermRetentionPoliciesClient) updateCreateRequest return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } diff --git a/sdk/resourcemanager/sql/armsql/managedbackupshorttermretentionpolicies_client_example_test.go b/sdk/resourcemanager/sql/armsql/managedbackupshorttermretentionpolicies_client_example_test.go deleted file mode 100644 index c937f4835ce3..000000000000 --- a/sdk/resourcemanager/sql/armsql/managedbackupshorttermretentionpolicies_client_example_test.go +++ /dev/null @@ -1,119 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsql_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sql/armsql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/GetManagedShortTermRetentionPolicy.json -func ExampleManagedBackupShortTermRetentionPoliciesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewManagedBackupShortTermRetentionPoliciesClient().Get(ctx, "Default-SQL-SouthEastAsia", "testsvr", "testdb", armsql.ManagedShortTermRetentionPolicyNameDefault, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ManagedBackupShortTermRetentionPolicy = armsql.ManagedBackupShortTermRetentionPolicy{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.Sql/managedInstances/databases/backupShortTermRetentionPolicies"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/managedInstances/testsvr/databases/testdb/backupShortTermRetentionPolicies/default"), - // Properties: &armsql.ManagedBackupShortTermRetentionPolicyProperties{ - // RetentionDays: to.Ptr[int32](14), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/UpdateManagedShortTermRetentionPolicy.json -func ExampleManagedBackupShortTermRetentionPoliciesClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewManagedBackupShortTermRetentionPoliciesClient().BeginCreateOrUpdate(ctx, "resourceGroup", "testsvr", "testdb", armsql.ManagedShortTermRetentionPolicyNameDefault, armsql.ManagedBackupShortTermRetentionPolicy{ - Properties: &armsql.ManagedBackupShortTermRetentionPolicyProperties{ - RetentionDays: to.Ptr[int32](14), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ManagedBackupShortTermRetentionPolicy = armsql.ManagedBackupShortTermRetentionPolicy{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.Sql/managedInstances/databases/backupShortTermRetentionPolicies"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/resourceGroup/providers/Microsoft.Sql/managedInstances/testsvr/databases/testdb/backupShortTermRetentionPolicies/default"), - // Properties: &armsql.ManagedBackupShortTermRetentionPolicyProperties{ - // RetentionDays: to.Ptr[int32](14), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/GetListManagedShortTermRetentionPolicy.json -func ExampleManagedBackupShortTermRetentionPoliciesClient_NewListByDatabasePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewManagedBackupShortTermRetentionPoliciesClient().NewListByDatabasePager("Default-SQL-SouthEastAsia", "testsvr", "testdb", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ManagedBackupShortTermRetentionPolicyListResult = armsql.ManagedBackupShortTermRetentionPolicyListResult{ - // Value: []*armsql.ManagedBackupShortTermRetentionPolicy{ - // { - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.Sql/managedInstances/restorableDroppedDatabases/backupShortTermRetentionPolicies"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/managedInstances/testsvr/databases/testdb,131403269876900000/backupShortTermRetentionPolicies/default"), - // Properties: &armsql.ManagedBackupShortTermRetentionPolicyProperties{ - // RetentionDays: to.Ptr[int32](14), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/sql/armsql/manageddatabaseadvancedthreatprotectionsettings_client.go b/sdk/resourcemanager/sql/armsql/manageddatabaseadvancedthreatprotectionsettings_client.go new file mode 100644 index 000000000000..93cd40832dcf --- /dev/null +++ b/sdk/resourcemanager/sql/armsql/manageddatabaseadvancedthreatprotectionsettings_client.go @@ -0,0 +1,268 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armsql + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// ManagedDatabaseAdvancedThreatProtectionSettingsClient contains the methods for the ManagedDatabaseAdvancedThreatProtectionSettings group. +// Don't use this type directly, use NewManagedDatabaseAdvancedThreatProtectionSettingsClient() instead. +type ManagedDatabaseAdvancedThreatProtectionSettingsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewManagedDatabaseAdvancedThreatProtectionSettingsClient creates a new instance of ManagedDatabaseAdvancedThreatProtectionSettingsClient with the specified values. +// - subscriptionID - The subscription ID that identifies an Azure subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewManagedDatabaseAdvancedThreatProtectionSettingsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ManagedDatabaseAdvancedThreatProtectionSettingsClient, error) { + cl, err := arm.NewClient(moduleName+".ManagedDatabaseAdvancedThreatProtectionSettingsClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ManagedDatabaseAdvancedThreatProtectionSettingsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// CreateOrUpdate - Creates or updates a managed database's Advanced Threat Protection state. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-11-01-preview +// - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure +// Resource Manager API or the portal. +// - managedInstanceName - The name of the managed instance. +// - databaseName - The name of the database. +// - advancedThreatProtectionName - The name of the Advanced Threat Protection state. +// - parameters - The managed database Advanced Threat Protection state. +// - options - ManagedDatabaseAdvancedThreatProtectionSettingsClientCreateOrUpdateOptions contains the optional parameters for +// the ManagedDatabaseAdvancedThreatProtectionSettingsClient.CreateOrUpdate method. +func (client *ManagedDatabaseAdvancedThreatProtectionSettingsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, advancedThreatProtectionName AdvancedThreatProtectionName, parameters ManagedDatabaseAdvancedThreatProtection, options *ManagedDatabaseAdvancedThreatProtectionSettingsClientCreateOrUpdateOptions) (ManagedDatabaseAdvancedThreatProtectionSettingsClientCreateOrUpdateResponse, error) { + var err error + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, managedInstanceName, databaseName, advancedThreatProtectionName, parameters, options) + if err != nil { + return ManagedDatabaseAdvancedThreatProtectionSettingsClientCreateOrUpdateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ManagedDatabaseAdvancedThreatProtectionSettingsClientCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return ManagedDatabaseAdvancedThreatProtectionSettingsClientCreateOrUpdateResponse{}, err + } + resp, err := client.createOrUpdateHandleResponse(httpResp) + return resp, err +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *ManagedDatabaseAdvancedThreatProtectionSettingsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, advancedThreatProtectionName AdvancedThreatProtectionName, parameters ManagedDatabaseAdvancedThreatProtection, options *ManagedDatabaseAdvancedThreatProtectionSettingsClientCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/advancedThreatProtectionSettings/{advancedThreatProtectionName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if managedInstanceName == "" { + return nil, errors.New("parameter managedInstanceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{managedInstanceName}", url.PathEscape(managedInstanceName)) + if databaseName == "" { + return nil, errors.New("parameter databaseName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{databaseName}", url.PathEscape(databaseName)) + if advancedThreatProtectionName == "" { + return nil, errors.New("parameter advancedThreatProtectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{advancedThreatProtectionName}", url.PathEscape(string(advancedThreatProtectionName))) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// createOrUpdateHandleResponse handles the CreateOrUpdate response. +func (client *ManagedDatabaseAdvancedThreatProtectionSettingsClient) createOrUpdateHandleResponse(resp *http.Response) (ManagedDatabaseAdvancedThreatProtectionSettingsClientCreateOrUpdateResponse, error) { + result := ManagedDatabaseAdvancedThreatProtectionSettingsClientCreateOrUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ManagedDatabaseAdvancedThreatProtection); err != nil { + return ManagedDatabaseAdvancedThreatProtectionSettingsClientCreateOrUpdateResponse{}, err + } + return result, nil +} + +// Get - Gets a managed database's Advanced Threat Protection state. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-11-01-preview +// - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure +// Resource Manager API or the portal. +// - managedInstanceName - The name of the managed instance. +// - databaseName - The name of the database. +// - advancedThreatProtectionName - The name of the Advanced Threat Protection state. +// - options - ManagedDatabaseAdvancedThreatProtectionSettingsClientGetOptions contains the optional parameters for the ManagedDatabaseAdvancedThreatProtectionSettingsClient.Get +// method. +func (client *ManagedDatabaseAdvancedThreatProtectionSettingsClient) Get(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, advancedThreatProtectionName AdvancedThreatProtectionName, options *ManagedDatabaseAdvancedThreatProtectionSettingsClientGetOptions) (ManagedDatabaseAdvancedThreatProtectionSettingsClientGetResponse, error) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, managedInstanceName, databaseName, advancedThreatProtectionName, options) + if err != nil { + return ManagedDatabaseAdvancedThreatProtectionSettingsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ManagedDatabaseAdvancedThreatProtectionSettingsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ManagedDatabaseAdvancedThreatProtectionSettingsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *ManagedDatabaseAdvancedThreatProtectionSettingsClient) getCreateRequest(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, advancedThreatProtectionName AdvancedThreatProtectionName, options *ManagedDatabaseAdvancedThreatProtectionSettingsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/advancedThreatProtectionSettings/{advancedThreatProtectionName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if managedInstanceName == "" { + return nil, errors.New("parameter managedInstanceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{managedInstanceName}", url.PathEscape(managedInstanceName)) + if databaseName == "" { + return nil, errors.New("parameter databaseName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{databaseName}", url.PathEscape(databaseName)) + if advancedThreatProtectionName == "" { + return nil, errors.New("parameter advancedThreatProtectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{advancedThreatProtectionName}", url.PathEscape(string(advancedThreatProtectionName))) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *ManagedDatabaseAdvancedThreatProtectionSettingsClient) getHandleResponse(resp *http.Response) (ManagedDatabaseAdvancedThreatProtectionSettingsClientGetResponse, error) { + result := ManagedDatabaseAdvancedThreatProtectionSettingsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ManagedDatabaseAdvancedThreatProtection); err != nil { + return ManagedDatabaseAdvancedThreatProtectionSettingsClientGetResponse{}, err + } + return result, nil +} + +// NewListByDatabasePager - Gets a list of managed database's Advanced Threat Protection states. +// +// Generated from API version 2022-11-01-preview +// - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure +// Resource Manager API or the portal. +// - managedInstanceName - The name of the managed instance. +// - databaseName - The name of the database. +// - options - ManagedDatabaseAdvancedThreatProtectionSettingsClientListByDatabaseOptions contains the optional parameters for +// the ManagedDatabaseAdvancedThreatProtectionSettingsClient.NewListByDatabasePager method. +func (client *ManagedDatabaseAdvancedThreatProtectionSettingsClient) NewListByDatabasePager(resourceGroupName string, managedInstanceName string, databaseName string, options *ManagedDatabaseAdvancedThreatProtectionSettingsClientListByDatabaseOptions) *runtime.Pager[ManagedDatabaseAdvancedThreatProtectionSettingsClientListByDatabaseResponse] { + return runtime.NewPager(runtime.PagingHandler[ManagedDatabaseAdvancedThreatProtectionSettingsClientListByDatabaseResponse]{ + More: func(page ManagedDatabaseAdvancedThreatProtectionSettingsClientListByDatabaseResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ManagedDatabaseAdvancedThreatProtectionSettingsClientListByDatabaseResponse) (ManagedDatabaseAdvancedThreatProtectionSettingsClientListByDatabaseResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByDatabaseCreateRequest(ctx, resourceGroupName, managedInstanceName, databaseName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ManagedDatabaseAdvancedThreatProtectionSettingsClientListByDatabaseResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ManagedDatabaseAdvancedThreatProtectionSettingsClientListByDatabaseResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ManagedDatabaseAdvancedThreatProtectionSettingsClientListByDatabaseResponse{}, runtime.NewResponseError(resp) + } + return client.listByDatabaseHandleResponse(resp) + }, + }) +} + +// listByDatabaseCreateRequest creates the ListByDatabase request. +func (client *ManagedDatabaseAdvancedThreatProtectionSettingsClient) listByDatabaseCreateRequest(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, options *ManagedDatabaseAdvancedThreatProtectionSettingsClientListByDatabaseOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/advancedThreatProtectionSettings" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if managedInstanceName == "" { + return nil, errors.New("parameter managedInstanceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{managedInstanceName}", url.PathEscape(managedInstanceName)) + if databaseName == "" { + return nil, errors.New("parameter databaseName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{databaseName}", url.PathEscape(databaseName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByDatabaseHandleResponse handles the ListByDatabase response. +func (client *ManagedDatabaseAdvancedThreatProtectionSettingsClient) listByDatabaseHandleResponse(resp *http.Response) (ManagedDatabaseAdvancedThreatProtectionSettingsClientListByDatabaseResponse, error) { + result := ManagedDatabaseAdvancedThreatProtectionSettingsClientListByDatabaseResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ManagedDatabaseAdvancedThreatProtectionListResult); err != nil { + return ManagedDatabaseAdvancedThreatProtectionSettingsClientListByDatabaseResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/sql/armsql/manageddatabasecolumns_client.go b/sdk/resourcemanager/sql/armsql/manageddatabasecolumns_client.go index b1631433c6db..1002dda22fd8 100644 --- a/sdk/resourcemanager/sql/armsql/manageddatabasecolumns_client.go +++ b/sdk/resourcemanager/sql/armsql/manageddatabasecolumns_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armsql @@ -47,7 +46,7 @@ func NewManagedDatabaseColumnsClient(subscriptionID string, credential azcore.To // Get - Get managed database column // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - managedInstanceName - The name of the managed instance. @@ -58,18 +57,21 @@ func NewManagedDatabaseColumnsClient(subscriptionID string, credential azcore.To // - options - ManagedDatabaseColumnsClientGetOptions contains the optional parameters for the ManagedDatabaseColumnsClient.Get // method. func (client *ManagedDatabaseColumnsClient) Get(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, schemaName string, tableName string, columnName string, options *ManagedDatabaseColumnsClientGetOptions) (ManagedDatabaseColumnsClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, managedInstanceName, databaseName, schemaName, tableName, columnName, options) if err != nil { return ManagedDatabaseColumnsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ManagedDatabaseColumnsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ManagedDatabaseColumnsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ManagedDatabaseColumnsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -108,7 +110,7 @@ func (client *ManagedDatabaseColumnsClient) getCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -125,7 +127,7 @@ func (client *ManagedDatabaseColumnsClient) getHandleResponse(resp *http.Respons // NewListByDatabasePager - List managed database columns // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - managedInstanceName - The name of the managed instance. @@ -207,7 +209,7 @@ func (client *ManagedDatabaseColumnsClient) listByDatabaseCreateRequest(ctx cont if options != nil && options.Skiptoken != nil { reqQP.Set("$skiptoken", *options.Skiptoken) } - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -224,7 +226,7 @@ func (client *ManagedDatabaseColumnsClient) listByDatabaseHandleResponse(resp *h // NewListByTablePager - List managed database columns // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - managedInstanceName - The name of the managed instance. @@ -296,7 +298,7 @@ func (client *ManagedDatabaseColumnsClient) listByTableCreateRequest(ctx context if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/sql/armsql/manageddatabasecolumns_client_example_test.go b/sdk/resourcemanager/sql/armsql/manageddatabasecolumns_client_example_test.go deleted file mode 100644 index af025305ef34..000000000000 --- a/sdk/resourcemanager/sql/armsql/manageddatabasecolumns_client_example_test.go +++ /dev/null @@ -1,196 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsql_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sql/armsql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedColumnsListByDatabaseMax.json -func ExampleManagedDatabaseColumnsClient_NewListByDatabasePager_filterManagedDatabaseColumns() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewManagedDatabaseColumnsClient().NewListByDatabasePager("myRG", "serverName", "myDatabase", &armsql.ManagedDatabaseColumnsClientListByDatabaseOptions{Schema: []string{ - "dbo"}, - Table: []string{ - "customer", - "address"}, - Column: []string{ - "username"}, - OrderBy: []string{ - "schema asc", - "table", - "column desc"}, - Skiptoken: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DatabaseColumnListResult = armsql.DatabaseColumnListResult{ - // Value: []*armsql.DatabaseColumn{ - // { - // Name: to.Ptr("username"), - // Type: to.Ptr("Microsoft.Sql/managedInstances/databases/schemas/tables/columns"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/myRG/providers/Microsoft.Sql/managedInstances/serverName/databases/myDatabase/schemas/dbo/tables/customer/columns/username"), - // Properties: &armsql.DatabaseColumnProperties{ - // ColumnType: to.Ptr(armsql.ColumnDataTypeNvarchar), - // IsComputed: to.Ptr(false), - // MemoryOptimized: to.Ptr(false), - // TemporalType: to.Ptr(armsql.TableTemporalTypeNonTemporalTable), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedColumnsListByDatabaseMin.json -func ExampleManagedDatabaseColumnsClient_NewListByDatabasePager_listManagedDatabaseColumns() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewManagedDatabaseColumnsClient().NewListByDatabasePager("myRG", "serverName", "myDatabase", &armsql.ManagedDatabaseColumnsClientListByDatabaseOptions{Schema: []string{}, - Table: []string{}, - Column: []string{}, - OrderBy: []string{}, - Skiptoken: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DatabaseColumnListResult = armsql.DatabaseColumnListResult{ - // Value: []*armsql.DatabaseColumn{ - // { - // Name: to.Ptr("col1"), - // Type: to.Ptr("Microsoft.Sql/managedInstances/databases/schemas/tables/columns"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/myRG/providers/Microsoft.Sql/managedInstances/serverName/databases/myDatabase/schemas/dbo/tables/table1/columns/col1"), - // Properties: &armsql.DatabaseColumnProperties{ - // ColumnType: to.Ptr(armsql.ColumnDataTypeInt), - // IsComputed: to.Ptr(false), - // MemoryOptimized: to.Ptr(false), - // TemporalType: to.Ptr(armsql.TableTemporalTypeNonTemporalTable), - // }, - // }, - // { - // Name: to.Ptr("col2"), - // Type: to.Ptr("Microsoft.Sql/managedInstances/databases/schemas/tables/columns"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/myRG/providers/Microsoft.Sql/managedInstances/serverName/databases/myDatabase/schemas/dbo/tables/table1/columns/col2"), - // Properties: &armsql.DatabaseColumnProperties{ - // ColumnType: to.Ptr(armsql.ColumnDataTypeBit), - // IsComputed: to.Ptr(false), - // MemoryOptimized: to.Ptr(false), - // TemporalType: to.Ptr(armsql.TableTemporalTypeSystemVersionedTemporalTable), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseColumnListByTable.json -func ExampleManagedDatabaseColumnsClient_NewListByTablePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewManagedDatabaseColumnsClient().NewListByTablePager("myRG", "myManagedInstanceName", "myDatabase", "dbo", "table1", &armsql.ManagedDatabaseColumnsClientListByTableOptions{Filter: nil}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DatabaseColumnListResult = armsql.DatabaseColumnListResult{ - // Value: []*armsql.DatabaseColumn{ - // { - // Name: to.Ptr("col1"), - // Type: to.Ptr("Microsoft.Sql/managedInstances/databases/schemas/tables/columns"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/myRG/providers/Microsoft.Sql/managedInstances/myManagedInstanceName/databases/myDatabase/schemas/dbo/tables/table1/columns/col1"), - // Properties: &armsql.DatabaseColumnProperties{ - // ColumnType: to.Ptr(armsql.ColumnDataTypeNvarchar), - // }, - // }, - // { - // Name: to.Ptr("col2"), - // Type: to.Ptr("Microsoft.Sql/managedInstances/databases/schemas/tables/columns"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/myRG/providers/Microsoft.Sql/managedInstances/myManagedInstanceName/databases/myDatabase/schemas/dbo/tables/table1/columns/col2"), - // Properties: &armsql.DatabaseColumnProperties{ - // ColumnType: to.Ptr(armsql.ColumnDataTypeBit), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseColumnGet.json -func ExampleManagedDatabaseColumnsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewManagedDatabaseColumnsClient().Get(ctx, "myRG", "myManagedInstanceName", "myDatabase", "dbo", "table1", "column1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DatabaseColumn = armsql.DatabaseColumn{ - // Name: to.Ptr("column1"), - // Type: to.Ptr("Microsoft.Sql/managedInstances/databases/schemas/tables/columns"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/myRG/providers/Microsoft.Sql/managedInstances/myManagedInstanceName/databases/myDatabase/schemas/dbo/tables/table1/columns/column1"), - // Properties: &armsql.DatabaseColumnProperties{ - // ColumnType: to.Ptr(armsql.ColumnDataTypeBit), - // }, - // } -} diff --git a/sdk/resourcemanager/sql/armsql/manageddatabasemoveoperations_client.go b/sdk/resourcemanager/sql/armsql/manageddatabasemoveoperations_client.go new file mode 100644 index 000000000000..e232733aa607 --- /dev/null +++ b/sdk/resourcemanager/sql/armsql/manageddatabasemoveoperations_client.go @@ -0,0 +1,183 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armsql + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" +) + +// ManagedDatabaseMoveOperationsClient contains the methods for the ManagedDatabaseMoveOperations group. +// Don't use this type directly, use NewManagedDatabaseMoveOperationsClient() instead. +type ManagedDatabaseMoveOperationsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewManagedDatabaseMoveOperationsClient creates a new instance of ManagedDatabaseMoveOperationsClient with the specified values. +// - subscriptionID - The subscription ID that identifies an Azure subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewManagedDatabaseMoveOperationsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ManagedDatabaseMoveOperationsClient, error) { + cl, err := arm.NewClient(moduleName+".ManagedDatabaseMoveOperationsClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ManagedDatabaseMoveOperationsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Get - Gets a managed database move operation. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-11-01-preview +// - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure +// Resource Manager API or the portal. +// - options - ManagedDatabaseMoveOperationsClientGetOptions contains the optional parameters for the ManagedDatabaseMoveOperationsClient.Get +// method. +func (client *ManagedDatabaseMoveOperationsClient) Get(ctx context.Context, resourceGroupName string, locationName string, operationID string, options *ManagedDatabaseMoveOperationsClientGetOptions) (ManagedDatabaseMoveOperationsClientGetResponse, error) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, locationName, operationID, options) + if err != nil { + return ManagedDatabaseMoveOperationsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ManagedDatabaseMoveOperationsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ManagedDatabaseMoveOperationsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *ManagedDatabaseMoveOperationsClient) getCreateRequest(ctx context.Context, resourceGroupName string, locationName string, operationID string, options *ManagedDatabaseMoveOperationsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/managedDatabaseMoveOperationResults/{operationId}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if locationName == "" { + return nil, errors.New("parameter locationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{locationName}", url.PathEscape(locationName)) + urlPath = strings.ReplaceAll(urlPath, "{operationId}", url.PathEscape(operationID)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *ManagedDatabaseMoveOperationsClient) getHandleResponse(resp *http.Response) (ManagedDatabaseMoveOperationsClientGetResponse, error) { + result := ManagedDatabaseMoveOperationsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ManagedDatabaseMoveOperationResult); err != nil { + return ManagedDatabaseMoveOperationsClientGetResponse{}, err + } + return result, nil +} + +// NewListByLocationPager - Lists managed database move operations. +// +// Generated from API version 2022-11-01-preview +// - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure +// Resource Manager API or the portal. +// - options - ManagedDatabaseMoveOperationsClientListByLocationOptions contains the optional parameters for the ManagedDatabaseMoveOperationsClient.NewListByLocationPager +// method. +func (client *ManagedDatabaseMoveOperationsClient) NewListByLocationPager(resourceGroupName string, locationName string, options *ManagedDatabaseMoveOperationsClientListByLocationOptions) *runtime.Pager[ManagedDatabaseMoveOperationsClientListByLocationResponse] { + return runtime.NewPager(runtime.PagingHandler[ManagedDatabaseMoveOperationsClientListByLocationResponse]{ + More: func(page ManagedDatabaseMoveOperationsClientListByLocationResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ManagedDatabaseMoveOperationsClientListByLocationResponse) (ManagedDatabaseMoveOperationsClientListByLocationResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByLocationCreateRequest(ctx, resourceGroupName, locationName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ManagedDatabaseMoveOperationsClientListByLocationResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ManagedDatabaseMoveOperationsClientListByLocationResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ManagedDatabaseMoveOperationsClientListByLocationResponse{}, runtime.NewResponseError(resp) + } + return client.listByLocationHandleResponse(resp) + }, + }) +} + +// listByLocationCreateRequest creates the ListByLocation request. +func (client *ManagedDatabaseMoveOperationsClient) listByLocationCreateRequest(ctx context.Context, resourceGroupName string, locationName string, options *ManagedDatabaseMoveOperationsClientListByLocationOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/managedDatabaseMoveOperationResults" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if locationName == "" { + return nil, errors.New("parameter locationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{locationName}", url.PathEscape(locationName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + if options != nil && options.OnlyLatestPerDatabase != nil { + reqQP.Set("onlyLatestPerDatabase", strconv.FormatBool(*options.OnlyLatestPerDatabase)) + } + if options != nil && options.Filter != nil { + reqQP.Set("$filter", *options.Filter) + } + reqQP.Set("api-version", "2022-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByLocationHandleResponse handles the ListByLocation response. +func (client *ManagedDatabaseMoveOperationsClient) listByLocationHandleResponse(resp *http.Response) (ManagedDatabaseMoveOperationsClientListByLocationResponse, error) { + result := ManagedDatabaseMoveOperationsClientListByLocationResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ManagedDatabaseMoveOperationListResult); err != nil { + return ManagedDatabaseMoveOperationsClientListByLocationResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/sql/armsql/manageddatabasequeries_client.go b/sdk/resourcemanager/sql/armsql/manageddatabasequeries_client.go index 8a941e3b9ce1..eeb79928f8f4 100644 --- a/sdk/resourcemanager/sql/armsql/manageddatabasequeries_client.go +++ b/sdk/resourcemanager/sql/armsql/manageddatabasequeries_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armsql @@ -47,7 +46,7 @@ func NewManagedDatabaseQueriesClient(subscriptionID string, credential azcore.To // Get - Get query by query id. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - managedInstanceName - The name of the managed instance. @@ -55,18 +54,21 @@ func NewManagedDatabaseQueriesClient(subscriptionID string, credential azcore.To // - options - ManagedDatabaseQueriesClientGetOptions contains the optional parameters for the ManagedDatabaseQueriesClient.Get // method. func (client *ManagedDatabaseQueriesClient) Get(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, queryID string, options *ManagedDatabaseQueriesClientGetOptions) (ManagedDatabaseQueriesClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, managedInstanceName, databaseName, queryID, options) if err != nil { return ManagedDatabaseQueriesClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ManagedDatabaseQueriesClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ManagedDatabaseQueriesClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ManagedDatabaseQueriesClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -97,7 +99,7 @@ func (client *ManagedDatabaseQueriesClient) getCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -114,7 +116,7 @@ func (client *ManagedDatabaseQueriesClient) getHandleResponse(resp *http.Respons // NewListByQueryPager - Get query execution statistics by query id. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - managedInstanceName - The name of the managed instance. @@ -186,7 +188,7 @@ func (client *ManagedDatabaseQueriesClient) listByQueryCreateRequest(ctx context if options != nil && options.Interval != nil { reqQP.Set("interval", string(*options.Interval)) } - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/sql/armsql/manageddatabasequeries_client_example_test.go b/sdk/resourcemanager/sql/armsql/manageddatabasequeries_client_example_test.go deleted file mode 100644 index fc54c805fab9..000000000000 --- a/sdk/resourcemanager/sql/armsql/manageddatabasequeries_client_example_test.go +++ /dev/null @@ -1,538 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsql_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sql/armsql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceQueryGet.json -func ExampleManagedDatabaseQueriesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewManagedDatabaseQueriesClient().Get(ctx, "sqlcrudtest-7398", "sqlcrudtest-4645", "database_1", "42", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ManagedInstanceQuery = armsql.ManagedInstanceQuery{ - // Type: to.Ptr("Microsoft.Sql/managedInstances/databases/queries"), - // ID: to.Ptr("42"), - // Properties: &armsql.QueryProperties{ - // QueryText: to.Ptr("select * from DUMMY_TABLE"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceQueryStatisticsList.json -func ExampleManagedDatabaseQueriesClient_NewListByQueryPager_obtainQueryExecutionStatistics() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewManagedDatabaseQueriesClient().NewListByQueryPager("sqlcrudtest-7398", "sqlcrudtest-4645", "database_1", "42", &armsql.ManagedDatabaseQueriesClientListByQueryOptions{StartTime: nil, - EndTime: nil, - Interval: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ManagedInstanceQueryStatistics = armsql.ManagedInstanceQueryStatistics{ - // Value: []*armsql.QueryStatistics{ - // { - // Type: to.Ptr("Microsoft.Sql/managedInstances/databases/queries/statistics"), - // ID: to.Ptr("35"), - // Properties: &armsql.QueryStatisticsProperties{ - // DatabaseName: to.Ptr("db1"), - // EndTime: to.Ptr("03/02/2020 18:34:58"), - // Intervals: []*armsql.QueryMetricInterval{ - // { - // ExecutionCount: to.Ptr[int64](160), - // IntervalStartTime: to.Ptr("03/02/2020 08:00:00"), - // IntervalType: to.Ptr(armsql.QueryTimeGrainTypePT1H), - // Metrics: []*armsql.QueryMetricProperties{ - // { - // Name: to.Ptr("cpu"), - // Avg: to.Ptr[float64](0.00001665347222222222), - // DisplayName: to.Ptr("Cpu"), - // Max: to.Ptr[float64](0.000025243055555555557), - // Min: to.Ptr[float64](0.00001507638888888889), - // Stdev: to.Ptr[float64](0.0000014894345929850385), - // Sum: to.Ptr[float64](0.0026645555555555554), - // Unit: to.Ptr(armsql.QueryMetricUnitTypePercentage), - // Value: to.Ptr[float64](0), - // }, - // { - // Name: to.Ptr("io"), - // Avg: to.Ptr[float64](0), - // DisplayName: to.Ptr("Physical Io Reads"), - // Max: to.Ptr[float64](0), - // Min: to.Ptr[float64](0), - // Stdev: to.Ptr[float64](0), - // Sum: to.Ptr[float64](0), - // Unit: to.Ptr(armsql.QueryMetricUnitTypePercentage), - // Value: to.Ptr[float64](0), - // }, - // { - // Name: to.Ptr("logIo"), - // Avg: to.Ptr[float64](0), - // DisplayName: to.Ptr("Log Writes"), - // Max: to.Ptr[float64](0), - // Min: to.Ptr[float64](0), - // Stdev: to.Ptr[float64](0), - // Sum: to.Ptr[float64](0), - // Unit: to.Ptr(armsql.QueryMetricUnitTypePercentage), - // Value: to.Ptr[float64](0), - // }, - // { - // Name: to.Ptr("memory"), - // Avg: to.Ptr[float64](0), - // DisplayName: to.Ptr("Memory consumption"), - // Max: to.Ptr[float64](0), - // Min: to.Ptr[float64](0), - // Stdev: to.Ptr[float64](0), - // Sum: to.Ptr[float64](0), - // Unit: to.Ptr(armsql.QueryMetricUnitTypeKB), - // Value: to.Ptr[float64](0), - // }, - // { - // Name: to.Ptr("duration"), - // Avg: to.Ptr[float64](5026.625), - // DisplayName: to.Ptr("Query duration"), - // Max: to.Ptr[float64](18490), - // Min: to.Ptr[float64](4373), - // Stdev: to.Ptr[float64](1487.3520882343225), - // Sum: to.Ptr[float64](804260), - // Unit: to.Ptr(armsql.QueryMetricUnitTypeMicroseconds), - // Value: to.Ptr[float64](0), - // }}, - // }, - // { - // ExecutionCount: to.Ptr[int64](20), - // IntervalStartTime: to.Ptr("03/02/2020 09:00:00"), - // IntervalType: to.Ptr(armsql.QueryTimeGrainTypePT1H), - // Metrics: []*armsql.QueryMetricProperties{ - // { - // Name: to.Ptr("cpu"), - // Avg: to.Ptr[float64](0.00004479774305555555), - // DisplayName: to.Ptr("Cpu"), - // Max: to.Ptr[float64](0.00014645833333333332), - // Min: to.Ptr[float64](0.000023430555555555557), - // Stdev: to.Ptr[float64](0.00003830118344204395), - // Sum: to.Ptr[float64](0.0008959548611111111), - // Unit: to.Ptr(armsql.QueryMetricUnitTypePercentage), - // Value: to.Ptr[float64](0), - // }, - // { - // Name: to.Ptr("io"), - // Avg: to.Ptr[float64](0), - // DisplayName: to.Ptr("Physical Io Reads"), - // Max: to.Ptr[float64](0), - // Min: to.Ptr[float64](0), - // Stdev: to.Ptr[float64](0), - // Sum: to.Ptr[float64](0), - // Unit: to.Ptr(armsql.QueryMetricUnitTypePercentage), - // Value: to.Ptr[float64](0), - // }, - // { - // Name: to.Ptr("logIo"), - // Avg: to.Ptr[float64](0), - // DisplayName: to.Ptr("Log Writes"), - // Max: to.Ptr[float64](0), - // Min: to.Ptr[float64](0), - // Stdev: to.Ptr[float64](0), - // Sum: to.Ptr[float64](0), - // Unit: to.Ptr(armsql.QueryMetricUnitTypePercentage), - // Value: to.Ptr[float64](0), - // }, - // { - // Name: to.Ptr("memory"), - // Avg: to.Ptr[float64](0), - // DisplayName: to.Ptr("Memory consumption"), - // Max: to.Ptr[float64](0), - // Min: to.Ptr[float64](0), - // Stdev: to.Ptr[float64](0), - // Sum: to.Ptr[float64](0), - // Unit: to.Ptr(armsql.QueryMetricUnitTypeKB), - // Value: to.Ptr[float64](0), - // }, - // { - // Name: to.Ptr("duration"), - // Avg: to.Ptr[float64](12963.2), - // DisplayName: to.Ptr("Query duration"), - // Max: to.Ptr[float64](42289), - // Min: to.Ptr[float64](6813), - // Stdev: to.Ptr[float64](11040.140794392071), - // Sum: to.Ptr[float64](259264), - // Unit: to.Ptr(armsql.QueryMetricUnitTypeMicroseconds), - // Value: to.Ptr[float64](0), - // }}, - // }, - // { - // ExecutionCount: to.Ptr[int64](80), - // IntervalStartTime: to.Ptr("03/02/2020 15:00:00"), - // IntervalType: to.Ptr(armsql.QueryTimeGrainTypePT1H), - // Metrics: []*armsql.QueryMetricProperties{ - // { - // Name: to.Ptr("cpu"), - // Avg: to.Ptr[float64](0.000019315538194444445), - // DisplayName: to.Ptr("Cpu"), - // Max: to.Ptr[float64](0.00002764236111111111), - // Min: to.Ptr[float64](0.000018215277777777777), - // Stdev: to.Ptr[float64](0.0000010716305801875179), - // Sum: to.Ptr[float64](0.0015452430555555556), - // Unit: to.Ptr(armsql.QueryMetricUnitTypePercentage), - // Value: to.Ptr[float64](0), - // }, - // { - // Name: to.Ptr("io"), - // Avg: to.Ptr[float64](0), - // DisplayName: to.Ptr("Physical Io Reads"), - // Max: to.Ptr[float64](0), - // Min: to.Ptr[float64](0), - // Stdev: to.Ptr[float64](0), - // Sum: to.Ptr[float64](0), - // Unit: to.Ptr(armsql.QueryMetricUnitTypePercentage), - // Value: to.Ptr[float64](0), - // }, - // { - // Name: to.Ptr("logIo"), - // Avg: to.Ptr[float64](0), - // DisplayName: to.Ptr("Log Writes"), - // Max: to.Ptr[float64](0), - // Min: to.Ptr[float64](0), - // Stdev: to.Ptr[float64](0), - // Sum: to.Ptr[float64](0), - // Unit: to.Ptr(armsql.QueryMetricUnitTypePercentage), - // Value: to.Ptr[float64](0), - // }, - // { - // Name: to.Ptr("memory"), - // Avg: to.Ptr[float64](0), - // DisplayName: to.Ptr("Memory consumption"), - // Max: to.Ptr[float64](0), - // Min: to.Ptr[float64](0), - // Stdev: to.Ptr[float64](0), - // Sum: to.Ptr[float64](0), - // Unit: to.Ptr(armsql.QueryMetricUnitTypeKB), - // Value: to.Ptr[float64](0), - // }, - // { - // Name: to.Ptr("duration"), - // Avg: to.Ptr[float64](5586.2625), - // DisplayName: to.Ptr("Query duration"), - // Max: to.Ptr[float64](7982), - // Min: to.Ptr[float64](5264), - // Stdev: to.Ptr[float64](310.4915757210727), - // Sum: to.Ptr[float64](446901), - // Unit: to.Ptr(armsql.QueryMetricUnitTypeMicroseconds), - // Value: to.Ptr[float64](0), - // }}, - // }, - // { - // ExecutionCount: to.Ptr[int64](80), - // IntervalStartTime: to.Ptr("03/02/2020 17:00:00"), - // IntervalType: to.Ptr(armsql.QueryTimeGrainTypePT1H), - // Metrics: []*armsql.QueryMetricProperties{ - // { - // Name: to.Ptr("cpu"), - // Avg: to.Ptr[float64](0.000019085373263888888), - // DisplayName: to.Ptr("Cpu"), - // Max: to.Ptr[float64](0.00002782638888888889), - // Min: to.Ptr[float64](0.000017819444444444443), - // Stdev: to.Ptr[float64](0.0000012309244108727927), - // Sum: to.Ptr[float64](0.0015268298611111112), - // Unit: to.Ptr(armsql.QueryMetricUnitTypePercentage), - // Value: to.Ptr[float64](0), - // }, - // { - // Name: to.Ptr("io"), - // Avg: to.Ptr[float64](0), - // DisplayName: to.Ptr("Physical Io Reads"), - // Max: to.Ptr[float64](0), - // Min: to.Ptr[float64](0), - // Stdev: to.Ptr[float64](0), - // Sum: to.Ptr[float64](0), - // Unit: to.Ptr(armsql.QueryMetricUnitTypePercentage), - // Value: to.Ptr[float64](0), - // }, - // { - // Name: to.Ptr("logIo"), - // Avg: to.Ptr[float64](0), - // DisplayName: to.Ptr("Log Writes"), - // Max: to.Ptr[float64](0), - // Min: to.Ptr[float64](0), - // Stdev: to.Ptr[float64](0), - // Sum: to.Ptr[float64](0), - // Unit: to.Ptr(armsql.QueryMetricUnitTypePercentage), - // Value: to.Ptr[float64](0), - // }, - // { - // Name: to.Ptr("memory"), - // Avg: to.Ptr[float64](0), - // DisplayName: to.Ptr("Memory consumption"), - // Max: to.Ptr[float64](0), - // Min: to.Ptr[float64](0), - // Stdev: to.Ptr[float64](0), - // Sum: to.Ptr[float64](0), - // Unit: to.Ptr(armsql.QueryMetricUnitTypeKB), - // Value: to.Ptr[float64](0), - // }, - // { - // Name: to.Ptr("duration"), - // Avg: to.Ptr[float64](5517.2), - // DisplayName: to.Ptr("Query duration"), - // Max: to.Ptr[float64](8052), - // Min: to.Ptr[float64](5147), - // Stdev: to.Ptr[float64](356.8763581410226), - // Sum: to.Ptr[float64](441376), - // Unit: to.Ptr(armsql.QueryMetricUnitTypeMicroseconds), - // Value: to.Ptr[float64](0), - // }}, - // }}, - // QueryID: to.Ptr("35"), - // StartTime: to.Ptr("03/01/2020 18:34:58"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceQueryStatisticsListMax.json -func ExampleManagedDatabaseQueriesClient_NewListByQueryPager_obtainQueryExecutionStatisticsExampleWithAllRequestParameters() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewManagedDatabaseQueriesClient().NewListByQueryPager("sqlcrudtest-7398", "sqlcrudtest-4645", "database_1", "42", &armsql.ManagedDatabaseQueriesClientListByQueryOptions{StartTime: to.Ptr("03/01/2020 16:23:09"), - EndTime: to.Ptr("03/11/2020 14:00:00"), - Interval: to.Ptr(armsql.QueryTimeGrainTypeP1D), - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ManagedInstanceQueryStatistics = armsql.ManagedInstanceQueryStatistics{ - // Value: []*armsql.QueryStatistics{ - // { - // Type: to.Ptr("Microsoft.Sql/managedInstances/databases/queries/statistics"), - // ID: to.Ptr("28"), - // Properties: &armsql.QueryStatisticsProperties{ - // DatabaseName: to.Ptr("db1"), - // EndTime: to.Ptr("03/11/2020 14:00:00"), - // Intervals: []*armsql.QueryMetricInterval{ - // { - // ExecutionCount: to.Ptr[int64](1), - // IntervalStartTime: to.Ptr("03/11/2020 00:00:00"), - // IntervalType: to.Ptr(armsql.QueryTimeGrainTypeP1D), - // Metrics: []*armsql.QueryMetricProperties{ - // { - // Name: to.Ptr("cpu"), - // Avg: to.Ptr[float64](0.0015934667245370371), - // DisplayName: to.Ptr("Cpu"), - // Max: to.Ptr[float64](0.0015934667245370371), - // Min: to.Ptr[float64](0.0015934667245370371), - // Stdev: to.Ptr[float64](0), - // Sum: to.Ptr[float64](0.0015934667245370371), - // Unit: to.Ptr(armsql.QueryMetricUnitTypePercentage), - // Value: to.Ptr[float64](0), - // }, - // { - // Name: to.Ptr("io"), - // Avg: to.Ptr[float64](0.000004224537037037037), - // DisplayName: to.Ptr("Physical Io Reads"), - // Max: to.Ptr[float64](0.000004224537037037037), - // Min: to.Ptr[float64](0.000004224537037037037), - // Stdev: to.Ptr[float64](0), - // Sum: to.Ptr[float64](0.000004224537037037037), - // Unit: to.Ptr(armsql.QueryMetricUnitTypePercentage), - // Value: to.Ptr[float64](0), - // }, - // { - // Name: to.Ptr("logIo"), - // Avg: to.Ptr[float64](0), - // DisplayName: to.Ptr("Log Writes"), - // Max: to.Ptr[float64](0), - // Min: to.Ptr[float64](0), - // Stdev: to.Ptr[float64](0), - // Sum: to.Ptr[float64](0), - // Unit: to.Ptr(armsql.QueryMetricUnitTypePercentage), - // Value: to.Ptr[float64](0), - // }, - // { - // Name: to.Ptr("memory"), - // Avg: to.Ptr[float64](8336), - // DisplayName: to.Ptr("Memory consumption"), - // Max: to.Ptr[float64](8336), - // Min: to.Ptr[float64](8336), - // Stdev: to.Ptr[float64](0), - // Sum: to.Ptr[float64](8336), - // Unit: to.Ptr(armsql.QueryMetricUnitTypeKB), - // Value: to.Ptr[float64](0), - // }, - // { - // Name: to.Ptr("duration"), - // Avg: to.Ptr[float64](11091296), - // DisplayName: to.Ptr("Query duration"), - // Max: to.Ptr[float64](11091296), - // Min: to.Ptr[float64](11091296), - // Stdev: to.Ptr[float64](0), - // Sum: to.Ptr[float64](11091296), - // Unit: to.Ptr(armsql.QueryMetricUnitTypeMicroseconds), - // Value: to.Ptr[float64](0), - // }}, - // }}, - // QueryID: to.Ptr("28"), - // StartTime: to.Ptr("03/01/2020 16:23:09"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceQueryStatisticsListMin.json -func ExampleManagedDatabaseQueriesClient_NewListByQueryPager_obtainQueryExecutionStatisticsMinimalExampleWithOnlyMandatoryRequestParameters() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewManagedDatabaseQueriesClient().NewListByQueryPager("sqlcrudtest-7398", "sqlcrudtest-4645", "database_1", "42", &armsql.ManagedDatabaseQueriesClientListByQueryOptions{StartTime: nil, - EndTime: nil, - Interval: to.Ptr(armsql.QueryTimeGrainTypePT1H), - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ManagedInstanceQueryStatistics = armsql.ManagedInstanceQueryStatistics{ - // Value: []*armsql.QueryStatistics{ - // { - // Type: to.Ptr("Microsoft.Sql/managedInstances/databases/queries/statistics"), - // ID: to.Ptr("28"), - // Properties: &armsql.QueryStatisticsProperties{ - // DatabaseName: to.Ptr("db1"), - // EndTime: to.Ptr("03/11/2020 14:00:30"), - // Intervals: []*armsql.QueryMetricInterval{ - // { - // ExecutionCount: to.Ptr[int64](1), - // IntervalStartTime: to.Ptr("03/11/2020 11:00:00"), - // IntervalType: to.Ptr(armsql.QueryTimeGrainTypePT1H), - // Metrics: []*armsql.QueryMetricProperties{ - // { - // Name: to.Ptr("cpu"), - // Avg: to.Ptr[float64](0.03824320138888889), - // DisplayName: to.Ptr("Cpu"), - // Max: to.Ptr[float64](0.03824320138888889), - // Min: to.Ptr[float64](0.03824320138888889), - // Stdev: to.Ptr[float64](0), - // Sum: to.Ptr[float64](0.03824320138888889), - // Unit: to.Ptr(armsql.QueryMetricUnitTypePercentage), - // Value: to.Ptr[float64](0), - // }, - // { - // Name: to.Ptr("io"), - // Avg: to.Ptr[float64](0.0001013888888888889), - // DisplayName: to.Ptr("Physical Io Reads"), - // Max: to.Ptr[float64](0.0001013888888888889), - // Min: to.Ptr[float64](0.0001013888888888889), - // Stdev: to.Ptr[float64](0), - // Sum: to.Ptr[float64](0.0001013888888888889), - // Unit: to.Ptr(armsql.QueryMetricUnitTypePercentage), - // Value: to.Ptr[float64](0), - // }, - // { - // Name: to.Ptr("logIo"), - // Avg: to.Ptr[float64](0), - // DisplayName: to.Ptr("Log Writes"), - // Max: to.Ptr[float64](0), - // Min: to.Ptr[float64](0), - // Stdev: to.Ptr[float64](0), - // Sum: to.Ptr[float64](0), - // Unit: to.Ptr(armsql.QueryMetricUnitTypePercentage), - // Value: to.Ptr[float64](0), - // }, - // { - // Name: to.Ptr("memory"), - // Avg: to.Ptr[float64](8336), - // DisplayName: to.Ptr("Memory consumption"), - // Max: to.Ptr[float64](8336), - // Min: to.Ptr[float64](8336), - // Stdev: to.Ptr[float64](0), - // Sum: to.Ptr[float64](8336), - // Unit: to.Ptr(armsql.QueryMetricUnitTypeKB), - // Value: to.Ptr[float64](0), - // }, - // { - // Name: to.Ptr("duration"), - // Avg: to.Ptr[float64](11091296), - // DisplayName: to.Ptr("Query duration"), - // Max: to.Ptr[float64](11091296), - // Min: to.Ptr[float64](11091296), - // Stdev: to.Ptr[float64](0), - // Sum: to.Ptr[float64](11091296), - // Unit: to.Ptr(armsql.QueryMetricUnitTypeMicroseconds), - // Value: to.Ptr[float64](0), - // }}, - // }}, - // QueryID: to.Ptr("28"), - // StartTime: to.Ptr("03/10/2020 14:00:30"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/sql/armsql/manageddatabaserecommendedsensitivitylabels_client.go b/sdk/resourcemanager/sql/armsql/manageddatabaserecommendedsensitivitylabels_client.go index 0f05c3a08734..57cfbce30fdc 100644 --- a/sdk/resourcemanager/sql/armsql/manageddatabaserecommendedsensitivitylabels_client.go +++ b/sdk/resourcemanager/sql/armsql/manageddatabaserecommendedsensitivitylabels_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armsql @@ -47,7 +46,7 @@ func NewManagedDatabaseRecommendedSensitivityLabelsClient(subscriptionID string, // Update - Update recommended sensitivity labels states of a given database using an operations batch. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - managedInstanceName - The name of the managed instance. @@ -55,16 +54,18 @@ func NewManagedDatabaseRecommendedSensitivityLabelsClient(subscriptionID string, // - options - ManagedDatabaseRecommendedSensitivityLabelsClientUpdateOptions contains the optional parameters for the ManagedDatabaseRecommendedSensitivityLabelsClient.Update // method. func (client *ManagedDatabaseRecommendedSensitivityLabelsClient) Update(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, parameters RecommendedSensitivityLabelUpdateList, options *ManagedDatabaseRecommendedSensitivityLabelsClientUpdateOptions) (ManagedDatabaseRecommendedSensitivityLabelsClientUpdateResponse, error) { + var err error req, err := client.updateCreateRequest(ctx, resourceGroupName, managedInstanceName, databaseName, parameters, options) if err != nil { return ManagedDatabaseRecommendedSensitivityLabelsClientUpdateResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ManagedDatabaseRecommendedSensitivityLabelsClientUpdateResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ManagedDatabaseRecommendedSensitivityLabelsClientUpdateResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ManagedDatabaseRecommendedSensitivityLabelsClientUpdateResponse{}, err } return ManagedDatabaseRecommendedSensitivityLabelsClientUpdateResponse{}, nil } @@ -93,7 +94,10 @@ func (client *ManagedDatabaseRecommendedSensitivityLabelsClient) updateCreateReq return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } diff --git a/sdk/resourcemanager/sql/armsql/manageddatabaserecommendedsensitivitylabels_client_example_test.go b/sdk/resourcemanager/sql/armsql/manageddatabaserecommendedsensitivitylabels_client_example_test.go deleted file mode 100644 index 621114c30e71..000000000000 --- a/sdk/resourcemanager/sql/armsql/manageddatabaserecommendedsensitivitylabels_client_example_test.go +++ /dev/null @@ -1,62 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsql_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sql/armsql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseSensitivityLabelsRecommendedUpdate.json -func ExampleManagedDatabaseRecommendedSensitivityLabelsClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewManagedDatabaseRecommendedSensitivityLabelsClient().Update(ctx, "myRG", "myManagedInstanceName", "myDatabase", armsql.RecommendedSensitivityLabelUpdateList{ - Operations: []*armsql.RecommendedSensitivityLabelUpdate{ - { - Properties: &armsql.RecommendedSensitivityLabelUpdateProperties{ - Schema: to.Ptr("dbo"), - Column: to.Ptr("column1"), - Op: to.Ptr(armsql.RecommendedSensitivityLabelUpdateKindEnable), - Table: to.Ptr("table1"), - }, - }, - { - Properties: &armsql.RecommendedSensitivityLabelUpdateProperties{ - Schema: to.Ptr("dbo"), - Column: to.Ptr("column2"), - Op: to.Ptr(armsql.RecommendedSensitivityLabelUpdateKindDisable), - Table: to.Ptr("table2"), - }, - }, - { - Properties: &armsql.RecommendedSensitivityLabelUpdateProperties{ - Schema: to.Ptr("dbo"), - Column: to.Ptr("Column3"), - Op: to.Ptr(armsql.RecommendedSensitivityLabelUpdateKindDisable), - Table: to.Ptr("Table1"), - }, - }}, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/sql/armsql/manageddatabaserestoredetails_client.go b/sdk/resourcemanager/sql/armsql/manageddatabaserestoredetails_client.go index 620dcdfbd1f4..2c06af986df7 100644 --- a/sdk/resourcemanager/sql/armsql/manageddatabaserestoredetails_client.go +++ b/sdk/resourcemanager/sql/armsql/manageddatabaserestoredetails_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armsql @@ -47,7 +46,7 @@ func NewManagedDatabaseRestoreDetailsClient(subscriptionID string, credential az // Get - Gets managed database restore details. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - managedInstanceName - The name of the managed instance. @@ -56,18 +55,21 @@ func NewManagedDatabaseRestoreDetailsClient(subscriptionID string, credential az // - options - ManagedDatabaseRestoreDetailsClientGetOptions contains the optional parameters for the ManagedDatabaseRestoreDetailsClient.Get // method. func (client *ManagedDatabaseRestoreDetailsClient) Get(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, restoreDetailsName RestoreDetailsName, options *ManagedDatabaseRestoreDetailsClientGetOptions) (ManagedDatabaseRestoreDetailsClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, managedInstanceName, databaseName, restoreDetailsName, options) if err != nil { return ManagedDatabaseRestoreDetailsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ManagedDatabaseRestoreDetailsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ManagedDatabaseRestoreDetailsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ManagedDatabaseRestoreDetailsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -98,7 +100,7 @@ func (client *ManagedDatabaseRestoreDetailsClient) getCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/sql/armsql/manageddatabaserestoredetails_client_example_test.go b/sdk/resourcemanager/sql/armsql/manageddatabaserestoredetails_client_example_test.go deleted file mode 100644 index a56c25cc5ba1..000000000000 --- a/sdk/resourcemanager/sql/armsql/manageddatabaserestoredetails_client_example_test.go +++ /dev/null @@ -1,53 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsql_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sql/armsql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseRestoreDetails.json -func ExampleManagedDatabaseRestoreDetailsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewManagedDatabaseRestoreDetailsClient().Get(ctx, "Default-SQL-SouthEastAsia", "managedInstance", "testdb", armsql.RestoreDetailsNameDefault, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ManagedDatabaseRestoreDetailsResult = armsql.ManagedDatabaseRestoreDetailsResult{ - // Name: to.Ptr("current"), - // Type: to.Ptr("Microsoft.Sql/managedInstances/databases/restoreDetails"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/managedInstances/managedInstance/databases/testdb/restoreDetails/current"), - // Properties: &armsql.ManagedDatabaseRestoreDetailsProperties{ - // CurrentRestoringFileName: to.Ptr("full_0"), - // LastUploadedFileName: to.Ptr("log2_3"), - // LastUploadedFileTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-06-15T11:38:33Z"); return t}()), - // NumberOfFilesDetected: to.Ptr[int64](26), - // PercentCompleted: to.Ptr[float64](0), - // Status: to.Ptr("Restoring"), - // UnrestorableFiles: []*string{ - // }, - // }, - // } -} diff --git a/sdk/resourcemanager/sql/armsql/manageddatabases_client.go b/sdk/resourcemanager/sql/armsql/manageddatabases_client.go index 7fa650a7f66d..83b29811e8a6 100644 --- a/sdk/resourcemanager/sql/armsql/manageddatabases_client.go +++ b/sdk/resourcemanager/sql/armsql/manageddatabases_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armsql @@ -44,10 +43,164 @@ func NewManagedDatabasesClient(subscriptionID string, credential azcore.TokenCre return client, nil } +// BeginCancelMove - Cancels a managed database move operation. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-11-01-preview +// - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure +// Resource Manager API or the portal. +// - managedInstanceName - The name of the managed instance. +// - databaseName - The name of the database. +// - parameters - Parameters of the cancel managed database move operation. +// - options - ManagedDatabasesClientBeginCancelMoveOptions contains the optional parameters for the ManagedDatabasesClient.BeginCancelMove +// method. +func (client *ManagedDatabasesClient) BeginCancelMove(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, parameters ManagedDatabaseMoveDefinition, options *ManagedDatabasesClientBeginCancelMoveOptions) (*runtime.Poller[ManagedDatabasesClientCancelMoveResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.cancelMove(ctx, resourceGroupName, managedInstanceName, databaseName, parameters, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller[ManagedDatabasesClientCancelMoveResponse](resp, client.internal.Pipeline(), nil) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[ManagedDatabasesClientCancelMoveResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// CancelMove - Cancels a managed database move operation. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-11-01-preview +func (client *ManagedDatabasesClient) cancelMove(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, parameters ManagedDatabaseMoveDefinition, options *ManagedDatabasesClientBeginCancelMoveOptions) (*http.Response, error) { + var err error + req, err := client.cancelMoveCreateRequest(ctx, resourceGroupName, managedInstanceName, databaseName, parameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// cancelMoveCreateRequest creates the CancelMove request. +func (client *ManagedDatabasesClient) cancelMoveCreateRequest(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, parameters ManagedDatabaseMoveDefinition, options *ManagedDatabasesClientBeginCancelMoveOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/cancelMove" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if managedInstanceName == "" { + return nil, errors.New("parameter managedInstanceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{managedInstanceName}", url.PathEscape(managedInstanceName)) + if databaseName == "" { + return nil, errors.New("parameter databaseName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{databaseName}", url.PathEscape(databaseName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// BeginCompleteMove - Completes a managed database move operation. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-11-01-preview +// - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure +// Resource Manager API or the portal. +// - managedInstanceName - The name of the managed instance. +// - databaseName - The name of the database. +// - parameters - Parameters of the complete managed database move operation. +// - options - ManagedDatabasesClientBeginCompleteMoveOptions contains the optional parameters for the ManagedDatabasesClient.BeginCompleteMove +// method. +func (client *ManagedDatabasesClient) BeginCompleteMove(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, parameters ManagedDatabaseMoveDefinition, options *ManagedDatabasesClientBeginCompleteMoveOptions) (*runtime.Poller[ManagedDatabasesClientCompleteMoveResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.completeMove(ctx, resourceGroupName, managedInstanceName, databaseName, parameters, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller[ManagedDatabasesClientCompleteMoveResponse](resp, client.internal.Pipeline(), nil) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[ManagedDatabasesClientCompleteMoveResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// CompleteMove - Completes a managed database move operation. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-11-01-preview +func (client *ManagedDatabasesClient) completeMove(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, parameters ManagedDatabaseMoveDefinition, options *ManagedDatabasesClientBeginCompleteMoveOptions) (*http.Response, error) { + var err error + req, err := client.completeMoveCreateRequest(ctx, resourceGroupName, managedInstanceName, databaseName, parameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// completeMoveCreateRequest creates the CompleteMove request. +func (client *ManagedDatabasesClient) completeMoveCreateRequest(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, parameters ManagedDatabaseMoveDefinition, options *ManagedDatabasesClientBeginCompleteMoveOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/completeMove" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if managedInstanceName == "" { + return nil, errors.New("parameter managedInstanceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{managedInstanceName}", url.PathEscape(managedInstanceName)) + if databaseName == "" { + return nil, errors.New("parameter databaseName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{databaseName}", url.PathEscape(databaseName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + // BeginCompleteRestore - Completes the restore operation on a managed database. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - managedInstanceName - The name of the managed instance. @@ -61,7 +214,8 @@ func (client *ManagedDatabasesClient) BeginCompleteRestore(ctx context.Context, if err != nil { return nil, err } - return runtime.NewPoller[ManagedDatabasesClientCompleteRestoreResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[ManagedDatabasesClientCompleteRestoreResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[ManagedDatabasesClientCompleteRestoreResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -70,20 +224,22 @@ func (client *ManagedDatabasesClient) BeginCompleteRestore(ctx context.Context, // CompleteRestore - Completes the restore operation on a managed database. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview func (client *ManagedDatabasesClient) completeRestore(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, parameters CompleteDatabaseRestoreDefinition, options *ManagedDatabasesClientBeginCompleteRestoreOptions) (*http.Response, error) { + var err error req, err := client.completeRestoreCreateRequest(ctx, resourceGroupName, managedInstanceName, databaseName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // completeRestoreCreateRequest creates the CompleteRestore request. @@ -110,15 +266,18 @@ func (client *ManagedDatabasesClient) completeRestoreCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // BeginCreateOrUpdate - Creates a new database or updates an existing database. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - managedInstanceName - The name of the managed instance. @@ -132,7 +291,8 @@ func (client *ManagedDatabasesClient) BeginCreateOrUpdate(ctx context.Context, r if err != nil { return nil, err } - return runtime.NewPoller[ManagedDatabasesClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[ManagedDatabasesClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[ManagedDatabasesClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -141,20 +301,22 @@ func (client *ManagedDatabasesClient) BeginCreateOrUpdate(ctx context.Context, r // CreateOrUpdate - Creates a new database or updates an existing database. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview func (client *ManagedDatabasesClient) createOrUpdate(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, parameters ManagedDatabase, options *ManagedDatabasesClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, managedInstanceName, databaseName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createOrUpdateCreateRequest creates the CreateOrUpdate request. @@ -181,16 +343,19 @@ func (client *ManagedDatabasesClient) createOrUpdateCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // BeginDelete - Deletes a managed database. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - managedInstanceName - The name of the managed instance. @@ -203,7 +368,8 @@ func (client *ManagedDatabasesClient) BeginDelete(ctx context.Context, resourceG if err != nil { return nil, err } - return runtime.NewPoller[ManagedDatabasesClientDeleteResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[ManagedDatabasesClientDeleteResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[ManagedDatabasesClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -212,20 +378,22 @@ func (client *ManagedDatabasesClient) BeginDelete(ctx context.Context, resourceG // Delete - Deletes a managed database. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview func (client *ManagedDatabasesClient) deleteOperation(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, options *ManagedDatabasesClientBeginDeleteOptions) (*http.Response, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, managedInstanceName, databaseName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteCreateRequest creates the Delete request. @@ -252,7 +420,7 @@ func (client *ManagedDatabasesClient) deleteCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -260,25 +428,28 @@ func (client *ManagedDatabasesClient) deleteCreateRequest(ctx context.Context, r // Get - Gets a managed database. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - managedInstanceName - The name of the managed instance. // - databaseName - The name of the database. // - options - ManagedDatabasesClientGetOptions contains the optional parameters for the ManagedDatabasesClient.Get method. func (client *ManagedDatabasesClient) Get(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, options *ManagedDatabasesClientGetOptions) (ManagedDatabasesClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, managedInstanceName, databaseName, options) if err != nil { return ManagedDatabasesClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ManagedDatabasesClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ManagedDatabasesClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ManagedDatabasesClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -305,7 +476,7 @@ func (client *ManagedDatabasesClient) getCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -322,7 +493,7 @@ func (client *ManagedDatabasesClient) getHandleResponse(resp *http.Response) (Ma // NewListByInstancePager - Gets a list of managed databases. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - managedInstanceName - The name of the managed instance. @@ -376,7 +547,7 @@ func (client *ManagedDatabasesClient) listByInstanceCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -393,7 +564,7 @@ func (client *ManagedDatabasesClient) listByInstanceHandleResponse(resp *http.Re // NewListInaccessibleByInstancePager - Gets a list of inaccessible managed databases in a managed instance // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - managedInstanceName - The name of the managed instance. @@ -447,7 +618,7 @@ func (client *ManagedDatabasesClient) listInaccessibleByInstanceCreateRequest(ct return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -462,10 +633,87 @@ func (client *ManagedDatabasesClient) listInaccessibleByInstanceHandleResponse(r return result, nil } +// BeginStartMove - Starts a managed database move operation. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-11-01-preview +// - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure +// Resource Manager API or the portal. +// - managedInstanceName - The name of the managed instance. +// - databaseName - The name of the database. +// - parameters - Parameters of the start managed database move operation. +// - options - ManagedDatabasesClientBeginStartMoveOptions contains the optional parameters for the ManagedDatabasesClient.BeginStartMove +// method. +func (client *ManagedDatabasesClient) BeginStartMove(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, parameters ManagedDatabaseStartMoveDefinition, options *ManagedDatabasesClientBeginStartMoveOptions) (*runtime.Poller[ManagedDatabasesClientStartMoveResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.startMove(ctx, resourceGroupName, managedInstanceName, databaseName, parameters, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller[ManagedDatabasesClientStartMoveResponse](resp, client.internal.Pipeline(), nil) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[ManagedDatabasesClientStartMoveResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// StartMove - Starts a managed database move operation. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-11-01-preview +func (client *ManagedDatabasesClient) startMove(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, parameters ManagedDatabaseStartMoveDefinition, options *ManagedDatabasesClientBeginStartMoveOptions) (*http.Response, error) { + var err error + req, err := client.startMoveCreateRequest(ctx, resourceGroupName, managedInstanceName, databaseName, parameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// startMoveCreateRequest creates the StartMove request. +func (client *ManagedDatabasesClient) startMoveCreateRequest(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, parameters ManagedDatabaseStartMoveDefinition, options *ManagedDatabasesClientBeginStartMoveOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/startMove" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if managedInstanceName == "" { + return nil, errors.New("parameter managedInstanceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{managedInstanceName}", url.PathEscape(managedInstanceName)) + if databaseName == "" { + return nil, errors.New("parameter databaseName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{databaseName}", url.PathEscape(databaseName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + // BeginUpdate - Updates an existing database. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - managedInstanceName - The name of the managed instance. @@ -479,7 +727,8 @@ func (client *ManagedDatabasesClient) BeginUpdate(ctx context.Context, resourceG if err != nil { return nil, err } - return runtime.NewPoller[ManagedDatabasesClientUpdateResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[ManagedDatabasesClientUpdateResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[ManagedDatabasesClientUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -488,20 +737,22 @@ func (client *ManagedDatabasesClient) BeginUpdate(ctx context.Context, resourceG // Update - Updates an existing database. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview func (client *ManagedDatabasesClient) update(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, parameters ManagedDatabaseUpdate, options *ManagedDatabasesClientBeginUpdateOptions) (*http.Response, error) { + var err error req, err := client.updateCreateRequest(ctx, resourceGroupName, managedInstanceName, databaseName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // updateCreateRequest creates the Update request. @@ -528,8 +779,11 @@ func (client *ManagedDatabasesClient) updateCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } diff --git a/sdk/resourcemanager/sql/armsql/manageddatabases_client_example_test.go b/sdk/resourcemanager/sql/armsql/manageddatabases_client_example_test.go deleted file mode 100644 index 35efc3e3ebb5..000000000000 --- a/sdk/resourcemanager/sql/armsql/manageddatabases_client_example_test.go +++ /dev/null @@ -1,541 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsql_test - -import ( - "context" - "log" - - "time" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sql/armsql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseListByManagedInstance.json -func ExampleManagedDatabasesClient_NewListByInstancePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewManagedDatabasesClient().NewListByInstancePager("Test1", "managedInstance", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ManagedDatabaseListResult = armsql.ManagedDatabaseListResult{ - // Value: []*armsql.ManagedDatabase{ - // { - // Name: to.Ptr("testdb1"), - // Type: to.Ptr("Microsoft.Sql/managedInstances/databases"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.Sql/managedInstances/testcl/databases/testdb1"), - // Location: to.Ptr("southeastasia"), - // Properties: &armsql.ManagedDatabaseProperties{ - // Collation: to.Ptr("SQL_Latin1_General_CP1_CI_AS"), - // CreationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-08-04T15:00:17.73Z"); return t}()), - // DefaultSecondaryLocation: to.Ptr("North Europe"), - // Status: to.Ptr(armsql.ManagedDatabaseStatusOnline), - // }, - // }, - // { - // Name: to.Ptr("testdb2"), - // Type: to.Ptr("Microsoft.Sql/managedInstances/databases"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.Sql/managedInstances/testcl/databases/testdb2"), - // Location: to.Ptr("southeastasia"), - // Properties: &armsql.ManagedDatabaseProperties{ - // Collation: to.Ptr("SQL_Latin1_General_CP1_CI_AS"), - // CreationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-08-04T15:00:17.73Z"); return t}()), - // DefaultSecondaryLocation: to.Ptr("North Europe"), - // Status: to.Ptr(armsql.ManagedDatabaseStatusOnline), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseGet.json -func ExampleManagedDatabasesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewManagedDatabasesClient().Get(ctx, "Test1", "managedInstance", "managedDatabase", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ManagedDatabase = armsql.ManagedDatabase{ - // Name: to.Ptr("testdb1"), - // Type: to.Ptr("Microsoft.Sql/managedInstances/databases"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.Sql/managedInstances/testcl/databases/testdb1"), - // Location: to.Ptr("southeastasia"), - // Properties: &armsql.ManagedDatabaseProperties{ - // Collation: to.Ptr("SQL_Latin1_General_CP1_CI_AS"), - // CreationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-08-04T15:00:17.73Z"); return t}()), - // DefaultSecondaryLocation: to.Ptr("North Europe"), - // Status: to.Ptr(armsql.ManagedDatabaseStatusOnline), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseCreateRestoreExternalBackup.json -func ExampleManagedDatabasesClient_BeginCreateOrUpdate_createsANewManagedDatabaseByRestoringFromAnExternalBackup() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewManagedDatabasesClient().BeginCreateOrUpdate(ctx, "Default-SQL-SouthEastAsia", "managedInstance", "managedDatabase", armsql.ManagedDatabase{ - Location: to.Ptr("southeastasia"), - Properties: &armsql.ManagedDatabaseProperties{ - AutoCompleteRestore: to.Ptr(true), - Collation: to.Ptr("SQL_Latin1_General_CP1_CI_AS"), - CreateMode: to.Ptr(armsql.ManagedDatabaseCreateModeRestoreExternalBackup), - LastBackupName: to.Ptr("last_backup_name"), - StorageContainerSasToken: to.Ptr("sv=2015-12-11&sr=c&sp=rl&sig=1234"), - StorageContainerURI: to.Ptr("https://myaccountname.blob.core.windows.net/backups"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ManagedDatabase = armsql.ManagedDatabase{ - // Name: to.Ptr("testdb1"), - // Type: to.Ptr("Microsoft.Sql/managedInstances/databases"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/managedInstances/testsvr/databases/testdb1"), - // Location: to.Ptr("southeastasia"), - // Tags: map[string]*string{ - // "tagKey1": to.Ptr("TagValue1"), - // }, - // Properties: &armsql.ManagedDatabaseProperties{ - // Collation: to.Ptr("SQL_Latin1_General_CP1_CI_AS"), - // CreationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-06-07T04:41:33.937Z"); return t}()), - // DefaultSecondaryLocation: to.Ptr("North Europe"), - // Status: to.Ptr(armsql.ManagedDatabaseStatusOnline), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseCreateRecovery.json -func ExampleManagedDatabasesClient_BeginCreateOrUpdate_createsANewManagedDatabaseFromRestoringAGeoReplicatedBackup() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewManagedDatabasesClient().BeginCreateOrUpdate(ctx, "Default-SQL-SouthEastAsia", "server1", "testdb_recovered", armsql.ManagedDatabase{ - Location: to.Ptr("southeastasia"), - Properties: &armsql.ManagedDatabaseProperties{ - CreateMode: to.Ptr(armsql.ManagedDatabaseCreateModeRecovery), - RecoverableDatabaseID: to.Ptr("/subscriptions/11111111-2222-3333-4444-555555555555/resourceGroups/Default-SQL-WestEurope/providers/Microsoft.Sql/managedInstances/testsvr/recoverableDatabases/testdb"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ManagedDatabase = armsql.ManagedDatabase{ - // Name: to.Ptr("testdb_recovered"), - // Type: to.Ptr("Microsoft.Sql/managedInstances/databases"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/managedInstances/server1/recoverableDatabases/testdb_recovered"), - // Location: to.Ptr("southeastasia"), - // Tags: map[string]*string{ - // "tagKey1": to.Ptr("TagValue1"), - // }, - // Properties: &armsql.ManagedDatabaseProperties{ - // Collation: to.Ptr("SQL_Latin1_General_CP1_CI_AS"), - // CreationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-11-07T04:41:33.937Z"); return t}()), - // Status: to.Ptr(armsql.ManagedDatabaseStatusOnline), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseCreateRestoreLtrBackup.json -func ExampleManagedDatabasesClient_BeginCreateOrUpdate_createsANewManagedDatabaseFromRestoringALongTermRetentionBackup() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewManagedDatabasesClient().BeginCreateOrUpdate(ctx, "Default-SQL-SouthEastAsia", "managedInstance", "managedDatabase", armsql.ManagedDatabase{ - Location: to.Ptr("southeastasia"), - Properties: &armsql.ManagedDatabaseProperties{ - Collation: to.Ptr("SQL_Latin1_General_CP1_CI_AS"), - CreateMode: to.Ptr(armsql.ManagedDatabaseCreateModeRestoreExternalBackup), - StorageContainerSasToken: to.Ptr("sv=2015-12-11&sr=c&sp=rl&sig=1234"), - StorageContainerURI: to.Ptr("https://myaccountname.blob.core.windows.net/backups"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ManagedDatabase = armsql.ManagedDatabase{ - // Name: to.Ptr("testdb1"), - // Type: to.Ptr("Microsoft.Sql/managedInstances/databases"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/managedInstances/testsvr/databases/testdb1"), - // Location: to.Ptr("southeastasia"), - // Tags: map[string]*string{ - // "tagKey1": to.Ptr("TagValue1"), - // }, - // Properties: &armsql.ManagedDatabaseProperties{ - // Collation: to.Ptr("SQL_Latin1_General_CP1_CI_AS"), - // CreationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-06-07T04:41:33.937Z"); return t}()), - // DefaultSecondaryLocation: to.Ptr("North Europe"), - // Status: to.Ptr(armsql.ManagedDatabaseStatusOnline), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseCreatePointInTimeRestore.json -func ExampleManagedDatabasesClient_BeginCreateOrUpdate_createsANewManagedDatabaseUsingPointInTimeRestore() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewManagedDatabasesClient().BeginCreateOrUpdate(ctx, "Default-SQL-SouthEastAsia", "managedInstance", "managedDatabase", armsql.ManagedDatabase{ - Location: to.Ptr("southeastasia"), - Properties: &armsql.ManagedDatabaseProperties{ - CreateMode: to.Ptr(armsql.ManagedDatabaseCreateModePointInTimeRestore), - RestorePointInTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-07-14T05:35:31.503Z"); return t }()), - SourceDatabaseID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/managedInstances/testsvr/databases/testdb"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ManagedDatabase = armsql.ManagedDatabase{ - // Name: to.Ptr("testdb1"), - // Type: to.Ptr("Microsoft.Sql/managedInstances/databases"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/managedInstances/testsvr/databases/testdb1"), - // Location: to.Ptr("southeastasia"), - // Tags: map[string]*string{ - // "tagKey1": to.Ptr("TagValue1"), - // }, - // Properties: &armsql.ManagedDatabaseProperties{ - // Collation: to.Ptr("SQL_Latin1_General_CP1_CI_AS"), - // CreationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-06-07T04:41:33.937Z"); return t}()), - // DefaultSecondaryLocation: to.Ptr("North Europe"), - // Status: to.Ptr(armsql.ManagedDatabaseStatusOnline), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseCreateMax.json -func ExampleManagedDatabasesClient_BeginCreateOrUpdate_createsANewManagedDatabaseWithMaximalProperties() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewManagedDatabasesClient().BeginCreateOrUpdate(ctx, "Default-SQL-SouthEastAsia", "managedInstance", "managedDatabase", armsql.ManagedDatabase{ - Location: to.Ptr("southeastasia"), - Tags: map[string]*string{ - "tagKey1": to.Ptr("TagValue1"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ManagedDatabase = armsql.ManagedDatabase{ - // Name: to.Ptr("testdb1"), - // Type: to.Ptr("Microsoft.Sql/managedInstances/databases"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/managedInstances/testsvr/databases/testdb1"), - // Location: to.Ptr("southeastasia"), - // Tags: map[string]*string{ - // "tagKey1": to.Ptr("TagValue1"), - // }, - // Properties: &armsql.ManagedDatabaseProperties{ - // Collation: to.Ptr("SQL_Latin1_General_CP1_CI_AS"), - // CreationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-06-07T04:41:33.937Z"); return t}()), - // DefaultSecondaryLocation: to.Ptr("North Europe"), - // Status: to.Ptr(armsql.ManagedDatabaseStatusOnline), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseCreateMin.json -func ExampleManagedDatabasesClient_BeginCreateOrUpdate_createsANewManagedDatabaseWithMinimalProperties() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewManagedDatabasesClient().BeginCreateOrUpdate(ctx, "Default-SQL-SouthEastAsia", "managedInstance", "managedDatabase", armsql.ManagedDatabase{ - Location: to.Ptr("southeastasia"), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ManagedDatabase = armsql.ManagedDatabase{ - // Name: to.Ptr("testdb1"), - // Type: to.Ptr("Microsoft.Sql/managedInstances/databases"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/managedInstances/testsvr/databases/testdb1"), - // Location: to.Ptr("southeastasia"), - // Properties: &armsql.ManagedDatabaseProperties{ - // Collation: to.Ptr("SQL_Latin1_General_CP1_CI_AS"), - // CreationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-06-07T04:41:33.937Z"); return t}()), - // DefaultSecondaryLocation: to.Ptr("North Europe"), - // Status: to.Ptr(armsql.ManagedDatabaseStatusOnline), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseDelete.json -func ExampleManagedDatabasesClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewManagedDatabasesClient().BeginDelete(ctx, "Default-SQL-SouthEastAsia", "managedInstance", "testdb", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseUpdateMax.json -func ExampleManagedDatabasesClient_BeginUpdate_updatesAManagedDatabaseWithMaximalProperties() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewManagedDatabasesClient().BeginUpdate(ctx, "Default-SQL-SouthEastAsia", "managedInstance", "testdb", armsql.ManagedDatabaseUpdate{ - Tags: map[string]*string{ - "tagKey1": to.Ptr("TagValue1"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ManagedDatabase = armsql.ManagedDatabase{ - // Name: to.Ptr("testdb"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/servers/testsvr/databases/testdb"), - // Location: to.Ptr("southeastasia"), - // Tags: map[string]*string{ - // "tagKey1": to.Ptr("TagValue1"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseUpdateMin.json -func ExampleManagedDatabasesClient_BeginUpdate_updatesAManagedDatabaseWithMinimalProperties() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewManagedDatabasesClient().BeginUpdate(ctx, "Default-SQL-SouthEastAsia", "managedInstance", "testdb", armsql.ManagedDatabaseUpdate{ - Tags: map[string]*string{ - "tagKey1": to.Ptr("TagValue1"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ManagedDatabase = armsql.ManagedDatabase{ - // Name: to.Ptr("testdb"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/servers/testsvr/databases/testdb"), - // Location: to.Ptr("southeastasia"), - // Tags: map[string]*string{ - // "tagKey1": to.Ptr("TagValue1"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseCompleteExternalRestore.json -func ExampleManagedDatabasesClient_BeginCompleteRestore() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewManagedDatabasesClient().BeginCompleteRestore(ctx, "myRG", "myManagedInstanceName", "myDatabase", armsql.CompleteDatabaseRestoreDefinition{ - LastBackupName: to.Ptr("testdb1_log4"), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/InaccessibleManagedDatabaseListByManagedInstance.json -func ExampleManagedDatabasesClient_NewListInaccessibleByInstancePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewManagedDatabasesClient().NewListInaccessibleByInstancePager("testrg", "testcl", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ManagedDatabaseListResult = armsql.ManagedDatabaseListResult{ - // Value: []*armsql.ManagedDatabase{ - // { - // Name: to.Ptr("testdb1"), - // Type: to.Ptr("Microsoft.Sql/managedInstances/databases"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.Sql/managedInstances/testcl/databases/testdb1"), - // Location: to.Ptr("southeastasia"), - // Properties: &armsql.ManagedDatabaseProperties{ - // Collation: to.Ptr("SQL_Latin1_General_CP1_CI_AS"), - // CreationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-08-04T15:00:17.73Z"); return t}()), - // DefaultSecondaryLocation: to.Ptr("North Europe"), - // Status: to.Ptr(armsql.ManagedDatabaseStatusInaccessible), - // }, - // }, - // { - // Name: to.Ptr("testdb2"), - // Type: to.Ptr("Microsoft.Sql/managedInstances/databases"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.Sql/managedInstances/testcl/databases/testdb2"), - // Location: to.Ptr("southeastasia"), - // Properties: &armsql.ManagedDatabaseProperties{ - // Collation: to.Ptr("SQL_Latin1_General_CP1_CI_AS"), - // CreationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-08-04T15:00:17.73Z"); return t}()), - // DefaultSecondaryLocation: to.Ptr("North Europe"), - // Status: to.Ptr(armsql.ManagedDatabaseStatusInaccessible), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/sql/armsql/manageddatabaseschemas_client.go b/sdk/resourcemanager/sql/armsql/manageddatabaseschemas_client.go index 9975878005c9..1e3cb6455a50 100644 --- a/sdk/resourcemanager/sql/armsql/manageddatabaseschemas_client.go +++ b/sdk/resourcemanager/sql/armsql/manageddatabaseschemas_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armsql @@ -47,7 +46,7 @@ func NewManagedDatabaseSchemasClient(subscriptionID string, credential azcore.To // Get - Get managed database schema // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - managedInstanceName - The name of the managed instance. @@ -56,18 +55,21 @@ func NewManagedDatabaseSchemasClient(subscriptionID string, credential azcore.To // - options - ManagedDatabaseSchemasClientGetOptions contains the optional parameters for the ManagedDatabaseSchemasClient.Get // method. func (client *ManagedDatabaseSchemasClient) Get(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, schemaName string, options *ManagedDatabaseSchemasClientGetOptions) (ManagedDatabaseSchemasClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, managedInstanceName, databaseName, schemaName, options) if err != nil { return ManagedDatabaseSchemasClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ManagedDatabaseSchemasClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ManagedDatabaseSchemasClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ManagedDatabaseSchemasClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -98,7 +100,7 @@ func (client *ManagedDatabaseSchemasClient) getCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -115,7 +117,7 @@ func (client *ManagedDatabaseSchemasClient) getHandleResponse(resp *http.Respons // NewListByDatabasePager - List managed database schemas // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - managedInstanceName - The name of the managed instance. @@ -177,7 +179,7 @@ func (client *ManagedDatabaseSchemasClient) listByDatabaseCreateRequest(ctx cont if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/sql/armsql/manageddatabaseschemas_client_example_test.go b/sdk/resourcemanager/sql/armsql/manageddatabaseschemas_client_example_test.go deleted file mode 100644 index 7f24e40d31dd..000000000000 --- a/sdk/resourcemanager/sql/armsql/manageddatabaseschemas_client_example_test.go +++ /dev/null @@ -1,81 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsql_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sql/armsql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseSchemaListByDatabase.json -func ExampleManagedDatabaseSchemasClient_NewListByDatabasePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewManagedDatabaseSchemasClient().NewListByDatabasePager("myRG", "myManagedInstanceName", "myDatabase", &armsql.ManagedDatabaseSchemasClientListByDatabaseOptions{Filter: nil}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DatabaseSchemaListResult = armsql.DatabaseSchemaListResult{ - // Value: []*armsql.DatabaseSchema{ - // { - // Name: to.Ptr("dbo"), - // Type: to.Ptr("Microsoft.Sql/managedInstances/databases/schemas"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/myRG/providers/Microsoft.Sql/managedInstances/myManagedInstanceName/databases/myDatabase/schemas/dbo"), - // }, - // { - // Name: to.Ptr("schema2"), - // Type: to.Ptr("Microsoft.Sql/managedInstances/databases/schemas"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/myRG/providers/Microsoft.Sql/managedInstances/myManagedInstanceName/databases/myDatabase/schemas/schema2"), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseSchemaGet.json -func ExampleManagedDatabaseSchemasClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewManagedDatabaseSchemasClient().Get(ctx, "myRG", "myManagedInstanceName", "myDatabase", "dbo", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DatabaseSchema = armsql.DatabaseSchema{ - // Name: to.Ptr("dbo"), - // Type: to.Ptr("Microsoft.Sql/managedInstances/databases/schemas"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/myRG/providers/Microsoft.Sql/managedInstances/myManagedInstanceName/databases/myDatabase/schemas/dbo"), - // } -} diff --git a/sdk/resourcemanager/sql/armsql/manageddatabasesecurityalertpolicies_client.go b/sdk/resourcemanager/sql/armsql/manageddatabasesecurityalertpolicies_client.go index 7cc57c67c154..8982c1109f8c 100644 --- a/sdk/resourcemanager/sql/armsql/manageddatabasesecurityalertpolicies_client.go +++ b/sdk/resourcemanager/sql/armsql/manageddatabasesecurityalertpolicies_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armsql @@ -47,7 +46,7 @@ func NewManagedDatabaseSecurityAlertPoliciesClient(subscriptionID string, creden // CreateOrUpdate - Creates or updates a database's security alert policy. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - managedInstanceName - The name of the managed instance. @@ -57,18 +56,21 @@ func NewManagedDatabaseSecurityAlertPoliciesClient(subscriptionID string, creden // - options - ManagedDatabaseSecurityAlertPoliciesClientCreateOrUpdateOptions contains the optional parameters for the ManagedDatabaseSecurityAlertPoliciesClient.CreateOrUpdate // method. func (client *ManagedDatabaseSecurityAlertPoliciesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, securityAlertPolicyName SecurityAlertPolicyName, parameters ManagedDatabaseSecurityAlertPolicy, options *ManagedDatabaseSecurityAlertPoliciesClientCreateOrUpdateOptions) (ManagedDatabaseSecurityAlertPoliciesClientCreateOrUpdateResponse, error) { + var err error req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, managedInstanceName, databaseName, securityAlertPolicyName, parameters, options) if err != nil { return ManagedDatabaseSecurityAlertPoliciesClientCreateOrUpdateResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ManagedDatabaseSecurityAlertPoliciesClientCreateOrUpdateResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { - return ManagedDatabaseSecurityAlertPoliciesClientCreateOrUpdateResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return ManagedDatabaseSecurityAlertPoliciesClientCreateOrUpdateResponse{}, err } - return client.createOrUpdateHandleResponse(resp) + resp, err := client.createOrUpdateHandleResponse(httpResp) + return resp, err } // createOrUpdateCreateRequest creates the CreateOrUpdate request. @@ -99,10 +101,13 @@ func (client *ManagedDatabaseSecurityAlertPoliciesClient) createOrUpdateCreateRe return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // createOrUpdateHandleResponse handles the CreateOrUpdate response. @@ -117,7 +122,7 @@ func (client *ManagedDatabaseSecurityAlertPoliciesClient) createOrUpdateHandleRe // Get - Gets a managed database's security alert policy. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - managedInstanceName - The name of the managed instance. @@ -126,18 +131,21 @@ func (client *ManagedDatabaseSecurityAlertPoliciesClient) createOrUpdateHandleRe // - options - ManagedDatabaseSecurityAlertPoliciesClientGetOptions contains the optional parameters for the ManagedDatabaseSecurityAlertPoliciesClient.Get // method. func (client *ManagedDatabaseSecurityAlertPoliciesClient) Get(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, securityAlertPolicyName SecurityAlertPolicyName, options *ManagedDatabaseSecurityAlertPoliciesClientGetOptions) (ManagedDatabaseSecurityAlertPoliciesClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, managedInstanceName, databaseName, securityAlertPolicyName, options) if err != nil { return ManagedDatabaseSecurityAlertPoliciesClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ManagedDatabaseSecurityAlertPoliciesClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ManagedDatabaseSecurityAlertPoliciesClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ManagedDatabaseSecurityAlertPoliciesClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -168,7 +176,7 @@ func (client *ManagedDatabaseSecurityAlertPoliciesClient) getCreateRequest(ctx c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -185,7 +193,7 @@ func (client *ManagedDatabaseSecurityAlertPoliciesClient) getHandleResponse(resp // NewListByDatabasePager - Gets a list of managed database's security alert policies. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - managedInstanceName - The name of the managed instance. @@ -244,7 +252,7 @@ func (client *ManagedDatabaseSecurityAlertPoliciesClient) listByDatabaseCreateRe return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/sql/armsql/manageddatabasesecurityalertpolicies_client_example_test.go b/sdk/resourcemanager/sql/armsql/manageddatabasesecurityalertpolicies_client_example_test.go deleted file mode 100644 index 4a77109b6be1..000000000000 --- a/sdk/resourcemanager/sql/armsql/manageddatabasesecurityalertpolicies_client_example_test.go +++ /dev/null @@ -1,193 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsql_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sql/armsql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseSecurityAlertGet.json -func ExampleManagedDatabaseSecurityAlertPoliciesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewManagedDatabaseSecurityAlertPoliciesClient().Get(ctx, "securityalert-6852", "securityalert-2080", "testdb", armsql.SecurityAlertPolicyNameDefault, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ManagedDatabaseSecurityAlertPolicy = armsql.ManagedDatabaseSecurityAlertPolicy{ - // Name: to.Ptr("Default"), - // Type: to.Ptr("Microsoft.Sql/managedInstances/databases/securityAlertPolicies"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/securityalert-6852/providers/Microsoft.Sql/managedInstances/securityalert-2080/databases/testdb"), - // Properties: &armsql.SecurityAlertPolicyProperties{ - // DisabledAlerts: []*string{ - // to.Ptr("Usage_Anomaly")}, - // EmailAccountAdmins: to.Ptr(true), - // EmailAddresses: []*string{ - // to.Ptr("test@contoso.com"), - // to.Ptr("user@contoso.com")}, - // RetentionDays: to.Ptr[int32](0), - // State: to.Ptr(armsql.SecurityAlertPolicyStateEnabled), - // StorageAccountAccessKey: to.Ptr(""), - // StorageEndpoint: to.Ptr(""), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseSecurityAlertCreateMax.json -func ExampleManagedDatabaseSecurityAlertPoliciesClient_CreateOrUpdate_updateADatabasesThreatDetectionPolicyWithAllParameters() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewManagedDatabaseSecurityAlertPoliciesClient().CreateOrUpdate(ctx, "securityalert-4799", "securityalert-6440", "testdb", armsql.SecurityAlertPolicyNameDefault, armsql.ManagedDatabaseSecurityAlertPolicy{ - Properties: &armsql.SecurityAlertPolicyProperties{ - DisabledAlerts: []*string{ - to.Ptr("Sql_Injection"), - to.Ptr("Usage_Anomaly")}, - EmailAccountAdmins: to.Ptr(true), - EmailAddresses: []*string{ - to.Ptr("test@contoso.com"), - to.Ptr("user@contoso.com")}, - RetentionDays: to.Ptr[int32](6), - State: to.Ptr(armsql.SecurityAlertPolicyStateEnabled), - StorageAccountAccessKey: to.Ptr("sdlfkjabc+sdlfkjsdlkfsjdfLDKFTERLKFDFKLjsdfksjdflsdkfD2342309432849328476458/3RSD=="), - StorageEndpoint: to.Ptr("https://mystorage.blob.core.windows.net"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ManagedDatabaseSecurityAlertPolicy = armsql.ManagedDatabaseSecurityAlertPolicy{ - // Name: to.Ptr("Default"), - // Type: to.Ptr("Microsoft.Sql/managedInstances/databases/securityAlertPolicies"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/securityalert-4799/providers/Microsoft.Sql/managedInstances/securityalert-6440/databases/testdb"), - // Properties: &armsql.SecurityAlertPolicyProperties{ - // DisabledAlerts: []*string{ - // to.Ptr("Sql_Injection"), - // to.Ptr("Usage_Anomaly")}, - // EmailAccountAdmins: to.Ptr(true), - // EmailAddresses: []*string{ - // to.Ptr("test@contoso.com"), - // to.Ptr("user@contoso.com")}, - // RetentionDays: to.Ptr[int32](6), - // State: to.Ptr(armsql.SecurityAlertPolicyStateEnabled), - // StorageAccountAccessKey: to.Ptr(""), - // StorageEndpoint: to.Ptr("https://mystorage.blob.core.windows.net"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseSecurityAlertCreateMin.json -func ExampleManagedDatabaseSecurityAlertPoliciesClient_CreateOrUpdate_updateADatabasesThreatDetectionPolicyWithMinimalParameters() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewManagedDatabaseSecurityAlertPoliciesClient().CreateOrUpdate(ctx, "securityalert-4799", "securityalert-6440", "testdb", armsql.SecurityAlertPolicyNameDefault, armsql.ManagedDatabaseSecurityAlertPolicy{ - Properties: &armsql.SecurityAlertPolicyProperties{ - State: to.Ptr(armsql.SecurityAlertPolicyStateEnabled), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ManagedDatabaseSecurityAlertPolicy = armsql.ManagedDatabaseSecurityAlertPolicy{ - // Name: to.Ptr("Default"), - // Type: to.Ptr("Microsoft.Sql/managedInstance/databases/securityAlertPolicies"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/securityalert-4799/providers/Microsoft.Sql/managedInstances/securityalert-6440/databases/testdb"), - // Properties: &armsql.SecurityAlertPolicyProperties{ - // DisabledAlerts: []*string{ - // }, - // EmailAccountAdmins: to.Ptr(true), - // EmailAddresses: []*string{ - // }, - // RetentionDays: to.Ptr[int32](0), - // State: to.Ptr(armsql.SecurityAlertPolicyStateEnabled), - // StorageAccountAccessKey: to.Ptr(""), - // StorageEndpoint: to.Ptr(""), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseSecurityAlertListByDatabase.json -func ExampleManagedDatabaseSecurityAlertPoliciesClient_NewListByDatabasePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewManagedDatabaseSecurityAlertPoliciesClient().NewListByDatabasePager("securityalert-6852", "securityalert-2080", "testdb", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ManagedDatabaseSecurityAlertPolicyListResult = armsql.ManagedDatabaseSecurityAlertPolicyListResult{ - // Value: []*armsql.ManagedDatabaseSecurityAlertPolicy{ - // { - // Name: to.Ptr("Default"), - // Type: to.Ptr("Microsoft.Sql/managedInstances/databases/securityAlertPolicies"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/securityalert-6852/providers/Microsoft.Sql/managedInstances/securityalert-2080/databases/testdb"), - // Properties: &armsql.SecurityAlertPolicyProperties{ - // DisabledAlerts: []*string{ - // to.Ptr("Usage_Anomaly")}, - // EmailAccountAdmins: to.Ptr(true), - // EmailAddresses: []*string{ - // to.Ptr("test@contoso.com"), - // to.Ptr("user@contoso.com")}, - // RetentionDays: to.Ptr[int32](0), - // State: to.Ptr(armsql.SecurityAlertPolicyStateEnabled), - // StorageAccountAccessKey: to.Ptr(""), - // StorageEndpoint: to.Ptr(""), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/sql/armsql/manageddatabasesecurityevents_client.go b/sdk/resourcemanager/sql/armsql/manageddatabasesecurityevents_client.go index 6b21e834b3ca..1821eeb5f0d4 100644 --- a/sdk/resourcemanager/sql/armsql/manageddatabasesecurityevents_client.go +++ b/sdk/resourcemanager/sql/armsql/manageddatabasesecurityevents_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armsql @@ -47,7 +46,7 @@ func NewManagedDatabaseSecurityEventsClient(subscriptionID string, credential az // NewListByDatabasePager - Gets a list of security events. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - managedInstanceName - The name of the managed instance. @@ -110,15 +109,15 @@ func (client *ManagedDatabaseSecurityEventsClient) listByDatabaseCreateRequest(c reqQP.Set("$filter", *options.Filter) } if options != nil && options.Skip != nil { - reqQP.Set("$skip", strconv.FormatInt(int64(*options.Skip), 10)) + reqQP.Set("$skip", strconv.FormatInt(*options.Skip, 10)) } if options != nil && options.Top != nil { - reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) + reqQP.Set("$top", strconv.FormatInt(*options.Top, 10)) } if options != nil && options.Skiptoken != nil { reqQP.Set("$skiptoken", *options.Skiptoken) } - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/sql/armsql/manageddatabasesecurityevents_client_example_test.go b/sdk/resourcemanager/sql/armsql/manageddatabasesecurityevents_client_example_test.go deleted file mode 100644 index da43d3085b50..000000000000 --- a/sdk/resourcemanager/sql/armsql/manageddatabasesecurityevents_client_example_test.go +++ /dev/null @@ -1,179 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsql_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sql/armsql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseSecurityEventsGetMax.json -func ExampleManagedDatabaseSecurityEventsClient_NewListByDatabasePager_getTheManagedDatabasesSecurityEventsWithMaximalParameters() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewManagedDatabaseSecurityEventsClient().NewListByDatabasePager("testrg", "testcl", "database1", &armsql.ManagedDatabaseSecurityEventsClientListByDatabaseOptions{Filter: to.Ptr("ShowServerRecords eq true"), - Skip: to.Ptr[int32](0), - Top: to.Ptr[int32](1), - Skiptoken: to.Ptr("eyJCbG9iTmFtZURhdGVUaW1lIjoiXC9EYXRlKDE1MTIyODg4MTIwMTArMDIwMClcLyIsIkJsb2JOYW1lUm9sbG92ZXJJbmRleCI6IjAiLCJFbmREYXRlIjoiXC9EYXRlKDE1MTI0NjYyMDA1MjkpXC8iLCJJc1NraXBUb2tlblNldCI6ZmFsc2UsIklzVjJCbG9iVGltZUZvcm1hdCI6dHJ1ZSwiU2hvd1NlcnZlclJlY29yZHMiOmZhbHNlLCJTa2lwVmFsdWUiOjAsIlRha2VWYWx1ZSI6MTB9"), - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.SecurityEventCollection = armsql.SecurityEventCollection{ - // Value: []*armsql.SecurityEvent{ - // { - // Name: to.Ptr("06364798761800000000000000001"), - // Type: to.Ptr("Microsoft.Sql/servers/databases/securityEvents"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.Sql/managedInstances/testcl/databases/database1/securityEvents/06364798761800000000000000001"), - // Properties: &armsql.SecurityEventProperties{ - // ApplicationName: to.Ptr("myApp"), - // ClientIP: to.Ptr("10.166.113.220"), - // Database: to.Ptr("database1"), - // EventTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-12-24T10:13:24.729Z"); return t}()), - // PrincipalName: to.Ptr("maliciousUser"), - // SecurityEventSQLInjectionAdditionalProperties: &armsql.SecurityEventSQLInjectionAdditionalProperties{ - // ErrorCode: to.Ptr[int32](0), - // ErrorMessage: to.Ptr(""), - // ErrorSeverity: to.Ptr[int32](0), - // Statement: to.Ptr("select * from sys.databases where database_id like '' or 1 = 1 --' and family = 'test11'"), - // StatementHighlightLength: to.Ptr[int32](13), - // StatementHighlightOffset: to.Ptr[int32](52), - // ThreatID: to.Ptr("1"), - // }, - // SecurityEventType: to.Ptr(armsql.SecurityEventTypeSQLInjectionExploit), - // Server: to.Ptr("testcl"), - // Subscription: to.Ptr("00000000-1111-2222-3333-444444444444"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseSecurityEventsGetMin.json -func ExampleManagedDatabaseSecurityEventsClient_NewListByDatabasePager_getTheManagedDatabasesSecurityEventsWithMinimalParameters() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewManagedDatabaseSecurityEventsClient().NewListByDatabasePager("testrg", "testcl", "database1", &armsql.ManagedDatabaseSecurityEventsClientListByDatabaseOptions{Filter: nil, - Skip: nil, - Top: nil, - Skiptoken: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.SecurityEventCollection = armsql.SecurityEventCollection{ - // Value: []*armsql.SecurityEvent{ - // { - // Name: to.Ptr("06364798761800000000000000001"), - // Type: to.Ptr("Microsoft.Sql/servers/databases/securityEvents"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.Sql/managedInstances/testcl/databases/database1/securityEvents/06364798761800000000000000001"), - // Properties: &armsql.SecurityEventProperties{ - // ApplicationName: to.Ptr("myApp"), - // ClientIP: to.Ptr("10.166.113.220"), - // Database: to.Ptr("database1"), - // EventTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-12-24T10:13:24.729Z"); return t}()), - // PrincipalName: to.Ptr("maliciousUser"), - // SecurityEventSQLInjectionAdditionalProperties: &armsql.SecurityEventSQLInjectionAdditionalProperties{ - // ErrorCode: to.Ptr[int32](0), - // ErrorMessage: to.Ptr(""), - // ErrorSeverity: to.Ptr[int32](0), - // Statement: to.Ptr("select * from sys.databases where database_id like '' or 1 = 1 --' and family = 'test11'"), - // StatementHighlightLength: to.Ptr[int32](13), - // StatementHighlightOffset: to.Ptr[int32](52), - // ThreatID: to.Ptr("1"), - // }, - // SecurityEventType: to.Ptr(armsql.SecurityEventTypeSQLInjectionExploit), - // Server: to.Ptr("testcl"), - // Subscription: to.Ptr("00000000-1111-2222-3333-444444444444"), - // }, - // }, - // { - // Name: to.Ptr("06364798761800000000000000002"), - // Type: to.Ptr("Microsoft.Sql/servers/databases/securityEvents"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.Sql/managedInstances/testcl/databases/database1/securityEvents/06364798761800000000000000002"), - // Properties: &armsql.SecurityEventProperties{ - // ApplicationName: to.Ptr("myApp"), - // ClientIP: to.Ptr("10.166.113.220"), - // Database: to.Ptr("database1"), - // EventTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-12-24T10:11:14.121Z"); return t}()), - // PrincipalName: to.Ptr("maliciousUser"), - // SecurityEventSQLInjectionAdditionalProperties: &armsql.SecurityEventSQLInjectionAdditionalProperties{ - // ErrorCode: to.Ptr[int32](0), - // ErrorMessage: to.Ptr(""), - // ErrorSeverity: to.Ptr[int32](0), - // Statement: to.Ptr("select * from sys.databases where database_id like '' or 1 = 1 --' and family = 'test10'"), - // StatementHighlightLength: to.Ptr[int32](13), - // StatementHighlightOffset: to.Ptr[int32](52), - // ThreatID: to.Ptr("1"), - // }, - // SecurityEventType: to.Ptr(armsql.SecurityEventTypeSQLInjectionExploit), - // Server: to.Ptr("testcl"), - // Subscription: to.Ptr("00000000-1111-2222-3333-444444444444"), - // }, - // }, - // { - // Name: to.Ptr("06364798761800000000000000003"), - // Type: to.Ptr("Microsoft.Sql/servers/databases/securityEvents"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.Sql/managedInstances/testcl/databases/database1/securityEvents/06364798761800000000000000003"), - // Properties: &armsql.SecurityEventProperties{ - // ApplicationName: to.Ptr("myApp"), - // ClientIP: to.Ptr("10.166.113.220"), - // Database: to.Ptr("database1"), - // EventTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-12-24T10:03:17.066Z"); return t}()), - // PrincipalName: to.Ptr("maliciousUser"), - // SecurityEventSQLInjectionAdditionalProperties: &armsql.SecurityEventSQLInjectionAdditionalProperties{ - // ErrorCode: to.Ptr[int32](0), - // ErrorMessage: to.Ptr(""), - // ErrorSeverity: to.Ptr[int32](0), - // Statement: to.Ptr("select * from sys.databases where database_id like '' or 1 = 1 --' and family = 'test9'"), - // StatementHighlightLength: to.Ptr[int32](13), - // StatementHighlightOffset: to.Ptr[int32](52), - // ThreatID: to.Ptr("1"), - // }, - // SecurityEventType: to.Ptr(armsql.SecurityEventTypeSQLInjectionExploit), - // Server: to.Ptr("testcl"), - // Subscription: to.Ptr("00000000-1111-2222-3333-444444444444"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/sql/armsql/manageddatabasesensitivitylabels_client.go b/sdk/resourcemanager/sql/armsql/manageddatabasesensitivitylabels_client.go index 418909bac90b..3acaf787fb8f 100644 --- a/sdk/resourcemanager/sql/armsql/manageddatabasesensitivitylabels_client.go +++ b/sdk/resourcemanager/sql/armsql/manageddatabasesensitivitylabels_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armsql @@ -48,7 +47,7 @@ func NewManagedDatabaseSensitivityLabelsClient(subscriptionID string, credential // CreateOrUpdate - Creates or updates the sensitivity label of a given column // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - managedInstanceName - The name of the managed instance. @@ -60,18 +59,21 @@ func NewManagedDatabaseSensitivityLabelsClient(subscriptionID string, credential // - options - ManagedDatabaseSensitivityLabelsClientCreateOrUpdateOptions contains the optional parameters for the ManagedDatabaseSensitivityLabelsClient.CreateOrUpdate // method. func (client *ManagedDatabaseSensitivityLabelsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, schemaName string, tableName string, columnName string, parameters SensitivityLabel, options *ManagedDatabaseSensitivityLabelsClientCreateOrUpdateOptions) (ManagedDatabaseSensitivityLabelsClientCreateOrUpdateResponse, error) { + var err error req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, managedInstanceName, databaseName, schemaName, tableName, columnName, parameters, options) if err != nil { return ManagedDatabaseSensitivityLabelsClientCreateOrUpdateResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ManagedDatabaseSensitivityLabelsClientCreateOrUpdateResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { - return ManagedDatabaseSensitivityLabelsClientCreateOrUpdateResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return ManagedDatabaseSensitivityLabelsClientCreateOrUpdateResponse{}, err } - return client.createOrUpdateHandleResponse(resp) + resp, err := client.createOrUpdateHandleResponse(httpResp) + return resp, err } // createOrUpdateCreateRequest creates the CreateOrUpdate request. @@ -111,10 +113,13 @@ func (client *ManagedDatabaseSensitivityLabelsClient) createOrUpdateCreateReques return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // createOrUpdateHandleResponse handles the CreateOrUpdate response. @@ -129,7 +134,7 @@ func (client *ManagedDatabaseSensitivityLabelsClient) createOrUpdateHandleRespon // Delete - Deletes the sensitivity label of a given column // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - managedInstanceName - The name of the managed instance. @@ -140,16 +145,18 @@ func (client *ManagedDatabaseSensitivityLabelsClient) createOrUpdateHandleRespon // - options - ManagedDatabaseSensitivityLabelsClientDeleteOptions contains the optional parameters for the ManagedDatabaseSensitivityLabelsClient.Delete // method. func (client *ManagedDatabaseSensitivityLabelsClient) Delete(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, schemaName string, tableName string, columnName string, options *ManagedDatabaseSensitivityLabelsClientDeleteOptions) (ManagedDatabaseSensitivityLabelsClientDeleteResponse, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, managedInstanceName, databaseName, schemaName, tableName, columnName, options) if err != nil { return ManagedDatabaseSensitivityLabelsClientDeleteResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ManagedDatabaseSensitivityLabelsClientDeleteResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ManagedDatabaseSensitivityLabelsClientDeleteResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ManagedDatabaseSensitivityLabelsClientDeleteResponse{}, err } return ManagedDatabaseSensitivityLabelsClientDeleteResponse{}, nil } @@ -191,7 +198,7 @@ func (client *ManagedDatabaseSensitivityLabelsClient) deleteCreateRequest(ctx co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -199,7 +206,7 @@ func (client *ManagedDatabaseSensitivityLabelsClient) deleteCreateRequest(ctx co // DisableRecommendation - Disables sensitivity recommendations on a given column // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - managedInstanceName - The name of the managed instance. @@ -210,16 +217,18 @@ func (client *ManagedDatabaseSensitivityLabelsClient) deleteCreateRequest(ctx co // - options - ManagedDatabaseSensitivityLabelsClientDisableRecommendationOptions contains the optional parameters for the ManagedDatabaseSensitivityLabelsClient.DisableRecommendation // method. func (client *ManagedDatabaseSensitivityLabelsClient) DisableRecommendation(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, schemaName string, tableName string, columnName string, options *ManagedDatabaseSensitivityLabelsClientDisableRecommendationOptions) (ManagedDatabaseSensitivityLabelsClientDisableRecommendationResponse, error) { + var err error req, err := client.disableRecommendationCreateRequest(ctx, resourceGroupName, managedInstanceName, databaseName, schemaName, tableName, columnName, options) if err != nil { return ManagedDatabaseSensitivityLabelsClientDisableRecommendationResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ManagedDatabaseSensitivityLabelsClientDisableRecommendationResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ManagedDatabaseSensitivityLabelsClientDisableRecommendationResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ManagedDatabaseSensitivityLabelsClientDisableRecommendationResponse{}, err } return ManagedDatabaseSensitivityLabelsClientDisableRecommendationResponse{}, nil } @@ -261,7 +270,7 @@ func (client *ManagedDatabaseSensitivityLabelsClient) disableRecommendationCreat return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -270,7 +279,7 @@ func (client *ManagedDatabaseSensitivityLabelsClient) disableRecommendationCreat // all columns) // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - managedInstanceName - The name of the managed instance. @@ -281,16 +290,18 @@ func (client *ManagedDatabaseSensitivityLabelsClient) disableRecommendationCreat // - options - ManagedDatabaseSensitivityLabelsClientEnableRecommendationOptions contains the optional parameters for the ManagedDatabaseSensitivityLabelsClient.EnableRecommendation // method. func (client *ManagedDatabaseSensitivityLabelsClient) EnableRecommendation(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, schemaName string, tableName string, columnName string, options *ManagedDatabaseSensitivityLabelsClientEnableRecommendationOptions) (ManagedDatabaseSensitivityLabelsClientEnableRecommendationResponse, error) { + var err error req, err := client.enableRecommendationCreateRequest(ctx, resourceGroupName, managedInstanceName, databaseName, schemaName, tableName, columnName, options) if err != nil { return ManagedDatabaseSensitivityLabelsClientEnableRecommendationResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ManagedDatabaseSensitivityLabelsClientEnableRecommendationResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ManagedDatabaseSensitivityLabelsClientEnableRecommendationResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ManagedDatabaseSensitivityLabelsClientEnableRecommendationResponse{}, err } return ManagedDatabaseSensitivityLabelsClientEnableRecommendationResponse{}, nil } @@ -332,7 +343,7 @@ func (client *ManagedDatabaseSensitivityLabelsClient) enableRecommendationCreate return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -340,7 +351,7 @@ func (client *ManagedDatabaseSensitivityLabelsClient) enableRecommendationCreate // Get - Gets the sensitivity label of a given column // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - managedInstanceName - The name of the managed instance. @@ -352,18 +363,21 @@ func (client *ManagedDatabaseSensitivityLabelsClient) enableRecommendationCreate // - options - ManagedDatabaseSensitivityLabelsClientGetOptions contains the optional parameters for the ManagedDatabaseSensitivityLabelsClient.Get // method. func (client *ManagedDatabaseSensitivityLabelsClient) Get(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, schemaName string, tableName string, columnName string, sensitivityLabelSource SensitivityLabelSource, options *ManagedDatabaseSensitivityLabelsClientGetOptions) (ManagedDatabaseSensitivityLabelsClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, managedInstanceName, databaseName, schemaName, tableName, columnName, sensitivityLabelSource, options) if err != nil { return ManagedDatabaseSensitivityLabelsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ManagedDatabaseSensitivityLabelsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ManagedDatabaseSensitivityLabelsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ManagedDatabaseSensitivityLabelsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -406,7 +420,7 @@ func (client *ManagedDatabaseSensitivityLabelsClient) getCreateRequest(ctx conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -421,9 +435,88 @@ func (client *ManagedDatabaseSensitivityLabelsClient) getHandleResponse(resp *ht return result, nil } +// NewListByDatabasePager - Gets the sensitivity labels of a given database +// +// Generated from API version 2022-11-01-preview +// - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure +// Resource Manager API or the portal. +// - managedInstanceName - The name of the managed instance. +// - databaseName - The name of the database. +// - options - ManagedDatabaseSensitivityLabelsClientListByDatabaseOptions contains the optional parameters for the ManagedDatabaseSensitivityLabelsClient.NewListByDatabasePager +// method. +func (client *ManagedDatabaseSensitivityLabelsClient) NewListByDatabasePager(resourceGroupName string, managedInstanceName string, databaseName string, options *ManagedDatabaseSensitivityLabelsClientListByDatabaseOptions) *runtime.Pager[ManagedDatabaseSensitivityLabelsClientListByDatabaseResponse] { + return runtime.NewPager(runtime.PagingHandler[ManagedDatabaseSensitivityLabelsClientListByDatabaseResponse]{ + More: func(page ManagedDatabaseSensitivityLabelsClientListByDatabaseResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ManagedDatabaseSensitivityLabelsClientListByDatabaseResponse) (ManagedDatabaseSensitivityLabelsClientListByDatabaseResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByDatabaseCreateRequest(ctx, resourceGroupName, managedInstanceName, databaseName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ManagedDatabaseSensitivityLabelsClientListByDatabaseResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ManagedDatabaseSensitivityLabelsClientListByDatabaseResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ManagedDatabaseSensitivityLabelsClientListByDatabaseResponse{}, runtime.NewResponseError(resp) + } + return client.listByDatabaseHandleResponse(resp) + }, + }) +} + +// listByDatabaseCreateRequest creates the ListByDatabase request. +func (client *ManagedDatabaseSensitivityLabelsClient) listByDatabaseCreateRequest(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, options *ManagedDatabaseSensitivityLabelsClientListByDatabaseOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/sensitivityLabels" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if managedInstanceName == "" { + return nil, errors.New("parameter managedInstanceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{managedInstanceName}", url.PathEscape(managedInstanceName)) + if databaseName == "" { + return nil, errors.New("parameter databaseName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{databaseName}", url.PathEscape(databaseName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + if options != nil && options.Filter != nil { + reqQP.Set("$filter", *options.Filter) + } + reqQP.Set("api-version", "2022-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByDatabaseHandleResponse handles the ListByDatabase response. +func (client *ManagedDatabaseSensitivityLabelsClient) listByDatabaseHandleResponse(resp *http.Response) (ManagedDatabaseSensitivityLabelsClientListByDatabaseResponse, error) { + result := ManagedDatabaseSensitivityLabelsClientListByDatabaseResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SensitivityLabelListResult); err != nil { + return ManagedDatabaseSensitivityLabelsClientListByDatabaseResponse{}, err + } + return result, nil +} + // NewListCurrentByDatabasePager - Gets the sensitivity labels of a given database // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - managedInstanceName - The name of the managed instance. @@ -491,7 +584,7 @@ func (client *ManagedDatabaseSensitivityLabelsClient) listCurrentByDatabaseCreat if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -508,7 +601,7 @@ func (client *ManagedDatabaseSensitivityLabelsClient) listCurrentByDatabaseHandl // NewListRecommendedByDatabasePager - Gets the sensitivity labels of a given database // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - managedInstanceName - The name of the managed instance. @@ -576,7 +669,7 @@ func (client *ManagedDatabaseSensitivityLabelsClient) listRecommendedByDatabaseC if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -594,7 +687,7 @@ func (client *ManagedDatabaseSensitivityLabelsClient) listRecommendedByDatabaseH // Update - Update sensitivity labels of a given database using an operations batch. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - managedInstanceName - The name of the managed instance. @@ -602,16 +695,18 @@ func (client *ManagedDatabaseSensitivityLabelsClient) listRecommendedByDatabaseH // - options - ManagedDatabaseSensitivityLabelsClientUpdateOptions contains the optional parameters for the ManagedDatabaseSensitivityLabelsClient.Update // method. func (client *ManagedDatabaseSensitivityLabelsClient) Update(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, parameters SensitivityLabelUpdateList, options *ManagedDatabaseSensitivityLabelsClientUpdateOptions) (ManagedDatabaseSensitivityLabelsClientUpdateResponse, error) { + var err error req, err := client.updateCreateRequest(ctx, resourceGroupName, managedInstanceName, databaseName, parameters, options) if err != nil { return ManagedDatabaseSensitivityLabelsClientUpdateResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ManagedDatabaseSensitivityLabelsClientUpdateResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ManagedDatabaseSensitivityLabelsClientUpdateResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ManagedDatabaseSensitivityLabelsClientUpdateResponse{}, err } return ManagedDatabaseSensitivityLabelsClientUpdateResponse{}, nil } @@ -640,7 +735,10 @@ func (client *ManagedDatabaseSensitivityLabelsClient) updateCreateRequest(ctx co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } diff --git a/sdk/resourcemanager/sql/armsql/manageddatabasesensitivitylabels_client_example_test.go b/sdk/resourcemanager/sql/armsql/manageddatabasesensitivitylabels_client_example_test.go deleted file mode 100644 index 9ae2352f44de..000000000000 --- a/sdk/resourcemanager/sql/armsql/manageddatabasesensitivitylabels_client_example_test.go +++ /dev/null @@ -1,327 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsql_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sql/armsql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseColumnSensitivityLabelGet.json -func ExampleManagedDatabaseSensitivityLabelsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewManagedDatabaseSensitivityLabelsClient().Get(ctx, "myRG", "myManagedInstanceName", "myDatabase", "dbo", "myTable", "myColumn", armsql.SensitivityLabelSourceCurrent, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.SensitivityLabel = armsql.SensitivityLabel{ - // Name: to.Ptr("current"), - // Type: to.Ptr("Microsoft.Sql/managedInstances/databases/schemas/tables/columns/sensitivityLabels"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/myRG/providers/Microsoft.Sql/managedInstances/myManagedInstanceName/databases/myDatabase/schemas/dbo/tables/myTable/columns/myColumn/sensitivityLabels/current"), - // Properties: &armsql.SensitivityLabelProperties{ - // ColumnName: to.Ptr("myColumn"), - // InformationType: to.Ptr("PhoneNumber"), - // InformationTypeID: to.Ptr("d22fa6e9-5ee4-3bde-4c2b-a409604c4646"), - // LabelID: to.Ptr("bf91e08c-f4f0-478a-b016-25164b2a65ff"), - // LabelName: to.Ptr("PII"), - // Rank: to.Ptr(armsql.SensitivityLabelRankLow), - // SchemaName: to.Ptr("dbo"), - // TableName: to.Ptr("myTable"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseColumnSensitivityLabelCreate.json -func ExampleManagedDatabaseSensitivityLabelsClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewManagedDatabaseSensitivityLabelsClient().CreateOrUpdate(ctx, "myRG", "myManagedInstanceName", "myDatabase", "dbo", "myTable", "myColumn", armsql.SensitivityLabel{ - Properties: &armsql.SensitivityLabelProperties{ - InformationType: to.Ptr("PhoneNumber"), - InformationTypeID: to.Ptr("d22fa6e9-5ee4-3bde-4c2b-a409604c4646"), - LabelID: to.Ptr("bf91e08c-f4f0-478a-b016-25164b2a65ff"), - LabelName: to.Ptr("PII"), - Rank: to.Ptr(armsql.SensitivityLabelRankHigh), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.SensitivityLabel = armsql.SensitivityLabel{ - // Name: to.Ptr("current"), - // Type: to.Ptr("Microsoft.Sql/managedInstances/databases/schemas/tables/columns/sensitivityLabels"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/myRG/providers/Microsoft.Sql/managedInstances/myManagedInstanceName/databases/myDatabase/schemas/dbo/tables/myTable/columns/myColumn/sensitivityLabels/current"), - // Properties: &armsql.SensitivityLabelProperties{ - // ColumnName: to.Ptr("myColumn"), - // InformationType: to.Ptr("PhoneNumber"), - // InformationTypeID: to.Ptr("d22fa6e9-5ee4-3bde-4c2b-a409604c4646"), - // LabelID: to.Ptr("bf91e08c-f4f0-478a-b016-25164b2a65ff"), - // LabelName: to.Ptr("PII"), - // Rank: to.Ptr(armsql.SensitivityLabelRankHigh), - // SchemaName: to.Ptr("dbo"), - // TableName: to.Ptr("myTable"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseColumnSensitivityLabelDelete.json -func ExampleManagedDatabaseSensitivityLabelsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewManagedDatabaseSensitivityLabelsClient().Delete(ctx, "myRG", "myManagedInstanceName", "myDatabase", "dbo", "myTable", "myColumn", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseRecommendedColumnSensitivityLabelDisable.json -func ExampleManagedDatabaseSensitivityLabelsClient_DisableRecommendation() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewManagedDatabaseSensitivityLabelsClient().DisableRecommendation(ctx, "myRG", "myManagedInstanceName", "myDatabase", "dbo", "myTable", "myColumn", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseRecommendedColumnSensitivityLabelEnable.json -func ExampleManagedDatabaseSensitivityLabelsClient_EnableRecommendation() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewManagedDatabaseSensitivityLabelsClient().EnableRecommendation(ctx, "myRG", "myManagedInstanceName", "myDatabase", "dbo", "myTable", "myColumn", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseSensitivityLabelsListByDatabaseCurrent.json -func ExampleManagedDatabaseSensitivityLabelsClient_NewListCurrentByDatabasePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewManagedDatabaseSensitivityLabelsClient().NewListCurrentByDatabasePager("myRG", "myManagedInstanceName", "myDatabase", &armsql.ManagedDatabaseSensitivityLabelsClientListCurrentByDatabaseOptions{SkipToken: nil, - Count: nil, - Filter: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.SensitivityLabelListResult = armsql.SensitivityLabelListResult{ - // Value: []*armsql.SensitivityLabel{ - // { - // Name: to.Ptr("current"), - // Type: to.Ptr("Microsoft.Sql/managedInstances/databases/schemas/tables/columns/sensitivityLabels"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/myRG/providers/Microsoft.Sql/managedInstances/myManagedInstanceName/databases/myDatabase/schemas/dbo/tables/myTable/columns/myColumn/sensitivityLabels/current"), - // Properties: &armsql.SensitivityLabelProperties{ - // ColumnName: to.Ptr("myColumn"), - // InformationType: to.Ptr("Financial"), - // InformationTypeID: to.Ptr("d22fa6e9-5ee4-3bde-4c2b-a409604c4646"), - // LabelID: to.Ptr("05e6eaa1-075a-4fb4-a732-a92215a2444a"), - // LabelName: to.Ptr("Sensitive"), - // Rank: to.Ptr(armsql.SensitivityLabelRankCritical), - // SchemaName: to.Ptr("dbo"), - // TableName: to.Ptr("myTable"), - // }, - // }, - // { - // Name: to.Ptr("current"), - // Type: to.Ptr("Microsoft.Sql/managedInstances/databases/schemas/tables/columns/sensitivityLabels"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/myRG/providers/Microsoft.Sql/managedInstances/myManagedInstanceName/databases/myDatabase/schemas/dbo/tables/myTable/columns/myColumn3/sensitivityLabels/current"), - // Properties: &armsql.SensitivityLabelProperties{ - // ColumnName: to.Ptr("myColumn3"), - // InformationType: to.Ptr("Email"), - // InformationTypeID: to.Ptr("d22fa6e9-5ee4-3bde-4c2b-a409604c4646"), - // LabelID: to.Ptr("bf91e08c-f4f0-478a-b016-25164b2a65ff"), - // LabelName: to.Ptr("PII"), - // Rank: to.Ptr(armsql.SensitivityLabelRankHigh), - // SchemaName: to.Ptr("dbo"), - // TableName: to.Ptr("myTable"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseSensitivityLabelsCurrentUpdate.json -func ExampleManagedDatabaseSensitivityLabelsClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewManagedDatabaseSensitivityLabelsClient().Update(ctx, "myRG", "myManagedInstanceName", "myDatabase", armsql.SensitivityLabelUpdateList{ - Operations: []*armsql.SensitivityLabelUpdate{ - { - Properties: &armsql.SensitivityLabelUpdateProperties{ - Schema: to.Ptr("dbo"), - Column: to.Ptr("column1"), - Op: to.Ptr(armsql.SensitivityLabelUpdateKindSet), - SensitivityLabel: &armsql.SensitivityLabel{ - Properties: &armsql.SensitivityLabelProperties{ - InformationType: to.Ptr("Financial"), - InformationTypeID: to.Ptr("1D3652D6-422C-4115-82F1-65DAEBC665C8"), - LabelID: to.Ptr("3A477B16-9423-432B-AA97-6069B481CEC3"), - LabelName: to.Ptr("Highly Confidential"), - }, - }, - Table: to.Ptr("table1"), - }, - }, - { - Properties: &armsql.SensitivityLabelUpdateProperties{ - Schema: to.Ptr("dbo"), - Column: to.Ptr("column2"), - Op: to.Ptr(armsql.SensitivityLabelUpdateKindSet), - SensitivityLabel: &armsql.SensitivityLabel{ - Properties: &armsql.SensitivityLabelProperties{ - InformationType: to.Ptr("PhoneNumber"), - InformationTypeID: to.Ptr("d22fa6e9-5ee4-3bde-4c2b-a409604c4646"), - LabelID: to.Ptr("bf91e08c-f4f0-478a-b016-25164b2a65ff"), - LabelName: to.Ptr("PII"), - }, - }, - Table: to.Ptr("table2"), - }, - }, - { - Properties: &armsql.SensitivityLabelUpdateProperties{ - Schema: to.Ptr("dbo"), - Column: to.Ptr("Column3"), - Op: to.Ptr(armsql.SensitivityLabelUpdateKindRemove), - Table: to.Ptr("Table1"), - }, - }}, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseSensitivityLabelsListByDatabaseRecommended.json -func ExampleManagedDatabaseSensitivityLabelsClient_NewListRecommendedByDatabasePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewManagedDatabaseSensitivityLabelsClient().NewListRecommendedByDatabasePager("myRG", "myManagedInstanceName", "myDatabase", &armsql.ManagedDatabaseSensitivityLabelsClientListRecommendedByDatabaseOptions{SkipToken: nil, - IncludeDisabledRecommendations: nil, - Filter: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.SensitivityLabelListResult = armsql.SensitivityLabelListResult{ - // Value: []*armsql.SensitivityLabel{ - // { - // Name: to.Ptr("recommended"), - // Type: to.Ptr("Microsoft.Sql/managedInstances/databases/schemas/tables/columns/sensitivityLabels"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/myRG/providers/Microsoft.Sql/managedInstances/myManagedInstanceName/databases/myDatabase/schemas/dbo/tables/myTable/columns/myColumn2/sensitivityLabels/recommended"), - // Properties: &armsql.SensitivityLabelProperties{ - // ColumnName: to.Ptr("myColumn2"), - // InformationType: to.Ptr("Financial"), - // InformationTypeID: to.Ptr("d22fa6e9-5ee4-3bde-4c2b-a409604c4646"), - // LabelID: to.Ptr("05e6eaa1-075a-4fb4-a732-a92215a2444a"), - // LabelName: to.Ptr("Sensitive"), - // SchemaName: to.Ptr("dbo"), - // TableName: to.Ptr("myTable"), - // }, - // }, - // { - // Name: to.Ptr("recommended"), - // Type: to.Ptr("Microsoft.Sql/managedInstances/databases/schemas/tables/columns/sensitivityLabels"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/myRG/providers/Microsoft.Sql/managedInstances/myManagedInstanceName/databases/myDatabase/schemas/dbo/tables/myTable/columns/myColumn4/sensitivityLabels/recommended"), - // Properties: &armsql.SensitivityLabelProperties{ - // ColumnName: to.Ptr("myColumn4"), - // InformationType: to.Ptr("Email"), - // InformationTypeID: to.Ptr("d22fa6e9-5ee4-3bde-4c2b-a409604c4646"), - // LabelID: to.Ptr("bf91e08c-f4f0-478a-b016-25164b2a65ff"), - // LabelName: to.Ptr("PII"), - // SchemaName: to.Ptr("dbo"), - // TableName: to.Ptr("myTable"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/sql/armsql/manageddatabasetables_client.go b/sdk/resourcemanager/sql/armsql/manageddatabasetables_client.go index a6780b6e5841..975a9d5d4b13 100644 --- a/sdk/resourcemanager/sql/armsql/manageddatabasetables_client.go +++ b/sdk/resourcemanager/sql/armsql/manageddatabasetables_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armsql @@ -47,7 +46,7 @@ func NewManagedDatabaseTablesClient(subscriptionID string, credential azcore.Tok // Get - Get managed database table // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - managedInstanceName - The name of the managed instance. @@ -57,18 +56,21 @@ func NewManagedDatabaseTablesClient(subscriptionID string, credential azcore.Tok // - options - ManagedDatabaseTablesClientGetOptions contains the optional parameters for the ManagedDatabaseTablesClient.Get // method. func (client *ManagedDatabaseTablesClient) Get(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, schemaName string, tableName string, options *ManagedDatabaseTablesClientGetOptions) (ManagedDatabaseTablesClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, managedInstanceName, databaseName, schemaName, tableName, options) if err != nil { return ManagedDatabaseTablesClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ManagedDatabaseTablesClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ManagedDatabaseTablesClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ManagedDatabaseTablesClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -103,7 +105,7 @@ func (client *ManagedDatabaseTablesClient) getCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -120,7 +122,7 @@ func (client *ManagedDatabaseTablesClient) getHandleResponse(resp *http.Response // NewListBySchemaPager - List managed database tables // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - managedInstanceName - The name of the managed instance. @@ -187,7 +189,7 @@ func (client *ManagedDatabaseTablesClient) listBySchemaCreateRequest(ctx context if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/sql/armsql/manageddatabasetables_client_example_test.go b/sdk/resourcemanager/sql/armsql/manageddatabasetables_client_example_test.go deleted file mode 100644 index 94375b40692f..000000000000 --- a/sdk/resourcemanager/sql/armsql/manageddatabasetables_client_example_test.go +++ /dev/null @@ -1,81 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsql_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sql/armsql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseTableListBySchema.json -func ExampleManagedDatabaseTablesClient_NewListBySchemaPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewManagedDatabaseTablesClient().NewListBySchemaPager("myRG", "myManagedInstanceName", "myDatabase", "dbo", &armsql.ManagedDatabaseTablesClientListBySchemaOptions{Filter: nil}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DatabaseTableListResult = armsql.DatabaseTableListResult{ - // Value: []*armsql.DatabaseTable{ - // { - // Name: to.Ptr("table1"), - // Type: to.Ptr("Microsoft.Sql/managedInstances/databases/schemas/tables"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/myRG/providers/Microsoft.Sql/managedInstances/myManagedInstanceName/databases/myDatabase/schemas/dbo/tables/table1"), - // }, - // { - // Name: to.Ptr("table2"), - // Type: to.Ptr("Microsoft.Sql/managedInstances/databases/schemas/tables"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/myRG/providers/Microsoft.Sql/managedInstances/myManagedInstanceName/databases/myDatabase/schemas/dbo/tables/table2"), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseTableGet.json -func ExampleManagedDatabaseTablesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewManagedDatabaseTablesClient().Get(ctx, "myRG", "myManagedInstanceName", "myDatabase", "dbo", "table1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DatabaseTable = armsql.DatabaseTable{ - // Name: to.Ptr("table1"), - // Type: to.Ptr("Microsoft.Sql/managedInstances/databases/schemas/tables"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/myRG/providers/Microsoft.Sql/managedInstances/myManagedInstanceName/databases/myDatabase/schemas/dbo/tables/table1"), - // } -} diff --git a/sdk/resourcemanager/sql/armsql/manageddatabasetransparentdataencryption_client.go b/sdk/resourcemanager/sql/armsql/manageddatabasetransparentdataencryption_client.go index 80b5bb439945..66a537d40693 100644 --- a/sdk/resourcemanager/sql/armsql/manageddatabasetransparentdataencryption_client.go +++ b/sdk/resourcemanager/sql/armsql/manageddatabasetransparentdataencryption_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armsql @@ -47,7 +46,7 @@ func NewManagedDatabaseTransparentDataEncryptionClient(subscriptionID string, cr // CreateOrUpdate - Updates a database's transparent data encryption configuration. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - managedInstanceName - The name of the managed instance. @@ -57,18 +56,21 @@ func NewManagedDatabaseTransparentDataEncryptionClient(subscriptionID string, cr // - options - ManagedDatabaseTransparentDataEncryptionClientCreateOrUpdateOptions contains the optional parameters for the // ManagedDatabaseTransparentDataEncryptionClient.CreateOrUpdate method. func (client *ManagedDatabaseTransparentDataEncryptionClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, tdeName TransparentDataEncryptionName, parameters ManagedTransparentDataEncryption, options *ManagedDatabaseTransparentDataEncryptionClientCreateOrUpdateOptions) (ManagedDatabaseTransparentDataEncryptionClientCreateOrUpdateResponse, error) { + var err error req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, managedInstanceName, databaseName, tdeName, parameters, options) if err != nil { return ManagedDatabaseTransparentDataEncryptionClientCreateOrUpdateResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ManagedDatabaseTransparentDataEncryptionClientCreateOrUpdateResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { - return ManagedDatabaseTransparentDataEncryptionClientCreateOrUpdateResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return ManagedDatabaseTransparentDataEncryptionClientCreateOrUpdateResponse{}, err } - return client.createOrUpdateHandleResponse(resp) + resp, err := client.createOrUpdateHandleResponse(httpResp) + return resp, err } // createOrUpdateCreateRequest creates the CreateOrUpdate request. @@ -99,10 +101,13 @@ func (client *ManagedDatabaseTransparentDataEncryptionClient) createOrUpdateCrea return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // createOrUpdateHandleResponse handles the CreateOrUpdate response. @@ -117,7 +122,7 @@ func (client *ManagedDatabaseTransparentDataEncryptionClient) createOrUpdateHand // Get - Gets a managed database's transparent data encryption. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - managedInstanceName - The name of the managed instance. @@ -126,18 +131,21 @@ func (client *ManagedDatabaseTransparentDataEncryptionClient) createOrUpdateHand // - options - ManagedDatabaseTransparentDataEncryptionClientGetOptions contains the optional parameters for the ManagedDatabaseTransparentDataEncryptionClient.Get // method. func (client *ManagedDatabaseTransparentDataEncryptionClient) Get(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, tdeName TransparentDataEncryptionName, options *ManagedDatabaseTransparentDataEncryptionClientGetOptions) (ManagedDatabaseTransparentDataEncryptionClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, managedInstanceName, databaseName, tdeName, options) if err != nil { return ManagedDatabaseTransparentDataEncryptionClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ManagedDatabaseTransparentDataEncryptionClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ManagedDatabaseTransparentDataEncryptionClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ManagedDatabaseTransparentDataEncryptionClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -168,7 +176,7 @@ func (client *ManagedDatabaseTransparentDataEncryptionClient) getCreateRequest(c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -185,7 +193,7 @@ func (client *ManagedDatabaseTransparentDataEncryptionClient) getHandleResponse( // NewListByDatabasePager - Gets a list of managed database's transparent data encryptions. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - managedInstanceName - The name of the managed instance. @@ -244,7 +252,7 @@ func (client *ManagedDatabaseTransparentDataEncryptionClient) listByDatabaseCrea return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/sql/armsql/manageddatabasetransparentdataencryption_client_example_test.go b/sdk/resourcemanager/sql/armsql/manageddatabasetransparentdataencryption_client_example_test.go deleted file mode 100644 index a82561ab8542..000000000000 --- a/sdk/resourcemanager/sql/armsql/manageddatabasetransparentdataencryption_client_example_test.go +++ /dev/null @@ -1,115 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsql_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sql/armsql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedTransparentDataEncryptionGet.json -func ExampleManagedDatabaseTransparentDataEncryptionClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewManagedDatabaseTransparentDataEncryptionClient().Get(ctx, "security-tde-resourcegroup", "securitytde", "testdb", armsql.TransparentDataEncryptionNameCurrent, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ManagedTransparentDataEncryption = armsql.ManagedTransparentDataEncryption{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.Sql/managedInstances/databases/transparentDataEncryption"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/security-tde-resourcegroup/providers/Microsoft.Sql/managedInstances/securitytde/databases/testdb"), - // Properties: &armsql.ManagedTransparentDataEncryptionProperties{ - // State: to.Ptr(armsql.TransparentDataEncryptionStateEnabled), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedTransparentDataEncryptionUpdate.json -func ExampleManagedDatabaseTransparentDataEncryptionClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewManagedDatabaseTransparentDataEncryptionClient().CreateOrUpdate(ctx, "securitytde-42-rg", "securitytde-42", "testdb", armsql.TransparentDataEncryptionNameCurrent, armsql.ManagedTransparentDataEncryption{ - Properties: &armsql.ManagedTransparentDataEncryptionProperties{ - State: to.Ptr(armsql.TransparentDataEncryptionStateEnabled), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ManagedTransparentDataEncryption = armsql.ManagedTransparentDataEncryption{ - // Name: to.Ptr("current"), - // Type: to.Ptr("Microsoft.Sql/managedInstance/databases/transparentDataEncryption"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/securitytde-42-rg/providers/Microsoft.Sql/managedInstances/securitytde-42/databases/testdb/transparentDataEncryption"), - // Properties: &armsql.ManagedTransparentDataEncryptionProperties{ - // State: to.Ptr(armsql.TransparentDataEncryptionStateEnabled), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedTransparentDataEncryptionList.json -func ExampleManagedDatabaseTransparentDataEncryptionClient_NewListByDatabasePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewManagedDatabaseTransparentDataEncryptionClient().NewListByDatabasePager("security-tde-resourcegroup", "securitytde", "testdb", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ManagedTransparentDataEncryptionListResult = armsql.ManagedTransparentDataEncryptionListResult{ - // Value: []*armsql.ManagedTransparentDataEncryption{ - // { - // Name: to.Ptr("current"), - // Type: to.Ptr("Microsoft.Sql/managedInstances/databases/transparentDataEncryption"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/security-tde-resourcegroup/providers/Microsoft.Sql/managedInstances/securitytde/databases/testdb"), - // Properties: &armsql.ManagedTransparentDataEncryptionProperties{ - // State: to.Ptr(armsql.TransparentDataEncryptionStateEnabled), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/sql/armsql/manageddatabasevulnerabilityassessmentrulebaselines_client.go b/sdk/resourcemanager/sql/armsql/manageddatabasevulnerabilityassessmentrulebaselines_client.go index 4a8271581f57..a89ceaaef8e4 100644 --- a/sdk/resourcemanager/sql/armsql/manageddatabasevulnerabilityassessmentrulebaselines_client.go +++ b/sdk/resourcemanager/sql/armsql/manageddatabasevulnerabilityassessmentrulebaselines_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armsql @@ -47,7 +46,7 @@ func NewManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient(subscriptionID // CreateOrUpdate - Creates or updates a database's vulnerability assessment rule baseline. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - managedInstanceName - The name of the managed instance. @@ -59,23 +58,26 @@ func NewManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient(subscriptionID // - parameters - The requested rule baseline resource. // - options - ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClientCreateOrUpdateOptions contains the optional parameters // for the ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient.CreateOrUpdate method. -func (client *ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, vulnerabilityAssessmentName VulnerabilityAssessmentName, ruleID string, baselineName VulnerabilityAssessmentPolicyBaselineName, parameters DatabaseVulnerabilityAssessmentRuleBaseline, options *ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClientCreateOrUpdateOptions) (ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClientCreateOrUpdateResponse, error) { +func (client *ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, vulnerabilityAssessmentName VulnerabilityAssessmentName, ruleID string, baselineName VulnerabilityAssessmentPolicyBaselineName, parameters DatabaseVulnerabilityAssessmentRuleBaselineAutoGenerated, options *ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClientCreateOrUpdateOptions) (ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClientCreateOrUpdateResponse, error) { + var err error req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, managedInstanceName, databaseName, vulnerabilityAssessmentName, ruleID, baselineName, parameters, options) if err != nil { return ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClientCreateOrUpdateResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClientCreateOrUpdateResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClientCreateOrUpdateResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClientCreateOrUpdateResponse{}, err } - return client.createOrUpdateHandleResponse(resp) + resp, err := client.createOrUpdateHandleResponse(httpResp) + return resp, err } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, vulnerabilityAssessmentName VulnerabilityAssessmentName, ruleID string, baselineName VulnerabilityAssessmentPolicyBaselineName, parameters DatabaseVulnerabilityAssessmentRuleBaseline, options *ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClientCreateOrUpdateOptions) (*policy.Request, error) { +func (client *ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, vulnerabilityAssessmentName VulnerabilityAssessmentName, ruleID string, baselineName VulnerabilityAssessmentPolicyBaselineName, parameters DatabaseVulnerabilityAssessmentRuleBaselineAutoGenerated, options *ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClientCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/rules/{ruleId}/baselines/{baselineName}" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -110,16 +112,19 @@ func (client *ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient) createO return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // createOrUpdateHandleResponse handles the CreateOrUpdate response. func (client *ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient) createOrUpdateHandleResponse(resp *http.Response) (ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClientCreateOrUpdateResponse, error) { result := ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClientCreateOrUpdateResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.DatabaseVulnerabilityAssessmentRuleBaseline); err != nil { + if err := runtime.UnmarshalAsJSON(resp, &result.DatabaseVulnerabilityAssessmentRuleBaselineAutoGenerated); err != nil { return ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClientCreateOrUpdateResponse{}, err } return result, nil @@ -128,7 +133,7 @@ func (client *ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient) createO // Delete - Removes the database's vulnerability assessment rule baseline. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - managedInstanceName - The name of the managed instance. @@ -140,16 +145,18 @@ func (client *ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient) createO // - options - ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClientDeleteOptions contains the optional parameters for the // ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient.Delete method. func (client *ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient) Delete(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, vulnerabilityAssessmentName VulnerabilityAssessmentName, ruleID string, baselineName VulnerabilityAssessmentPolicyBaselineName, options *ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClientDeleteOptions) (ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClientDeleteResponse, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, managedInstanceName, databaseName, vulnerabilityAssessmentName, ruleID, baselineName, options) if err != nil { return ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClientDeleteResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClientDeleteResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClientDeleteResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClientDeleteResponse{}, err } return ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClientDeleteResponse{}, nil } @@ -190,7 +197,7 @@ func (client *ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient) deleteC return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -198,7 +205,7 @@ func (client *ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient) deleteC // Get - Gets a database's vulnerability assessment rule baseline. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - managedInstanceName - The name of the managed instance. @@ -210,18 +217,21 @@ func (client *ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient) deleteC // - options - ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClientGetOptions contains the optional parameters for the // ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient.Get method. func (client *ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient) Get(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, vulnerabilityAssessmentName VulnerabilityAssessmentName, ruleID string, baselineName VulnerabilityAssessmentPolicyBaselineName, options *ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClientGetOptions) (ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, managedInstanceName, databaseName, vulnerabilityAssessmentName, ruleID, baselineName, options) if err != nil { return ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -260,7 +270,7 @@ func (client *ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient) getCrea return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -269,7 +279,7 @@ func (client *ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient) getCrea // getHandleResponse handles the Get response. func (client *ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient) getHandleResponse(resp *http.Response) (ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClientGetResponse, error) { result := ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.DatabaseVulnerabilityAssessmentRuleBaseline); err != nil { + if err := runtime.UnmarshalAsJSON(resp, &result.DatabaseVulnerabilityAssessmentRuleBaselineAutoGenerated); err != nil { return ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClientGetResponse{}, err } return result, nil diff --git a/sdk/resourcemanager/sql/armsql/manageddatabasevulnerabilityassessmentrulebaselines_client_example_test.go b/sdk/resourcemanager/sql/armsql/manageddatabasevulnerabilityassessmentrulebaselines_client_example_test.go deleted file mode 100644 index 9b6acce7327e..000000000000 --- a/sdk/resourcemanager/sql/armsql/manageddatabasevulnerabilityassessmentrulebaselines_client_example_test.go +++ /dev/null @@ -1,144 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsql_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sql/armsql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseVulnerabilityAssessmentRuleBaselineGet.json -func ExampleManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient().Get(ctx, "vulnerabilityaseessmenttest-4711", "vulnerabilityaseessmenttest-6411", "testdb", armsql.VulnerabilityAssessmentNameDefault, "VA1001", armsql.VulnerabilityAssessmentPolicyBaselineNameMaster, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DatabaseVulnerabilityAssessmentRuleBaseline = armsql.DatabaseVulnerabilityAssessmentRuleBaseline{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.Sql/servers/databases/vulnerabilityAssessments/rules/baselines"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/vulnerabilityaseessmenttest-4799/providers/Microsoft.Sql/managedInstances/vulnerabilityaseessmenttest-6440/databases/testdb/vulnerabilityAssessments/default/rules/VA1001/baselines/default"), - // Properties: &armsql.DatabaseVulnerabilityAssessmentRuleBaselineProperties{ - // BaselineResults: []*armsql.DatabaseVulnerabilityAssessmentRuleBaselineItem{ - // { - // Result: []*string{ - // to.Ptr("userA"), - // to.Ptr("SELECT")}, - // }, - // { - // Result: []*string{ - // to.Ptr("userB"), - // to.Ptr("SELECT")}, - // }, - // { - // Result: []*string{ - // to.Ptr("userC"), - // to.Ptr("SELECT"), - // to.Ptr("tableId_4")}, - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseVulnerabilityAssessmentRuleBaselineCreate.json -func ExampleManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient().CreateOrUpdate(ctx, "vulnerabilityaseessmenttest-4799", "vulnerabilityaseessmenttest-6440", "testdb", armsql.VulnerabilityAssessmentNameDefault, "VA1001", armsql.VulnerabilityAssessmentPolicyBaselineNameDefault, armsql.DatabaseVulnerabilityAssessmentRuleBaseline{ - Properties: &armsql.DatabaseVulnerabilityAssessmentRuleBaselineProperties{ - BaselineResults: []*armsql.DatabaseVulnerabilityAssessmentRuleBaselineItem{ - { - Result: []*string{ - to.Ptr("userA"), - to.Ptr("SELECT")}, - }, - { - Result: []*string{ - to.Ptr("userB"), - to.Ptr("SELECT")}, - }, - { - Result: []*string{ - to.Ptr("userC"), - to.Ptr("SELECT"), - to.Ptr("tableId_4")}, - }}, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DatabaseVulnerabilityAssessmentRuleBaseline = armsql.DatabaseVulnerabilityAssessmentRuleBaseline{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.Sql/servers/databases/vulnerabilityAssessments/rules/baselines"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/vulnerabilityaseessmenttest-4799/providers/Microsoft.Sql/managedInstances/vulnerabilityaseessmenttest-6440/databases/testdb/vulnerabilityAssessments/default/rules/VA1001/baselines/default"), - // Properties: &armsql.DatabaseVulnerabilityAssessmentRuleBaselineProperties{ - // BaselineResults: []*armsql.DatabaseVulnerabilityAssessmentRuleBaselineItem{ - // { - // Result: []*string{ - // to.Ptr("userA"), - // to.Ptr("SELECT")}, - // }, - // { - // Result: []*string{ - // to.Ptr("userB"), - // to.Ptr("SELECT")}, - // }, - // { - // Result: []*string{ - // to.Ptr("userC"), - // to.Ptr("SELECT"), - // to.Ptr("tableId_4")}, - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseVulnerabilityAssessmentRuleBaselineDelete.json -func ExampleManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient().Delete(ctx, "vulnerabilityaseessmenttest-4799", "vulnerabilityaseessmenttest-6440", "testdb", armsql.VulnerabilityAssessmentNameDefault, "VA1001", armsql.VulnerabilityAssessmentPolicyBaselineNameDefault, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/sql/armsql/manageddatabasevulnerabilityassessments_client.go b/sdk/resourcemanager/sql/armsql/manageddatabasevulnerabilityassessments_client.go index 87aa472e0352..77fc4241300d 100644 --- a/sdk/resourcemanager/sql/armsql/manageddatabasevulnerabilityassessments_client.go +++ b/sdk/resourcemanager/sql/armsql/manageddatabasevulnerabilityassessments_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armsql @@ -47,7 +46,7 @@ func NewManagedDatabaseVulnerabilityAssessmentsClient(subscriptionID string, cre // CreateOrUpdate - Creates or updates the database's vulnerability assessment. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - managedInstanceName - The name of the managed instance. @@ -57,18 +56,21 @@ func NewManagedDatabaseVulnerabilityAssessmentsClient(subscriptionID string, cre // - options - ManagedDatabaseVulnerabilityAssessmentsClientCreateOrUpdateOptions contains the optional parameters for the ManagedDatabaseVulnerabilityAssessmentsClient.CreateOrUpdate // method. func (client *ManagedDatabaseVulnerabilityAssessmentsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, vulnerabilityAssessmentName VulnerabilityAssessmentName, parameters DatabaseVulnerabilityAssessment, options *ManagedDatabaseVulnerabilityAssessmentsClientCreateOrUpdateOptions) (ManagedDatabaseVulnerabilityAssessmentsClientCreateOrUpdateResponse, error) { + var err error req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, managedInstanceName, databaseName, vulnerabilityAssessmentName, parameters, options) if err != nil { return ManagedDatabaseVulnerabilityAssessmentsClientCreateOrUpdateResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ManagedDatabaseVulnerabilityAssessmentsClientCreateOrUpdateResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { - return ManagedDatabaseVulnerabilityAssessmentsClientCreateOrUpdateResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return ManagedDatabaseVulnerabilityAssessmentsClientCreateOrUpdateResponse{}, err } - return client.createOrUpdateHandleResponse(resp) + resp, err := client.createOrUpdateHandleResponse(httpResp) + return resp, err } // createOrUpdateCreateRequest creates the CreateOrUpdate request. @@ -99,10 +101,13 @@ func (client *ManagedDatabaseVulnerabilityAssessmentsClient) createOrUpdateCreat return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // createOrUpdateHandleResponse handles the CreateOrUpdate response. @@ -117,7 +122,7 @@ func (client *ManagedDatabaseVulnerabilityAssessmentsClient) createOrUpdateHandl // Delete - Removes the database's vulnerability assessment. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - managedInstanceName - The name of the managed instance. @@ -126,16 +131,18 @@ func (client *ManagedDatabaseVulnerabilityAssessmentsClient) createOrUpdateHandl // - options - ManagedDatabaseVulnerabilityAssessmentsClientDeleteOptions contains the optional parameters for the ManagedDatabaseVulnerabilityAssessmentsClient.Delete // method. func (client *ManagedDatabaseVulnerabilityAssessmentsClient) Delete(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, vulnerabilityAssessmentName VulnerabilityAssessmentName, options *ManagedDatabaseVulnerabilityAssessmentsClientDeleteOptions) (ManagedDatabaseVulnerabilityAssessmentsClientDeleteResponse, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, managedInstanceName, databaseName, vulnerabilityAssessmentName, options) if err != nil { return ManagedDatabaseVulnerabilityAssessmentsClientDeleteResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ManagedDatabaseVulnerabilityAssessmentsClientDeleteResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ManagedDatabaseVulnerabilityAssessmentsClientDeleteResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ManagedDatabaseVulnerabilityAssessmentsClientDeleteResponse{}, err } return ManagedDatabaseVulnerabilityAssessmentsClientDeleteResponse{}, nil } @@ -168,7 +175,7 @@ func (client *ManagedDatabaseVulnerabilityAssessmentsClient) deleteCreateRequest return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -176,7 +183,7 @@ func (client *ManagedDatabaseVulnerabilityAssessmentsClient) deleteCreateRequest // Get - Gets the database's vulnerability assessment. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - managedInstanceName - The name of the managed instance. @@ -185,18 +192,21 @@ func (client *ManagedDatabaseVulnerabilityAssessmentsClient) deleteCreateRequest // - options - ManagedDatabaseVulnerabilityAssessmentsClientGetOptions contains the optional parameters for the ManagedDatabaseVulnerabilityAssessmentsClient.Get // method. func (client *ManagedDatabaseVulnerabilityAssessmentsClient) Get(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, vulnerabilityAssessmentName VulnerabilityAssessmentName, options *ManagedDatabaseVulnerabilityAssessmentsClientGetOptions) (ManagedDatabaseVulnerabilityAssessmentsClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, managedInstanceName, databaseName, vulnerabilityAssessmentName, options) if err != nil { return ManagedDatabaseVulnerabilityAssessmentsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ManagedDatabaseVulnerabilityAssessmentsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ManagedDatabaseVulnerabilityAssessmentsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ManagedDatabaseVulnerabilityAssessmentsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -227,7 +237,7 @@ func (client *ManagedDatabaseVulnerabilityAssessmentsClient) getCreateRequest(ct return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -244,7 +254,7 @@ func (client *ManagedDatabaseVulnerabilityAssessmentsClient) getHandleResponse(r // NewListByDatabasePager - Lists the vulnerability assessments of a managed database. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - managedInstanceName - The name of the managed instance. @@ -303,7 +313,7 @@ func (client *ManagedDatabaseVulnerabilityAssessmentsClient) listByDatabaseCreat return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/sql/armsql/manageddatabasevulnerabilityassessments_client_example_test.go b/sdk/resourcemanager/sql/armsql/manageddatabasevulnerabilityassessments_client_example_test.go deleted file mode 100644 index 058763b00d1d..000000000000 --- a/sdk/resourcemanager/sql/armsql/manageddatabasevulnerabilityassessments_client_example_test.go +++ /dev/null @@ -1,196 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsql_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sql/armsql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseVulnerabilityAssessmentGet.json -func ExampleManagedDatabaseVulnerabilityAssessmentsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewManagedDatabaseVulnerabilityAssessmentsClient().Get(ctx, "vulnerabilityaseessmenttest-4799", "vulnerabilityaseessmenttest-6440", "testdb", armsql.VulnerabilityAssessmentNameDefault, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DatabaseVulnerabilityAssessment = armsql.DatabaseVulnerabilityAssessment{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.Sql/servers/databases/vulnerabilityAssessments"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/vulnerabilityaseessmenttest-4799/providers/Microsoft.Sql/managedInstances/vulnerabilityaseessmenttest-6440/databases/testdb/vulnerabilityAssessments/default"), - // Properties: &armsql.DatabaseVulnerabilityAssessmentProperties{ - // RecurringScans: &armsql.VulnerabilityAssessmentRecurringScansProperties{ - // EmailSubscriptionAdmins: to.Ptr(true), - // Emails: []*string{ - // to.Ptr("email1@mail.com"), - // to.Ptr("email2@mail.com")}, - // IsEnabled: to.Ptr(true), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseVulnerabilityAssessmentCreateMax.json -func ExampleManagedDatabaseVulnerabilityAssessmentsClient_CreateOrUpdate_createADatabasesVulnerabilityAssessmentWithAllParameters() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewManagedDatabaseVulnerabilityAssessmentsClient().CreateOrUpdate(ctx, "vulnerabilityaseessmenttest-4799", "vulnerabilityaseessmenttest-6440", "testdb", armsql.VulnerabilityAssessmentNameDefault, armsql.DatabaseVulnerabilityAssessment{ - Properties: &armsql.DatabaseVulnerabilityAssessmentProperties{ - RecurringScans: &armsql.VulnerabilityAssessmentRecurringScansProperties{ - EmailSubscriptionAdmins: to.Ptr(true), - Emails: []*string{ - to.Ptr("email1@mail.com"), - to.Ptr("email2@mail.com")}, - IsEnabled: to.Ptr(true), - }, - StorageContainerPath: to.Ptr("https://myStorage.blob.core.windows.net/vulnerability-assessment/"), - StorageContainerSasKey: to.Ptr("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DatabaseVulnerabilityAssessment = armsql.DatabaseVulnerabilityAssessment{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.Sql/servers/databases/vulnerabilityAssessments"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/vulnerabilityaseessmenttest-4799/providers/Microsoft.Sql/managedInstances/vulnerabilityaseessmenttest-6440/databases/testdb/vulnerabilityAssessments/default"), - // Properties: &armsql.DatabaseVulnerabilityAssessmentProperties{ - // RecurringScans: &armsql.VulnerabilityAssessmentRecurringScansProperties{ - // EmailSubscriptionAdmins: to.Ptr(true), - // Emails: []*string{ - // to.Ptr("email1@mail.com"), - // to.Ptr("email2@mail.com")}, - // IsEnabled: to.Ptr(true), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseVulnerabilityAssessmentCreateMin.json -func ExampleManagedDatabaseVulnerabilityAssessmentsClient_CreateOrUpdate_createADatabasesVulnerabilityAssessmentWithMinimalParameters() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewManagedDatabaseVulnerabilityAssessmentsClient().CreateOrUpdate(ctx, "vulnerabilityaseessmenttest-4799", "vulnerabilityaseessmenttest-6440", "testdb", armsql.VulnerabilityAssessmentNameDefault, armsql.DatabaseVulnerabilityAssessment{ - Properties: &armsql.DatabaseVulnerabilityAssessmentProperties{ - StorageContainerPath: to.Ptr("https://myStorage.blob.core.windows.net/vulnerability-assessment/"), - StorageContainerSasKey: to.Ptr("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DatabaseVulnerabilityAssessment = armsql.DatabaseVulnerabilityAssessment{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.Sql/servers/databases/vulnerabilityAssessments"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/vulnerabilityaseessmenttest-4799/providers/Microsoft.Sql/managedInstances/vulnerabilityaseessmenttest-6440/databases/testdb/vulnerabilityAssessments/default"), - // Properties: &armsql.DatabaseVulnerabilityAssessmentProperties{ - // RecurringScans: &armsql.VulnerabilityAssessmentRecurringScansProperties{ - // EmailSubscriptionAdmins: to.Ptr(false), - // Emails: []*string{ - // }, - // IsEnabled: to.Ptr(false), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseVulnerabilityAssessmentDelete.json -func ExampleManagedDatabaseVulnerabilityAssessmentsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewManagedDatabaseVulnerabilityAssessmentsClient().Delete(ctx, "vulnerabilityaseessmenttest-4799", "vulnerabilityaseessmenttest-6440", "testdb", armsql.VulnerabilityAssessmentNameDefault, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseVulnerabilityAssessmentListByDatabase.json -func ExampleManagedDatabaseVulnerabilityAssessmentsClient_NewListByDatabasePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewManagedDatabaseVulnerabilityAssessmentsClient().NewListByDatabasePager("vulnerabilityaseessmenttest-4799", "vulnerabilityaseessmenttest-6440", "testdb", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DatabaseVulnerabilityAssessmentListResult = armsql.DatabaseVulnerabilityAssessmentListResult{ - // Value: []*armsql.DatabaseVulnerabilityAssessment{ - // { - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.Sql/servers/databases/vulnerabilityAssessments"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/vulnerabilityaseessmenttest-4799/providers/Microsoft.Sql/managedInstances/vulnerabilityaseessmenttest-6440/databases/testdb/vulnerabilityAssessments/default"), - // Properties: &armsql.DatabaseVulnerabilityAssessmentProperties{ - // RecurringScans: &armsql.VulnerabilityAssessmentRecurringScansProperties{ - // EmailSubscriptionAdmins: to.Ptr(true), - // Emails: []*string{ - // to.Ptr("email1@mail.com"), - // to.Ptr("email2@mail.com")}, - // IsEnabled: to.Ptr(true), - // }, - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/sql/armsql/manageddatabasevulnerabilityassessmentscans_client.go b/sdk/resourcemanager/sql/armsql/manageddatabasevulnerabilityassessmentscans_client.go index 951004943992..e232d2360553 100644 --- a/sdk/resourcemanager/sql/armsql/manageddatabasevulnerabilityassessmentscans_client.go +++ b/sdk/resourcemanager/sql/armsql/manageddatabasevulnerabilityassessmentscans_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armsql @@ -47,7 +46,7 @@ func NewManagedDatabaseVulnerabilityAssessmentScansClient(subscriptionID string, // Export - Convert an existing scan result to a human readable format. If already exists nothing happens // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - managedInstanceName - The name of the managed instance. @@ -57,18 +56,21 @@ func NewManagedDatabaseVulnerabilityAssessmentScansClient(subscriptionID string, // - options - ManagedDatabaseVulnerabilityAssessmentScansClientExportOptions contains the optional parameters for the ManagedDatabaseVulnerabilityAssessmentScansClient.Export // method. func (client *ManagedDatabaseVulnerabilityAssessmentScansClient) Export(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, vulnerabilityAssessmentName VulnerabilityAssessmentName, scanID string, options *ManagedDatabaseVulnerabilityAssessmentScansClientExportOptions) (ManagedDatabaseVulnerabilityAssessmentScansClientExportResponse, error) { + var err error req, err := client.exportCreateRequest(ctx, resourceGroupName, managedInstanceName, databaseName, vulnerabilityAssessmentName, scanID, options) if err != nil { return ManagedDatabaseVulnerabilityAssessmentScansClientExportResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ManagedDatabaseVulnerabilityAssessmentScansClientExportResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { - return ManagedDatabaseVulnerabilityAssessmentScansClientExportResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return ManagedDatabaseVulnerabilityAssessmentScansClientExportResponse{}, err } - return client.exportHandleResponse(resp) + resp, err := client.exportHandleResponse(httpResp) + return resp, err } // exportCreateRequest creates the Export request. @@ -103,7 +105,7 @@ func (client *ManagedDatabaseVulnerabilityAssessmentScansClient) exportCreateReq return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -121,7 +123,7 @@ func (client *ManagedDatabaseVulnerabilityAssessmentScansClient) exportHandleRes // Get - Gets a vulnerability assessment scan record of a database. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - managedInstanceName - The name of the managed instance. @@ -131,18 +133,21 @@ func (client *ManagedDatabaseVulnerabilityAssessmentScansClient) exportHandleRes // - options - ManagedDatabaseVulnerabilityAssessmentScansClientGetOptions contains the optional parameters for the ManagedDatabaseVulnerabilityAssessmentScansClient.Get // method. func (client *ManagedDatabaseVulnerabilityAssessmentScansClient) Get(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, vulnerabilityAssessmentName VulnerabilityAssessmentName, scanID string, options *ManagedDatabaseVulnerabilityAssessmentScansClientGetOptions) (ManagedDatabaseVulnerabilityAssessmentScansClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, managedInstanceName, databaseName, vulnerabilityAssessmentName, scanID, options) if err != nil { return ManagedDatabaseVulnerabilityAssessmentScansClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ManagedDatabaseVulnerabilityAssessmentScansClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ManagedDatabaseVulnerabilityAssessmentScansClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ManagedDatabaseVulnerabilityAssessmentScansClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -177,7 +182,7 @@ func (client *ManagedDatabaseVulnerabilityAssessmentScansClient) getCreateReques return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -195,7 +200,7 @@ func (client *ManagedDatabaseVulnerabilityAssessmentScansClient) getHandleRespon // BeginInitiateScan - Executes a Vulnerability Assessment database scan. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - managedInstanceName - The name of the managed instance. @@ -210,7 +215,8 @@ func (client *ManagedDatabaseVulnerabilityAssessmentScansClient) BeginInitiateSc if err != nil { return nil, err } - return runtime.NewPoller[ManagedDatabaseVulnerabilityAssessmentScansClientInitiateScanResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[ManagedDatabaseVulnerabilityAssessmentScansClientInitiateScanResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[ManagedDatabaseVulnerabilityAssessmentScansClientInitiateScanResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -219,20 +225,22 @@ func (client *ManagedDatabaseVulnerabilityAssessmentScansClient) BeginInitiateSc // InitiateScan - Executes a Vulnerability Assessment database scan. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview func (client *ManagedDatabaseVulnerabilityAssessmentScansClient) initiateScan(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, vulnerabilityAssessmentName VulnerabilityAssessmentName, scanID string, options *ManagedDatabaseVulnerabilityAssessmentScansClientBeginInitiateScanOptions) (*http.Response, error) { + var err error req, err := client.initiateScanCreateRequest(ctx, resourceGroupName, managedInstanceName, databaseName, vulnerabilityAssessmentName, scanID, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // initiateScanCreateRequest creates the InitiateScan request. @@ -267,14 +275,14 @@ func (client *ManagedDatabaseVulnerabilityAssessmentScansClient) initiateScanCre return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } // NewListByDatabasePager - Lists the vulnerability assessment scans of a database. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - managedInstanceName - The name of the managed instance. @@ -338,7 +346,7 @@ func (client *ManagedDatabaseVulnerabilityAssessmentScansClient) listByDatabaseC return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/sql/armsql/manageddatabasevulnerabilityassessmentscans_client_example_test.go b/sdk/resourcemanager/sql/armsql/manageddatabasevulnerabilityassessmentscans_client_example_test.go deleted file mode 100644 index ea484ceea087..000000000000 --- a/sdk/resourcemanager/sql/armsql/manageddatabasevulnerabilityassessmentscans_client_example_test.go +++ /dev/null @@ -1,182 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsql_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sql/armsql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseVulnerabilityAssessmentScansExecute.json -func ExampleManagedDatabaseVulnerabilityAssessmentScansClient_BeginInitiateScan() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewManagedDatabaseVulnerabilityAssessmentScansClient().BeginInitiateScan(ctx, "vulnerabilityassessmenttest-4711", "vulnerabilityassessmenttest-6411", "testdb", armsql.VulnerabilityAssessmentNameDefault, "scan01", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseVulnerabilityAssessmentScanExport.json -func ExampleManagedDatabaseVulnerabilityAssessmentScansClient_Export() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewManagedDatabaseVulnerabilityAssessmentScansClient().Export(ctx, "vulnerabilityassessmenttest-4799", "vulnerabilityassessmenttest-6440", "testdb", armsql.VulnerabilityAssessmentNameDefault, "scan001", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DatabaseVulnerabilityAssessmentScansExport = armsql.DatabaseVulnerabilityAssessmentScansExport{ - // Name: to.Ptr("scan001"), - // Type: to.Ptr("Microsoft.Sql/servers/databases/vulnerabilityAssessments/scans/export"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/vulnerabilityassessmenttest-4799/providers/Microsoft.Sql/managedInstances/vulnerabilityassessmenttest-6440/databases/testdb/vulnerabilityAssessments/default/scans/scan001/export"), - // Properties: &armsql.DatabaseVulnerabilityAssessmentScanExportProperties{ - // ExportedReportLocation: to.Ptr("https://myaccount.blob.core.windows.net/vulnerabilityAssessment/vulnerabilityassessmenttest-6440/testdb/scan001.xlsx"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseVulnerabilityAssessmentScanRecordsListByDatabase.json -func ExampleManagedDatabaseVulnerabilityAssessmentScansClient_NewListByDatabasePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewManagedDatabaseVulnerabilityAssessmentScansClient().NewListByDatabasePager("vulnerabilityassessmenttest-4711", "vulnerabilityassessmenttest-6411", "testdb", armsql.VulnerabilityAssessmentNameDefault, nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.VulnerabilityAssessmentScanRecordListResult = armsql.VulnerabilityAssessmentScanRecordListResult{ - // Value: []*armsql.VulnerabilityAssessmentScanRecord{ - // { - // Name: to.Ptr("scan001"), - // Type: to.Ptr("Microsoft.Sql/servers/databases/vulnerabilityAssessments/scans"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/vulnerabilityassessmenttest-4799/providers/Microsoft.Sql/managedInstances/vulnerabilityassessmenttest-6440/databases/testdb/vulnerabilityAssessments/default/scans/scan001"), - // Properties: &armsql.VulnerabilityAssessmentScanRecordProperties{ - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-12-12T17:47:06Z"); return t}()), - // Errors: []*armsql.VulnerabilityAssessmentScanError{ - // }, - // NumberOfFailedSecurityChecks: to.Ptr[int32](9), - // ScanID: to.Ptr("scan001"), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-12-12T17:45:06Z"); return t}()), - // State: to.Ptr(armsql.VulnerabilityAssessmentScanStatePassed), - // StorageContainerPath: to.Ptr("https://myaccount.blob.core.windows.net/vulnerability-assessment"), - // TriggerType: to.Ptr(armsql.VulnerabilityAssessmentScanTriggerTypeOnDemand), - // }, - // }, - // { - // Name: to.Ptr("scan002"), - // Type: to.Ptr("Microsoft.Sql/servers/databases/vulnerabilityAssessments/scans"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/vulnerabilityassessmenttest-4799/providers/Microsoft.Sql/managedInstances/vulnerabilityassessmenttest-6440/databases/testdb/vulnerabilityAssessments/default/scans/scan002"), - // Properties: &armsql.VulnerabilityAssessmentScanRecordProperties{ - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-12-12T17:47:06Z"); return t}()), - // Errors: []*armsql.VulnerabilityAssessmentScanError{ - // }, - // NumberOfFailedSecurityChecks: to.Ptr[int32](9), - // ScanID: to.Ptr("scan002"), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-12-12T17:45:06Z"); return t}()), - // State: to.Ptr(armsql.VulnerabilityAssessmentScanStateFailed), - // StorageContainerPath: to.Ptr("https://myaccount.blob.core.windows.net/vulnerability-assessment"), - // TriggerType: to.Ptr(armsql.VulnerabilityAssessmentScanTriggerTypeRecurring), - // }, - // }, - // { - // Name: to.Ptr("scan003"), - // Type: to.Ptr("Microsoft.Sql/servers/databases/vulnerabilityAssessments/scans"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/vulnerabilityassessmenttest-4799/providers/Microsoft.Sql/managedInstances/vulnerabilityassessmenttest-6440/databases/testdb/vulnerabilityAssessments/default/scans/scan003"), - // Properties: &armsql.VulnerabilityAssessmentScanRecordProperties{ - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-12-12T17:47:06Z"); return t}()), - // Errors: []*armsql.VulnerabilityAssessmentScanError{ - // { - // Code: to.Ptr("StorageNotFound"), - // Message: to.Ptr("Storage not found"), - // }}, - // NumberOfFailedSecurityChecks: to.Ptr[int32](0), - // ScanID: to.Ptr("scan003"), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-12-12T17:45:06Z"); return t}()), - // State: to.Ptr(armsql.VulnerabilityAssessmentScanStateFailedToRun), - // StorageContainerPath: to.Ptr("https://myaccount.blob.core.windows.net/vulnerability-assessment"), - // TriggerType: to.Ptr(armsql.VulnerabilityAssessmentScanTriggerTypeRecurring), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseVulnerabilityAssessmentScanRecordsGet.json -func ExampleManagedDatabaseVulnerabilityAssessmentScansClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewManagedDatabaseVulnerabilityAssessmentScansClient().Get(ctx, "vulnerabilityassessmenttest-4711", "vulnerabilityassessmenttest-6411", "testdb", armsql.VulnerabilityAssessmentNameDefault, "scan001", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VulnerabilityAssessmentScanRecord = armsql.VulnerabilityAssessmentScanRecord{ - // Name: to.Ptr("scan001"), - // Type: to.Ptr("Microsoft.Sql/servers/databases/vulnerabilityAssessments/scans"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/vulnerabilityassessmenttest-4799/providers/Microsoft.Sql/managedInstances/vulnerabilityassessmenttest-6440/databases/testdb/vulnerabilityAssessments/default/scans/scan001"), - // Properties: &armsql.VulnerabilityAssessmentScanRecordProperties{ - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-12-12T17:47:06Z"); return t}()), - // Errors: []*armsql.VulnerabilityAssessmentScanError{ - // }, - // NumberOfFailedSecurityChecks: to.Ptr[int32](9), - // ScanID: to.Ptr("scan001"), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-12-12T17:45:06Z"); return t}()), - // State: to.Ptr(armsql.VulnerabilityAssessmentScanStatePassed), - // StorageContainerPath: to.Ptr("https://myaccount.blob.core.windows.net/vulnerability-assessment"), - // TriggerType: to.Ptr(armsql.VulnerabilityAssessmentScanTriggerTypeOnDemand), - // }, - // } -} diff --git a/sdk/resourcemanager/sql/armsql/managedinstanceadministrators_client.go b/sdk/resourcemanager/sql/armsql/managedinstanceadministrators_client.go index 895166c02162..e73594d01aee 100644 --- a/sdk/resourcemanager/sql/armsql/managedinstanceadministrators_client.go +++ b/sdk/resourcemanager/sql/armsql/managedinstanceadministrators_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armsql @@ -47,7 +46,7 @@ func NewManagedInstanceAdministratorsClient(subscriptionID string, credential az // BeginCreateOrUpdate - Creates or updates a managed instance administrator. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - managedInstanceName - The name of the managed instance. @@ -60,7 +59,8 @@ func (client *ManagedInstanceAdministratorsClient) BeginCreateOrUpdate(ctx conte if err != nil { return nil, err } - return runtime.NewPoller[ManagedInstanceAdministratorsClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[ManagedInstanceAdministratorsClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[ManagedInstanceAdministratorsClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -69,20 +69,22 @@ func (client *ManagedInstanceAdministratorsClient) BeginCreateOrUpdate(ctx conte // CreateOrUpdate - Creates or updates a managed instance administrator. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview func (client *ManagedInstanceAdministratorsClient) createOrUpdate(ctx context.Context, resourceGroupName string, managedInstanceName string, administratorName AdministratorName, parameters ManagedInstanceAdministrator, options *ManagedInstanceAdministratorsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, managedInstanceName, administratorName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createOrUpdateCreateRequest creates the CreateOrUpdate request. @@ -109,16 +111,19 @@ func (client *ManagedInstanceAdministratorsClient) createOrUpdateCreateRequest(c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // BeginDelete - Deletes a managed instance administrator. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - managedInstanceName - The name of the managed instance. @@ -130,7 +135,8 @@ func (client *ManagedInstanceAdministratorsClient) BeginDelete(ctx context.Conte if err != nil { return nil, err } - return runtime.NewPoller[ManagedInstanceAdministratorsClientDeleteResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[ManagedInstanceAdministratorsClientDeleteResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[ManagedInstanceAdministratorsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -139,20 +145,22 @@ func (client *ManagedInstanceAdministratorsClient) BeginDelete(ctx context.Conte // Delete - Deletes a managed instance administrator. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview func (client *ManagedInstanceAdministratorsClient) deleteOperation(ctx context.Context, resourceGroupName string, managedInstanceName string, administratorName AdministratorName, options *ManagedInstanceAdministratorsClientBeginDeleteOptions) (*http.Response, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, managedInstanceName, administratorName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteCreateRequest creates the Delete request. @@ -179,7 +187,7 @@ func (client *ManagedInstanceAdministratorsClient) deleteCreateRequest(ctx conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -187,25 +195,28 @@ func (client *ManagedInstanceAdministratorsClient) deleteCreateRequest(ctx conte // Get - Gets a managed instance administrator. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - managedInstanceName - The name of the managed instance. // - options - ManagedInstanceAdministratorsClientGetOptions contains the optional parameters for the ManagedInstanceAdministratorsClient.Get // method. func (client *ManagedInstanceAdministratorsClient) Get(ctx context.Context, resourceGroupName string, managedInstanceName string, administratorName AdministratorName, options *ManagedInstanceAdministratorsClientGetOptions) (ManagedInstanceAdministratorsClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, managedInstanceName, administratorName, options) if err != nil { return ManagedInstanceAdministratorsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ManagedInstanceAdministratorsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ManagedInstanceAdministratorsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ManagedInstanceAdministratorsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -232,7 +243,7 @@ func (client *ManagedInstanceAdministratorsClient) getCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -249,7 +260,7 @@ func (client *ManagedInstanceAdministratorsClient) getHandleResponse(resp *http. // NewListByInstancePager - Gets a list of managed instance administrators. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - managedInstanceName - The name of the managed instance. @@ -303,7 +314,7 @@ func (client *ManagedInstanceAdministratorsClient) listByInstanceCreateRequest(c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/sql/armsql/managedinstanceadministrators_client_example_test.go b/sdk/resourcemanager/sql/armsql/managedinstanceadministrators_client_example_test.go deleted file mode 100644 index ecf9e8983879..000000000000 --- a/sdk/resourcemanager/sql/armsql/managedinstanceadministrators_client_example_test.go +++ /dev/null @@ -1,194 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsql_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sql/armsql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceAdministratorListByInstance.json -func ExampleManagedInstanceAdministratorsClient_NewListByInstancePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewManagedInstanceAdministratorsClient().NewListByInstancePager("Default-SQL-SouthEastAsia", "managedInstance", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ManagedInstanceAdministratorListResult = armsql.ManagedInstanceAdministratorListResult{ - // Value: []*armsql.ManagedInstanceAdministrator{ - // { - // Name: to.Ptr("ActiveDirectory"), - // Type: to.Ptr("Microsoft.Sql/managedInstances/administrators"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/managedInstances/managedInstance/administrators/ActiveDirectory"), - // Properties: &armsql.ManagedInstanceAdministratorProperties{ - // AdministratorType: to.Ptr(armsql.ManagedInstanceAdministratorTypeActiveDirectory), - // Login: to.Ptr("bob@contoso.com"), - // Sid: to.Ptr("44444444-3333-2222-1111-000000000000"), - // TenantID: to.Ptr("55555555-4444-3333-2222-111111111111"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceAdministratorGet.json -func ExampleManagedInstanceAdministratorsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewManagedInstanceAdministratorsClient().Get(ctx, "Default-SQL-SouthEastAsia", "managedInstance", armsql.AdministratorNameActiveDirectory, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ManagedInstanceAdministrator = armsql.ManagedInstanceAdministrator{ - // Name: to.Ptr("ActiveDirectory"), - // Type: to.Ptr("Microsoft.Sql/managedInstances/administrators"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/managedInstances/managedInstance/administrators/ActiveDirectory"), - // Properties: &armsql.ManagedInstanceAdministratorProperties{ - // AdministratorType: to.Ptr(armsql.ManagedInstanceAdministratorTypeActiveDirectory), - // Login: to.Ptr("bob@contoso.com"), - // Sid: to.Ptr("44444444-3333-2222-1111-000000000000"), - // TenantID: to.Ptr("55555555-4444-3333-2222-111111111111"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceAdministratorCreate.json -func ExampleManagedInstanceAdministratorsClient_BeginCreateOrUpdate_createAdministratorOfManagedInstance() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewManagedInstanceAdministratorsClient().BeginCreateOrUpdate(ctx, "Default-SQL-SouthEastAsia", "managedInstance", armsql.AdministratorNameActiveDirectory, armsql.ManagedInstanceAdministrator{ - Properties: &armsql.ManagedInstanceAdministratorProperties{ - AdministratorType: to.Ptr(armsql.ManagedInstanceAdministratorTypeActiveDirectory), - Login: to.Ptr("bob@contoso.com"), - Sid: to.Ptr("44444444-3333-2222-1111-000000000000"), - TenantID: to.Ptr("55555555-4444-3333-2222-111111111111"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ManagedInstanceAdministrator = armsql.ManagedInstanceAdministrator{ - // Name: to.Ptr("ActiveDirectory"), - // Type: to.Ptr("Microsoft.Sql/managedInstances/administrators"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/managedInstances/managedInstance/administrators/ActiveDirectory"), - // Properties: &armsql.ManagedInstanceAdministratorProperties{ - // AdministratorType: to.Ptr(armsql.ManagedInstanceAdministratorTypeActiveDirectory), - // Login: to.Ptr("bob@contoso.com"), - // Sid: to.Ptr("44444444-3333-2222-1111-000000000000"), - // TenantID: to.Ptr("55555555-4444-3333-2222-111111111111"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceAdministratorUpdate.json -func ExampleManagedInstanceAdministratorsClient_BeginCreateOrUpdate_updateAdministratorOfManagedInstance() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewManagedInstanceAdministratorsClient().BeginCreateOrUpdate(ctx, "Default-SQL-SouthEastAsia", "managedInstance", armsql.AdministratorNameActiveDirectory, armsql.ManagedInstanceAdministrator{ - Properties: &armsql.ManagedInstanceAdministratorProperties{ - AdministratorType: to.Ptr(armsql.ManagedInstanceAdministratorTypeActiveDirectory), - Login: to.Ptr("bob@contoso.com"), - Sid: to.Ptr("44444444-3333-2222-1111-000000000000"), - TenantID: to.Ptr("55555555-4444-3333-2222-111111111111"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ManagedInstanceAdministrator = armsql.ManagedInstanceAdministrator{ - // Name: to.Ptr("ActiveDirectory"), - // Type: to.Ptr("Microsoft.Sql/managedInstances/administrators"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/managedInstances/managedInstance/administrators/ActiveDirectory"), - // Properties: &armsql.ManagedInstanceAdministratorProperties{ - // AdministratorType: to.Ptr(armsql.ManagedInstanceAdministratorTypeActiveDirectory), - // Login: to.Ptr("bob@contoso.com"), - // Sid: to.Ptr("44444444-3333-2222-1111-000000000000"), - // TenantID: to.Ptr("55555555-4444-3333-2222-111111111111"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceAdministratorDelete.json -func ExampleManagedInstanceAdministratorsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewManagedInstanceAdministratorsClient().BeginDelete(ctx, "Default-SQL-SouthEastAsia", "managedInstance", armsql.AdministratorNameActiveDirectory, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} diff --git a/sdk/resourcemanager/sql/armsql/managedinstanceadvancedthreatprotectionsettings_client.go b/sdk/resourcemanager/sql/armsql/managedinstanceadvancedthreatprotectionsettings_client.go new file mode 100644 index 000000000000..2471123bc28f --- /dev/null +++ b/sdk/resourcemanager/sql/armsql/managedinstanceadvancedthreatprotectionsettings_client.go @@ -0,0 +1,260 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armsql + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// ManagedInstanceAdvancedThreatProtectionSettingsClient contains the methods for the ManagedInstanceAdvancedThreatProtectionSettings group. +// Don't use this type directly, use NewManagedInstanceAdvancedThreatProtectionSettingsClient() instead. +type ManagedInstanceAdvancedThreatProtectionSettingsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewManagedInstanceAdvancedThreatProtectionSettingsClient creates a new instance of ManagedInstanceAdvancedThreatProtectionSettingsClient with the specified values. +// - subscriptionID - The subscription ID that identifies an Azure subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewManagedInstanceAdvancedThreatProtectionSettingsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ManagedInstanceAdvancedThreatProtectionSettingsClient, error) { + cl, err := arm.NewClient(moduleName+".ManagedInstanceAdvancedThreatProtectionSettingsClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ManagedInstanceAdvancedThreatProtectionSettingsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreateOrUpdate - Creates or updates Advanced Threat Protection settings. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-11-01-preview +// - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure +// Resource Manager API or the portal. +// - managedInstanceName - The name of the managed instance. +// - advancedThreatProtectionName - The name of the Advanced Threat Protection state. +// - parameters - The managed instance Advanced Threat Protection state. +// - options - ManagedInstanceAdvancedThreatProtectionSettingsClientBeginCreateOrUpdateOptions contains the optional parameters +// for the ManagedInstanceAdvancedThreatProtectionSettingsClient.BeginCreateOrUpdate method. +func (client *ManagedInstanceAdvancedThreatProtectionSettingsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, managedInstanceName string, advancedThreatProtectionName AdvancedThreatProtectionName, parameters ManagedInstanceAdvancedThreatProtection, options *ManagedInstanceAdvancedThreatProtectionSettingsClientBeginCreateOrUpdateOptions) (*runtime.Poller[ManagedInstanceAdvancedThreatProtectionSettingsClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, managedInstanceName, advancedThreatProtectionName, parameters, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller[ManagedInstanceAdvancedThreatProtectionSettingsClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[ManagedInstanceAdvancedThreatProtectionSettingsClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// CreateOrUpdate - Creates or updates Advanced Threat Protection settings. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-11-01-preview +func (client *ManagedInstanceAdvancedThreatProtectionSettingsClient) createOrUpdate(ctx context.Context, resourceGroupName string, managedInstanceName string, advancedThreatProtectionName AdvancedThreatProtectionName, parameters ManagedInstanceAdvancedThreatProtection, options *ManagedInstanceAdvancedThreatProtectionSettingsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, managedInstanceName, advancedThreatProtectionName, parameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *ManagedInstanceAdvancedThreatProtectionSettingsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, managedInstanceName string, advancedThreatProtectionName AdvancedThreatProtectionName, parameters ManagedInstanceAdvancedThreatProtection, options *ManagedInstanceAdvancedThreatProtectionSettingsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/advancedThreatProtectionSettings/{advancedThreatProtectionName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if managedInstanceName == "" { + return nil, errors.New("parameter managedInstanceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{managedInstanceName}", url.PathEscape(managedInstanceName)) + if advancedThreatProtectionName == "" { + return nil, errors.New("parameter advancedThreatProtectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{advancedThreatProtectionName}", url.PathEscape(string(advancedThreatProtectionName))) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// Get - Get a managed instance's Advanced Threat Protection state. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-11-01-preview +// - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure +// Resource Manager API or the portal. +// - managedInstanceName - The name of the managed instance. +// - advancedThreatProtectionName - The name of the Advanced Threat Protection state. +// - options - ManagedInstanceAdvancedThreatProtectionSettingsClientGetOptions contains the optional parameters for the ManagedInstanceAdvancedThreatProtectionSettingsClient.Get +// method. +func (client *ManagedInstanceAdvancedThreatProtectionSettingsClient) Get(ctx context.Context, resourceGroupName string, managedInstanceName string, advancedThreatProtectionName AdvancedThreatProtectionName, options *ManagedInstanceAdvancedThreatProtectionSettingsClientGetOptions) (ManagedInstanceAdvancedThreatProtectionSettingsClientGetResponse, error) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, managedInstanceName, advancedThreatProtectionName, options) + if err != nil { + return ManagedInstanceAdvancedThreatProtectionSettingsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ManagedInstanceAdvancedThreatProtectionSettingsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ManagedInstanceAdvancedThreatProtectionSettingsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *ManagedInstanceAdvancedThreatProtectionSettingsClient) getCreateRequest(ctx context.Context, resourceGroupName string, managedInstanceName string, advancedThreatProtectionName AdvancedThreatProtectionName, options *ManagedInstanceAdvancedThreatProtectionSettingsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/advancedThreatProtectionSettings/{advancedThreatProtectionName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if managedInstanceName == "" { + return nil, errors.New("parameter managedInstanceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{managedInstanceName}", url.PathEscape(managedInstanceName)) + if advancedThreatProtectionName == "" { + return nil, errors.New("parameter advancedThreatProtectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{advancedThreatProtectionName}", url.PathEscape(string(advancedThreatProtectionName))) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *ManagedInstanceAdvancedThreatProtectionSettingsClient) getHandleResponse(resp *http.Response) (ManagedInstanceAdvancedThreatProtectionSettingsClientGetResponse, error) { + result := ManagedInstanceAdvancedThreatProtectionSettingsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ManagedInstanceAdvancedThreatProtection); err != nil { + return ManagedInstanceAdvancedThreatProtectionSettingsClientGetResponse{}, err + } + return result, nil +} + +// NewListByInstancePager - Get the managed instance's Advanced Threat Protection settings. +// +// Generated from API version 2022-11-01-preview +// - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure +// Resource Manager API or the portal. +// - managedInstanceName - The name of the managed instance. +// - options - ManagedInstanceAdvancedThreatProtectionSettingsClientListByInstanceOptions contains the optional parameters for +// the ManagedInstanceAdvancedThreatProtectionSettingsClient.NewListByInstancePager method. +func (client *ManagedInstanceAdvancedThreatProtectionSettingsClient) NewListByInstancePager(resourceGroupName string, managedInstanceName string, options *ManagedInstanceAdvancedThreatProtectionSettingsClientListByInstanceOptions) *runtime.Pager[ManagedInstanceAdvancedThreatProtectionSettingsClientListByInstanceResponse] { + return runtime.NewPager(runtime.PagingHandler[ManagedInstanceAdvancedThreatProtectionSettingsClientListByInstanceResponse]{ + More: func(page ManagedInstanceAdvancedThreatProtectionSettingsClientListByInstanceResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ManagedInstanceAdvancedThreatProtectionSettingsClientListByInstanceResponse) (ManagedInstanceAdvancedThreatProtectionSettingsClientListByInstanceResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByInstanceCreateRequest(ctx, resourceGroupName, managedInstanceName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ManagedInstanceAdvancedThreatProtectionSettingsClientListByInstanceResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ManagedInstanceAdvancedThreatProtectionSettingsClientListByInstanceResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ManagedInstanceAdvancedThreatProtectionSettingsClientListByInstanceResponse{}, runtime.NewResponseError(resp) + } + return client.listByInstanceHandleResponse(resp) + }, + }) +} + +// listByInstanceCreateRequest creates the ListByInstance request. +func (client *ManagedInstanceAdvancedThreatProtectionSettingsClient) listByInstanceCreateRequest(ctx context.Context, resourceGroupName string, managedInstanceName string, options *ManagedInstanceAdvancedThreatProtectionSettingsClientListByInstanceOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/advancedThreatProtectionSettings" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if managedInstanceName == "" { + return nil, errors.New("parameter managedInstanceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{managedInstanceName}", url.PathEscape(managedInstanceName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByInstanceHandleResponse handles the ListByInstance response. +func (client *ManagedInstanceAdvancedThreatProtectionSettingsClient) listByInstanceHandleResponse(resp *http.Response) (ManagedInstanceAdvancedThreatProtectionSettingsClientListByInstanceResponse, error) { + result := ManagedInstanceAdvancedThreatProtectionSettingsClientListByInstanceResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ManagedInstanceAdvancedThreatProtectionListResult); err != nil { + return ManagedInstanceAdvancedThreatProtectionSettingsClientListByInstanceResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/sql/armsql/managedinstanceazureadonlyauthentications_client.go b/sdk/resourcemanager/sql/armsql/managedinstanceazureadonlyauthentications_client.go index 53649df07c2d..f3f8fb498df5 100644 --- a/sdk/resourcemanager/sql/armsql/managedinstanceazureadonlyauthentications_client.go +++ b/sdk/resourcemanager/sql/armsql/managedinstanceazureadonlyauthentications_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armsql @@ -48,7 +47,7 @@ func NewManagedInstanceAzureADOnlyAuthenticationsClient(subscriptionID string, c // only authentication property. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - managedInstanceName - The name of the managed instance. @@ -62,7 +61,8 @@ func (client *ManagedInstanceAzureADOnlyAuthenticationsClient) BeginCreateOrUpda if err != nil { return nil, err } - return runtime.NewPoller[ManagedInstanceAzureADOnlyAuthenticationsClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[ManagedInstanceAzureADOnlyAuthenticationsClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[ManagedInstanceAzureADOnlyAuthenticationsClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -72,20 +72,22 @@ func (client *ManagedInstanceAzureADOnlyAuthenticationsClient) BeginCreateOrUpda // only authentication property. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview func (client *ManagedInstanceAzureADOnlyAuthenticationsClient) createOrUpdate(ctx context.Context, resourceGroupName string, managedInstanceName string, authenticationName AuthenticationName, parameters ManagedInstanceAzureADOnlyAuthentication, options *ManagedInstanceAzureADOnlyAuthenticationsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, managedInstanceName, authenticationName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createOrUpdateCreateRequest creates the CreateOrUpdate request. @@ -112,16 +114,19 @@ func (client *ManagedInstanceAzureADOnlyAuthenticationsClient) createOrUpdateCre return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // BeginDelete - Deletes an existing server Active Directory only authentication property. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - managedInstanceName - The name of the managed instance. @@ -134,7 +139,8 @@ func (client *ManagedInstanceAzureADOnlyAuthenticationsClient) BeginDelete(ctx c if err != nil { return nil, err } - return runtime.NewPoller[ManagedInstanceAzureADOnlyAuthenticationsClientDeleteResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[ManagedInstanceAzureADOnlyAuthenticationsClientDeleteResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[ManagedInstanceAzureADOnlyAuthenticationsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -143,20 +149,22 @@ func (client *ManagedInstanceAzureADOnlyAuthenticationsClient) BeginDelete(ctx c // Delete - Deletes an existing server Active Directory only authentication property. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview func (client *ManagedInstanceAzureADOnlyAuthenticationsClient) deleteOperation(ctx context.Context, resourceGroupName string, managedInstanceName string, authenticationName AuthenticationName, options *ManagedInstanceAzureADOnlyAuthenticationsClientBeginDeleteOptions) (*http.Response, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, managedInstanceName, authenticationName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteCreateRequest creates the Delete request. @@ -183,7 +191,7 @@ func (client *ManagedInstanceAzureADOnlyAuthenticationsClient) deleteCreateReque return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -191,7 +199,7 @@ func (client *ManagedInstanceAzureADOnlyAuthenticationsClient) deleteCreateReque // Get - Gets a specific Azure Active Directory only authentication property. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - managedInstanceName - The name of the managed instance. @@ -199,18 +207,21 @@ func (client *ManagedInstanceAzureADOnlyAuthenticationsClient) deleteCreateReque // - options - ManagedInstanceAzureADOnlyAuthenticationsClientGetOptions contains the optional parameters for the ManagedInstanceAzureADOnlyAuthenticationsClient.Get // method. func (client *ManagedInstanceAzureADOnlyAuthenticationsClient) Get(ctx context.Context, resourceGroupName string, managedInstanceName string, authenticationName AuthenticationName, options *ManagedInstanceAzureADOnlyAuthenticationsClientGetOptions) (ManagedInstanceAzureADOnlyAuthenticationsClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, managedInstanceName, authenticationName, options) if err != nil { return ManagedInstanceAzureADOnlyAuthenticationsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ManagedInstanceAzureADOnlyAuthenticationsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ManagedInstanceAzureADOnlyAuthenticationsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ManagedInstanceAzureADOnlyAuthenticationsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -237,7 +248,7 @@ func (client *ManagedInstanceAzureADOnlyAuthenticationsClient) getCreateRequest( return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -254,7 +265,7 @@ func (client *ManagedInstanceAzureADOnlyAuthenticationsClient) getHandleResponse // NewListByInstancePager - Gets a list of server Azure Active Directory only authentications. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - managedInstanceName - The name of the managed instance. @@ -308,7 +319,7 @@ func (client *ManagedInstanceAzureADOnlyAuthenticationsClient) listByInstanceCre return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/sql/armsql/managedinstanceazureadonlyauthentications_client_example_test.go b/sdk/resourcemanager/sql/armsql/managedinstanceazureadonlyauthentications_client_example_test.go deleted file mode 100644 index f3c1eb7c2e6d..000000000000 --- a/sdk/resourcemanager/sql/armsql/managedinstanceazureadonlyauthentications_client_example_test.go +++ /dev/null @@ -1,140 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsql_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sql/armsql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceAzureADOnlyAuthGet.json -func ExampleManagedInstanceAzureADOnlyAuthenticationsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewManagedInstanceAzureADOnlyAuthenticationsClient().Get(ctx, "Default-SQL-SouthEastAsia", "managedInstance", armsql.AuthenticationNameDefault, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ManagedInstanceAzureADOnlyAuthentication = armsql.ManagedInstanceAzureADOnlyAuthentication{ - // Name: to.Ptr("Default"), - // Type: to.Ptr("Microsoft.Sql/managedInstances/azureadonlyauthentications"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/azureADOnlyAuthentications/providers/Microsoft.Sql/managedInstances/managedInstance/azureadonlyauthentications/default"), - // Properties: &armsql.ManagedInstanceAzureADOnlyAuthProperties{ - // AzureADOnlyAuthentication: to.Ptr(true), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceAzureADOnlyAuthCreateOrUpdate.json -func ExampleManagedInstanceAzureADOnlyAuthenticationsClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewManagedInstanceAzureADOnlyAuthenticationsClient().BeginCreateOrUpdate(ctx, "Default-SQL-SouthEastAsia", "managedInstance", armsql.AuthenticationNameDefault, armsql.ManagedInstanceAzureADOnlyAuthentication{ - Properties: &armsql.ManagedInstanceAzureADOnlyAuthProperties{ - AzureADOnlyAuthentication: to.Ptr(false), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ManagedInstanceAzureADOnlyAuthentication = armsql.ManagedInstanceAzureADOnlyAuthentication{ - // Name: to.Ptr("Default"), - // Type: to.Ptr("Microsoft.Sql/managedInstances/azureadonlyauthentications"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/azureADOnlyAuthentications/providers/Microsoft.Sql/managedInstances/managedInstance/azureadonlyauthentications/default"), - // Properties: &armsql.ManagedInstanceAzureADOnlyAuthProperties{ - // AzureADOnlyAuthentication: to.Ptr(false), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceAzureADOnlyAuthDelete.json -func ExampleManagedInstanceAzureADOnlyAuthenticationsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewManagedInstanceAzureADOnlyAuthenticationsClient().BeginDelete(ctx, "Default-SQL-SouthEastAsia", "managedInstance", armsql.AuthenticationNameDefault, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceAzureADOnlyAuthListByInstance.json -func ExampleManagedInstanceAzureADOnlyAuthenticationsClient_NewListByInstancePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewManagedInstanceAzureADOnlyAuthenticationsClient().NewListByInstancePager("Default-SQL-SouthEastAsia", "managedInstance", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ManagedInstanceAzureADOnlyAuthListResult = armsql.ManagedInstanceAzureADOnlyAuthListResult{ - // Value: []*armsql.ManagedInstanceAzureADOnlyAuthentication{ - // { - // Name: to.Ptr("Default"), - // Type: to.Ptr("Microsoft.Sql/managedInstances/azureadonlyauthentications"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/azureADOnlyAuthentications/providers/Microsoft.Sql/managedInstances/managedInstance/azureadonlyauthentications/default"), - // Properties: &armsql.ManagedInstanceAzureADOnlyAuthProperties{ - // AzureADOnlyAuthentication: to.Ptr(true), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/sql/armsql/managedinstancedtcs_client.go b/sdk/resourcemanager/sql/armsql/managedinstancedtcs_client.go new file mode 100644 index 000000000000..c7129448d29c --- /dev/null +++ b/sdk/resourcemanager/sql/armsql/managedinstancedtcs_client.go @@ -0,0 +1,259 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armsql + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// ManagedInstanceDtcsClient contains the methods for the ManagedInstanceDtcs group. +// Don't use this type directly, use NewManagedInstanceDtcsClient() instead. +type ManagedInstanceDtcsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewManagedInstanceDtcsClient creates a new instance of ManagedInstanceDtcsClient with the specified values. +// - subscriptionID - The subscription ID that identifies an Azure subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewManagedInstanceDtcsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ManagedInstanceDtcsClient, error) { + cl, err := arm.NewClient(moduleName+".ManagedInstanceDtcsClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ManagedInstanceDtcsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreateOrUpdate - Updates managed instance DTC settings. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-11-01-preview +// - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure +// Resource Manager API or the portal. +// - managedInstanceName - The name of the managed instance. +// - dtcName - The name of the managed instance DTC. +// - parameters - Managed instance DTC settings. +// - options - ManagedInstanceDtcsClientBeginCreateOrUpdateOptions contains the optional parameters for the ManagedInstanceDtcsClient.BeginCreateOrUpdate +// method. +func (client *ManagedInstanceDtcsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, managedInstanceName string, dtcName DtcName, parameters ManagedInstanceDtc, options *ManagedInstanceDtcsClientBeginCreateOrUpdateOptions) (*runtime.Poller[ManagedInstanceDtcsClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, managedInstanceName, dtcName, parameters, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller[ManagedInstanceDtcsClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[ManagedInstanceDtcsClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// CreateOrUpdate - Updates managed instance DTC settings. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-11-01-preview +func (client *ManagedInstanceDtcsClient) createOrUpdate(ctx context.Context, resourceGroupName string, managedInstanceName string, dtcName DtcName, parameters ManagedInstanceDtc, options *ManagedInstanceDtcsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, managedInstanceName, dtcName, parameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *ManagedInstanceDtcsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, managedInstanceName string, dtcName DtcName, parameters ManagedInstanceDtc, options *ManagedInstanceDtcsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/dtc/{dtcName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if managedInstanceName == "" { + return nil, errors.New("parameter managedInstanceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{managedInstanceName}", url.PathEscape(managedInstanceName)) + if dtcName == "" { + return nil, errors.New("parameter dtcName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{dtcName}", url.PathEscape(string(dtcName))) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// Get - Gets managed instance DTC settings. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-11-01-preview +// - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure +// Resource Manager API or the portal. +// - managedInstanceName - The name of the managed instance. +// - dtcName - The name of the managed instance DTC. +// - options - ManagedInstanceDtcsClientGetOptions contains the optional parameters for the ManagedInstanceDtcsClient.Get method. +func (client *ManagedInstanceDtcsClient) Get(ctx context.Context, resourceGroupName string, managedInstanceName string, dtcName DtcName, options *ManagedInstanceDtcsClientGetOptions) (ManagedInstanceDtcsClientGetResponse, error) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, managedInstanceName, dtcName, options) + if err != nil { + return ManagedInstanceDtcsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ManagedInstanceDtcsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ManagedInstanceDtcsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *ManagedInstanceDtcsClient) getCreateRequest(ctx context.Context, resourceGroupName string, managedInstanceName string, dtcName DtcName, options *ManagedInstanceDtcsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/dtc/{dtcName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if managedInstanceName == "" { + return nil, errors.New("parameter managedInstanceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{managedInstanceName}", url.PathEscape(managedInstanceName)) + if dtcName == "" { + return nil, errors.New("parameter dtcName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{dtcName}", url.PathEscape(string(dtcName))) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *ManagedInstanceDtcsClient) getHandleResponse(resp *http.Response) (ManagedInstanceDtcsClientGetResponse, error) { + result := ManagedInstanceDtcsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ManagedInstanceDtc); err != nil { + return ManagedInstanceDtcsClientGetResponse{}, err + } + return result, nil +} + +// NewListByManagedInstancePager - Gets a list of managed instance DTC settings. +// +// Generated from API version 2022-11-01-preview +// - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure +// Resource Manager API or the portal. +// - managedInstanceName - The name of the managed instance. +// - options - ManagedInstanceDtcsClientListByManagedInstanceOptions contains the optional parameters for the ManagedInstanceDtcsClient.NewListByManagedInstancePager +// method. +func (client *ManagedInstanceDtcsClient) NewListByManagedInstancePager(resourceGroupName string, managedInstanceName string, options *ManagedInstanceDtcsClientListByManagedInstanceOptions) *runtime.Pager[ManagedInstanceDtcsClientListByManagedInstanceResponse] { + return runtime.NewPager(runtime.PagingHandler[ManagedInstanceDtcsClientListByManagedInstanceResponse]{ + More: func(page ManagedInstanceDtcsClientListByManagedInstanceResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ManagedInstanceDtcsClientListByManagedInstanceResponse) (ManagedInstanceDtcsClientListByManagedInstanceResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByManagedInstanceCreateRequest(ctx, resourceGroupName, managedInstanceName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ManagedInstanceDtcsClientListByManagedInstanceResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ManagedInstanceDtcsClientListByManagedInstanceResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ManagedInstanceDtcsClientListByManagedInstanceResponse{}, runtime.NewResponseError(resp) + } + return client.listByManagedInstanceHandleResponse(resp) + }, + }) +} + +// listByManagedInstanceCreateRequest creates the ListByManagedInstance request. +func (client *ManagedInstanceDtcsClient) listByManagedInstanceCreateRequest(ctx context.Context, resourceGroupName string, managedInstanceName string, options *ManagedInstanceDtcsClientListByManagedInstanceOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/dtc" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if managedInstanceName == "" { + return nil, errors.New("parameter managedInstanceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{managedInstanceName}", url.PathEscape(managedInstanceName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByManagedInstanceHandleResponse handles the ListByManagedInstance response. +func (client *ManagedInstanceDtcsClient) listByManagedInstanceHandleResponse(resp *http.Response) (ManagedInstanceDtcsClientListByManagedInstanceResponse, error) { + result := ManagedInstanceDtcsClientListByManagedInstanceResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ManagedInstanceDtcListResult); err != nil { + return ManagedInstanceDtcsClientListByManagedInstanceResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/sql/armsql/managedinstanceencryptionprotectors_client.go b/sdk/resourcemanager/sql/armsql/managedinstanceencryptionprotectors_client.go index 3443d556c4e7..7e4e00b8a647 100644 --- a/sdk/resourcemanager/sql/armsql/managedinstanceencryptionprotectors_client.go +++ b/sdk/resourcemanager/sql/armsql/managedinstanceencryptionprotectors_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armsql @@ -47,7 +46,7 @@ func NewManagedInstanceEncryptionProtectorsClient(subscriptionID string, credent // BeginCreateOrUpdate - Updates an existing encryption protector. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - managedInstanceName - The name of the managed instance. @@ -61,7 +60,8 @@ func (client *ManagedInstanceEncryptionProtectorsClient) BeginCreateOrUpdate(ctx if err != nil { return nil, err } - return runtime.NewPoller[ManagedInstanceEncryptionProtectorsClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[ManagedInstanceEncryptionProtectorsClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[ManagedInstanceEncryptionProtectorsClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -70,20 +70,22 @@ func (client *ManagedInstanceEncryptionProtectorsClient) BeginCreateOrUpdate(ctx // CreateOrUpdate - Updates an existing encryption protector. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview func (client *ManagedInstanceEncryptionProtectorsClient) createOrUpdate(ctx context.Context, resourceGroupName string, managedInstanceName string, encryptionProtectorName EncryptionProtectorName, parameters ManagedInstanceEncryptionProtector, options *ManagedInstanceEncryptionProtectorsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, managedInstanceName, encryptionProtectorName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createOrUpdateCreateRequest creates the CreateOrUpdate request. @@ -110,16 +112,19 @@ func (client *ManagedInstanceEncryptionProtectorsClient) createOrUpdateCreateReq return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // Get - Gets a managed instance encryption protector. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - managedInstanceName - The name of the managed instance. @@ -127,18 +132,21 @@ func (client *ManagedInstanceEncryptionProtectorsClient) createOrUpdateCreateReq // - options - ManagedInstanceEncryptionProtectorsClientGetOptions contains the optional parameters for the ManagedInstanceEncryptionProtectorsClient.Get // method. func (client *ManagedInstanceEncryptionProtectorsClient) Get(ctx context.Context, resourceGroupName string, managedInstanceName string, encryptionProtectorName EncryptionProtectorName, options *ManagedInstanceEncryptionProtectorsClientGetOptions) (ManagedInstanceEncryptionProtectorsClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, managedInstanceName, encryptionProtectorName, options) if err != nil { return ManagedInstanceEncryptionProtectorsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ManagedInstanceEncryptionProtectorsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ManagedInstanceEncryptionProtectorsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ManagedInstanceEncryptionProtectorsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -165,7 +173,7 @@ func (client *ManagedInstanceEncryptionProtectorsClient) getCreateRequest(ctx co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -182,7 +190,7 @@ func (client *ManagedInstanceEncryptionProtectorsClient) getHandleResponse(resp // NewListByInstancePager - Gets a list of managed instance encryption protectors // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - managedInstanceName - The name of the managed instance. @@ -236,7 +244,7 @@ func (client *ManagedInstanceEncryptionProtectorsClient) listByInstanceCreateReq return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -254,7 +262,7 @@ func (client *ManagedInstanceEncryptionProtectorsClient) listByInstanceHandleRes // BeginRevalidate - Revalidates an existing encryption protector. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - managedInstanceName - The name of the managed instance. @@ -267,7 +275,8 @@ func (client *ManagedInstanceEncryptionProtectorsClient) BeginRevalidate(ctx con if err != nil { return nil, err } - return runtime.NewPoller[ManagedInstanceEncryptionProtectorsClientRevalidateResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[ManagedInstanceEncryptionProtectorsClientRevalidateResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[ManagedInstanceEncryptionProtectorsClientRevalidateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -276,20 +285,22 @@ func (client *ManagedInstanceEncryptionProtectorsClient) BeginRevalidate(ctx con // Revalidate - Revalidates an existing encryption protector. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview func (client *ManagedInstanceEncryptionProtectorsClient) revalidate(ctx context.Context, resourceGroupName string, managedInstanceName string, encryptionProtectorName EncryptionProtectorName, options *ManagedInstanceEncryptionProtectorsClientBeginRevalidateOptions) (*http.Response, error) { + var err error req, err := client.revalidateCreateRequest(ctx, resourceGroupName, managedInstanceName, encryptionProtectorName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // revalidateCreateRequest creates the Revalidate request. @@ -316,7 +327,7 @@ func (client *ManagedInstanceEncryptionProtectorsClient) revalidateCreateRequest return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } diff --git a/sdk/resourcemanager/sql/armsql/managedinstanceencryptionprotectors_client_example_test.go b/sdk/resourcemanager/sql/armsql/managedinstanceencryptionprotectors_client_example_test.go deleted file mode 100644 index 0d3e72db8627..000000000000 --- a/sdk/resourcemanager/sql/armsql/managedinstanceencryptionprotectors_client_example_test.go +++ /dev/null @@ -1,190 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsql_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sql/armsql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceEncryptionProtectorRevalidate.json -func ExampleManagedInstanceEncryptionProtectorsClient_BeginRevalidate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewManagedInstanceEncryptionProtectorsClient().BeginRevalidate(ctx, "sqlcrudtest-7398", "sqlcrudtest-4645", armsql.EncryptionProtectorNameCurrent, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceEncryptionProtectorList.json -func ExampleManagedInstanceEncryptionProtectorsClient_NewListByInstancePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewManagedInstanceEncryptionProtectorsClient().NewListByInstancePager("sqlcrudtest-7398", "sqlcrudtest-4645", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ManagedInstanceEncryptionProtectorListResult = armsql.ManagedInstanceEncryptionProtectorListResult{ - // Value: []*armsql.ManagedInstanceEncryptionProtector{ - // { - // Name: to.Ptr("current"), - // Type: to.Ptr("Microsoft.Sql/managedInstances/encryptionProtector"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/sqlcrudtest-7398/providers/Microsoft.Sql/managedInstances/sqlcrudtest-4645/encryptionProtector/current"), - // Kind: to.Ptr("azurekeyvault"), - // Properties: &armsql.ManagedInstanceEncryptionProtectorProperties{ - // ServerKeyName: to.Ptr("someVault_someKey_01234567890123456789012345678901"), - // ServerKeyType: to.Ptr(armsql.ServerKeyTypeAzureKeyVault), - // URI: to.Ptr("https://someVault.vault.azure.net/keys/someKey/01234567890123456789012345678901"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceEncryptionProtectorGet.json -func ExampleManagedInstanceEncryptionProtectorsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewManagedInstanceEncryptionProtectorsClient().Get(ctx, "sqlcrudtest-7398", "sqlcrudtest-4645", armsql.EncryptionProtectorNameCurrent, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ManagedInstanceEncryptionProtector = armsql.ManagedInstanceEncryptionProtector{ - // Name: to.Ptr("current"), - // Type: to.Ptr("Microsoft.Sql/managedInstances/encryptionProtector"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/sqlcrudtest-7398/providers/Microsoft.Sql/managedInstances/sqlcrudtest-4645/encryptionProtector/current"), - // Kind: to.Ptr("azurekeyvault"), - // Properties: &armsql.ManagedInstanceEncryptionProtectorProperties{ - // ServerKeyName: to.Ptr("someVault_someKey_01234567890123456789012345678901"), - // ServerKeyType: to.Ptr(armsql.ServerKeyTypeAzureKeyVault), - // URI: to.Ptr("https://someVault.vault.azure.net/keys/someKey/01234567890123456789012345678901"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceEncryptionProtectorCreateOrUpdateKeyVault.json -func ExampleManagedInstanceEncryptionProtectorsClient_BeginCreateOrUpdate_updateTheEncryptionProtectorToKeyVault() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewManagedInstanceEncryptionProtectorsClient().BeginCreateOrUpdate(ctx, "sqlcrudtest-7398", "sqlcrudtest-4645", armsql.EncryptionProtectorNameCurrent, armsql.ManagedInstanceEncryptionProtector{ - Properties: &armsql.ManagedInstanceEncryptionProtectorProperties{ - AutoRotationEnabled: to.Ptr(false), - ServerKeyName: to.Ptr("someVault_someKey_01234567890123456789012345678901"), - ServerKeyType: to.Ptr(armsql.ServerKeyTypeAzureKeyVault), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ManagedInstanceEncryptionProtector = armsql.ManagedInstanceEncryptionProtector{ - // Name: to.Ptr("current"), - // Type: to.Ptr("Microsoft.Sql/managedInstances/encryptionProtector"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/sqlcrudtest-7398/providers/Microsoft.Sql/managedInstances/sqlcrudtest-4645/encryptionProtector/current"), - // Kind: to.Ptr("azurekeyvault"), - // Properties: &armsql.ManagedInstanceEncryptionProtectorProperties{ - // AutoRotationEnabled: to.Ptr(false), - // ServerKeyName: to.Ptr("someVault_someKey_01234567890123456789012345678901"), - // ServerKeyType: to.Ptr(armsql.ServerKeyTypeAzureKeyVault), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceEncryptionProtectorCreateOrUpdateServiceManaged.json -func ExampleManagedInstanceEncryptionProtectorsClient_BeginCreateOrUpdate_updateTheEncryptionProtectorToServiceManaged() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewManagedInstanceEncryptionProtectorsClient().BeginCreateOrUpdate(ctx, "sqlcrudtest-7398", "sqlcrudtest-4645", armsql.EncryptionProtectorNameCurrent, armsql.ManagedInstanceEncryptionProtector{ - Properties: &armsql.ManagedInstanceEncryptionProtectorProperties{ - ServerKeyName: to.Ptr("ServiceManaged"), - ServerKeyType: to.Ptr(armsql.ServerKeyTypeServiceManaged), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ManagedInstanceEncryptionProtector = armsql.ManagedInstanceEncryptionProtector{ - // Name: to.Ptr("current"), - // Type: to.Ptr("Microsoft.Sql/managedInstances/encryptionProtector"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/sqlcrudtest-7398/providers/Microsoft.Sql/managedInstances/sqlcrudtest-4645/encryptionProtector/current"), - // Kind: to.Ptr("servicemanaged"), - // Properties: &armsql.ManagedInstanceEncryptionProtectorProperties{ - // ServerKeyName: to.Ptr("ServiceManaged"), - // ServerKeyType: to.Ptr(armsql.ServerKeyTypeServiceManaged), - // }, - // } -} diff --git a/sdk/resourcemanager/sql/armsql/managedinstancekeys_client.go b/sdk/resourcemanager/sql/armsql/managedinstancekeys_client.go index 0e8200e122af..834b04fddfab 100644 --- a/sdk/resourcemanager/sql/armsql/managedinstancekeys_client.go +++ b/sdk/resourcemanager/sql/armsql/managedinstancekeys_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armsql @@ -47,7 +46,7 @@ func NewManagedInstanceKeysClient(subscriptionID string, credential azcore.Token // BeginCreateOrUpdate - Creates or updates a managed instance key. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - managedInstanceName - The name of the managed instance. @@ -61,7 +60,8 @@ func (client *ManagedInstanceKeysClient) BeginCreateOrUpdate(ctx context.Context if err != nil { return nil, err } - return runtime.NewPoller[ManagedInstanceKeysClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[ManagedInstanceKeysClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[ManagedInstanceKeysClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -70,20 +70,22 @@ func (client *ManagedInstanceKeysClient) BeginCreateOrUpdate(ctx context.Context // CreateOrUpdate - Creates or updates a managed instance key. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview func (client *ManagedInstanceKeysClient) createOrUpdate(ctx context.Context, resourceGroupName string, managedInstanceName string, keyName string, parameters ManagedInstanceKey, options *ManagedInstanceKeysClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, managedInstanceName, keyName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createOrUpdateCreateRequest creates the CreateOrUpdate request. @@ -110,16 +112,19 @@ func (client *ManagedInstanceKeysClient) createOrUpdateCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // BeginDelete - Deletes the managed instance key with the given name. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - managedInstanceName - The name of the managed instance. @@ -132,7 +137,8 @@ func (client *ManagedInstanceKeysClient) BeginDelete(ctx context.Context, resour if err != nil { return nil, err } - return runtime.NewPoller[ManagedInstanceKeysClientDeleteResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[ManagedInstanceKeysClientDeleteResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[ManagedInstanceKeysClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -141,20 +147,22 @@ func (client *ManagedInstanceKeysClient) BeginDelete(ctx context.Context, resour // Delete - Deletes the managed instance key with the given name. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview func (client *ManagedInstanceKeysClient) deleteOperation(ctx context.Context, resourceGroupName string, managedInstanceName string, keyName string, options *ManagedInstanceKeysClientBeginDeleteOptions) (*http.Response, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, managedInstanceName, keyName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteCreateRequest creates the Delete request. @@ -181,7 +189,7 @@ func (client *ManagedInstanceKeysClient) deleteCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -189,25 +197,28 @@ func (client *ManagedInstanceKeysClient) deleteCreateRequest(ctx context.Context // Get - Gets a managed instance key. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - managedInstanceName - The name of the managed instance. // - keyName - The name of the managed instance key to be retrieved. // - options - ManagedInstanceKeysClientGetOptions contains the optional parameters for the ManagedInstanceKeysClient.Get method. func (client *ManagedInstanceKeysClient) Get(ctx context.Context, resourceGroupName string, managedInstanceName string, keyName string, options *ManagedInstanceKeysClientGetOptions) (ManagedInstanceKeysClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, managedInstanceName, keyName, options) if err != nil { return ManagedInstanceKeysClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ManagedInstanceKeysClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ManagedInstanceKeysClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ManagedInstanceKeysClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -234,7 +245,7 @@ func (client *ManagedInstanceKeysClient) getCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -251,7 +262,7 @@ func (client *ManagedInstanceKeysClient) getHandleResponse(resp *http.Response) // NewListByInstancePager - Gets a list of managed instance keys. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - managedInstanceName - The name of the managed instance. @@ -308,7 +319,7 @@ func (client *ManagedInstanceKeysClient) listByInstanceCreateRequest(ctx context if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/sql/armsql/managedinstancekeys_client_example_test.go b/sdk/resourcemanager/sql/armsql/managedinstancekeys_client_example_test.go deleted file mode 100644 index ecb628d09628..000000000000 --- a/sdk/resourcemanager/sql/armsql/managedinstancekeys_client_example_test.go +++ /dev/null @@ -1,169 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsql_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sql/armsql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceKeyList.json -func ExampleManagedInstanceKeysClient_NewListByInstancePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewManagedInstanceKeysClient().NewListByInstancePager("sqlcrudtest-7398", "sqlcrudtest-4645", &armsql.ManagedInstanceKeysClientListByInstanceOptions{Filter: nil}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ManagedInstanceKeyListResult = armsql.ManagedInstanceKeyListResult{ - // Value: []*armsql.ManagedInstanceKey{ - // { - // Name: to.Ptr("someVault_someKey_01234567890123456789012345678901"), - // Type: to.Ptr("Microsoft.Sql/managedInstances/keys"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/sqlcrudtest-7398/providers/Microsoft.Sql/managedInstances/sqlcrudtest-4645/keys/someVault_someKey_01234567890123456789012345678901"), - // Kind: to.Ptr("azurekeyvault"), - // Properties: &armsql.ManagedInstanceKeyProperties{ - // AutoRotationEnabled: to.Ptr(false), - // CreationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-15T00:00:00Z"); return t}()), - // Thumbprint: to.Ptr("00112233445566778899AABBCCDDEEFFAABBCCDD"), - // }, - // }, - // { - // Name: to.Ptr("myVault_myKey_11111111111111111111111111111111"), - // Type: to.Ptr("Microsoft.Sql/managedInstances/keys"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/sqlcrudtest-7398/providers/Microsoft.Sql/managedInstances/sqlcrudtest-4645/keys/myVault_myKey_11111111111111111111111111111111"), - // Kind: to.Ptr("azurekeyvault"), - // Properties: &armsql.ManagedInstanceKeyProperties{ - // AutoRotationEnabled: to.Ptr(false), - // CreationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-15T00:00:00Z"); return t}()), - // Thumbprint: to.Ptr("AAAAAAAAAAAAAAABBBBBBBBBBBBBBBBBBBBBBBBB"), - // }, - // }, - // { - // Name: to.Ptr("ServiceManaged"), - // Type: to.Ptr("Microsoft.Sql/managedInstances/keys"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/sqlcrudtest-7398/providers/Microsoft.Sql/managedInstances/sqlcrudtest-4645/keys/ServiceManaged"), - // Kind: to.Ptr("servicemanaged"), - // Properties: &armsql.ManagedInstanceKeyProperties{ - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceKeyGet.json -func ExampleManagedInstanceKeysClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewManagedInstanceKeysClient().Get(ctx, "sqlcrudtest-7398", "sqlcrudtest-4645", "someVault_someKey_01234567890123456789012345678901", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ManagedInstanceKey = armsql.ManagedInstanceKey{ - // Name: to.Ptr("sqlcrudtest-4645"), - // Type: to.Ptr("Microsoft.Sql/managedInstances/keys"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/sqlcrudtest-7398/providers/Microsoft.Sql/managedInstances/sqlcrudtest-4645/keys/someVault_someKey_01234567890123456789012345678901"), - // Kind: to.Ptr("azurekeyvault"), - // Properties: &armsql.ManagedInstanceKeyProperties{ - // AutoRotationEnabled: to.Ptr(false), - // CreationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-01T00:00:00Z"); return t}()), - // Thumbprint: to.Ptr("00112233445566778899AABBCCDDEEFFAABBCCDD"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceKeyCreateOrUpdate.json -func ExampleManagedInstanceKeysClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewManagedInstanceKeysClient().BeginCreateOrUpdate(ctx, "sqlcrudtest-7398", "sqlcrudtest-4645", "someVault_someKey_01234567890123456789012345678901", armsql.ManagedInstanceKey{ - Properties: &armsql.ManagedInstanceKeyProperties{ - ServerKeyType: to.Ptr(armsql.ServerKeyTypeAzureKeyVault), - URI: to.Ptr("https://someVault.vault.azure.net/keys/someKey/01234567890123456789012345678901"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ManagedInstanceKey = armsql.ManagedInstanceKey{ - // Name: to.Ptr("sqlcrudtest-4645"), - // Type: to.Ptr("Microsoft.Sql/managedInstances/keys"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/sqlcrudtest-7398/providers/Microsoft.Sql/managedInstances/sqlcrudtest-4645/keys/someVault_someKey_01234567890123456789012345678901"), - // Kind: to.Ptr("azurekeyvault"), - // Properties: &armsql.ManagedInstanceKeyProperties{ - // AutoRotationEnabled: to.Ptr(false), - // CreationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-01T00:00:00Z"); return t}()), - // Thumbprint: to.Ptr("00112233445566778899AABBCCDDEEFFAABBCCDD"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceKeyDelete.json -func ExampleManagedInstanceKeysClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewManagedInstanceKeysClient().BeginDelete(ctx, "sqlcrudtest-7398", "sqlcrudtest-4645", "someVault_someKey_01234567890123456789012345678901", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} diff --git a/sdk/resourcemanager/sql/armsql/managedinstancelongtermretentionpolicies_client.go b/sdk/resourcemanager/sql/armsql/managedinstancelongtermretentionpolicies_client.go index 3755f2aeb408..03fdde977702 100644 --- a/sdk/resourcemanager/sql/armsql/managedinstancelongtermretentionpolicies_client.go +++ b/sdk/resourcemanager/sql/armsql/managedinstancelongtermretentionpolicies_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armsql @@ -47,7 +46,7 @@ func NewManagedInstanceLongTermRetentionPoliciesClient(subscriptionID string, cr // BeginCreateOrUpdate - Sets a managed database's long term retention policy. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - managedInstanceName - The name of the managed instance. @@ -62,7 +61,8 @@ func (client *ManagedInstanceLongTermRetentionPoliciesClient) BeginCreateOrUpdat if err != nil { return nil, err } - return runtime.NewPoller[ManagedInstanceLongTermRetentionPoliciesClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[ManagedInstanceLongTermRetentionPoliciesClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[ManagedInstanceLongTermRetentionPoliciesClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -71,20 +71,22 @@ func (client *ManagedInstanceLongTermRetentionPoliciesClient) BeginCreateOrUpdat // CreateOrUpdate - Sets a managed database's long term retention policy. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview func (client *ManagedInstanceLongTermRetentionPoliciesClient) createOrUpdate(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, policyName ManagedInstanceLongTermRetentionPolicyName, parameters ManagedInstanceLongTermRetentionPolicy, options *ManagedInstanceLongTermRetentionPoliciesClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, managedInstanceName, databaseName, policyName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createOrUpdateCreateRequest creates the CreateOrUpdate request. @@ -115,16 +117,98 @@ func (client *ManagedInstanceLongTermRetentionPoliciesClient) createOrUpdateCrea return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Deletes a managed database's long term retention policy. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-11-01-preview +// - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure +// Resource Manager API or the portal. +// - managedInstanceName - The name of the managed instance. +// - databaseName - The name of the database. +// - policyName - The policy name. Should always be Default. +// - options - ManagedInstanceLongTermRetentionPoliciesClientBeginDeleteOptions contains the optional parameters for the ManagedInstanceLongTermRetentionPoliciesClient.BeginDelete +// method. +func (client *ManagedInstanceLongTermRetentionPoliciesClient) BeginDelete(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, policyName ManagedInstanceLongTermRetentionPolicyName, options *ManagedInstanceLongTermRetentionPoliciesClientBeginDeleteOptions) (*runtime.Poller[ManagedInstanceLongTermRetentionPoliciesClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, managedInstanceName, databaseName, policyName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller[ManagedInstanceLongTermRetentionPoliciesClientDeleteResponse](resp, client.internal.Pipeline(), nil) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[ManagedInstanceLongTermRetentionPoliciesClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Delete - Deletes a managed database's long term retention policy. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-11-01-preview +func (client *ManagedInstanceLongTermRetentionPoliciesClient) deleteOperation(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, policyName ManagedInstanceLongTermRetentionPolicyName, options *ManagedInstanceLongTermRetentionPoliciesClientBeginDeleteOptions) (*http.Response, error) { + var err error + req, err := client.deleteCreateRequest(ctx, resourceGroupName, managedInstanceName, databaseName, policyName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *ManagedInstanceLongTermRetentionPoliciesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, policyName ManagedInstanceLongTermRetentionPolicyName, options *ManagedInstanceLongTermRetentionPoliciesClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/backupLongTermRetentionPolicies/{policyName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if managedInstanceName == "" { + return nil, errors.New("parameter managedInstanceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{managedInstanceName}", url.PathEscape(managedInstanceName)) + if databaseName == "" { + return nil, errors.New("parameter databaseName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{databaseName}", url.PathEscape(databaseName)) + if policyName == "" { + return nil, errors.New("parameter policyName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{policyName}", url.PathEscape(string(policyName))) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil } // Get - Gets a managed database's long term retention policy. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - managedInstanceName - The name of the managed instance. @@ -133,18 +217,21 @@ func (client *ManagedInstanceLongTermRetentionPoliciesClient) createOrUpdateCrea // - options - ManagedInstanceLongTermRetentionPoliciesClientGetOptions contains the optional parameters for the ManagedInstanceLongTermRetentionPoliciesClient.Get // method. func (client *ManagedInstanceLongTermRetentionPoliciesClient) Get(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, policyName ManagedInstanceLongTermRetentionPolicyName, options *ManagedInstanceLongTermRetentionPoliciesClientGetOptions) (ManagedInstanceLongTermRetentionPoliciesClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, managedInstanceName, databaseName, policyName, options) if err != nil { return ManagedInstanceLongTermRetentionPoliciesClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ManagedInstanceLongTermRetentionPoliciesClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ManagedInstanceLongTermRetentionPoliciesClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ManagedInstanceLongTermRetentionPoliciesClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -175,7 +262,7 @@ func (client *ManagedInstanceLongTermRetentionPoliciesClient) getCreateRequest(c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -192,7 +279,7 @@ func (client *ManagedInstanceLongTermRetentionPoliciesClient) getHandleResponse( // NewListByDatabasePager - Gets a database's long term retention policy. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - managedInstanceName - The name of the managed instance. @@ -251,7 +338,7 @@ func (client *ManagedInstanceLongTermRetentionPoliciesClient) listByDatabaseCrea return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/sql/armsql/managedinstancelongtermretentionpolicies_client_example_test.go b/sdk/resourcemanager/sql/armsql/managedinstancelongtermretentionpolicies_client_example_test.go deleted file mode 100644 index 40fea7558d51..000000000000 --- a/sdk/resourcemanager/sql/armsql/managedinstancelongtermretentionpolicies_client_example_test.go +++ /dev/null @@ -1,131 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsql_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sql/armsql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceLongTermRetentionPolicyGet.json -func ExampleManagedInstanceLongTermRetentionPoliciesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewManagedInstanceLongTermRetentionPoliciesClient().Get(ctx, "testResourceGroup", "testInstance", "testDatabase", armsql.ManagedInstanceLongTermRetentionPolicyNameDefault, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ManagedInstanceLongTermRetentionPolicy = armsql.ManagedInstanceLongTermRetentionPolicy{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.Sql/resourceGroups/managedInstances/databases/backupLongTermRetentionPolicies"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/providers/Microsoft.Sql/resourceGroups/testResourceGroup/managedInstances/testInstance/databases/testDatabase/backupLongTermRetentionPolicies/default"), - // Properties: &armsql.BaseLongTermRetentionPolicyProperties{ - // MonthlyRetention: to.Ptr("P1Y"), - // WeekOfYear: to.Ptr[int32](5), - // WeeklyRetention: to.Ptr("P1M"), - // YearlyRetention: to.Ptr("P5Y"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceLongTermRetentionPolicyCreateOrUpdate.json -func ExampleManagedInstanceLongTermRetentionPoliciesClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewManagedInstanceLongTermRetentionPoliciesClient().BeginCreateOrUpdate(ctx, "testResourceGroup", "testInstance", "testDatabase", armsql.ManagedInstanceLongTermRetentionPolicyNameDefault, armsql.ManagedInstanceLongTermRetentionPolicy{ - Properties: &armsql.BaseLongTermRetentionPolicyProperties{ - MonthlyRetention: to.Ptr("P1Y"), - WeekOfYear: to.Ptr[int32](5), - WeeklyRetention: to.Ptr("P1M"), - YearlyRetention: to.Ptr("P5Y"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ManagedInstanceLongTermRetentionPolicy = armsql.ManagedInstanceLongTermRetentionPolicy{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.Sql/resourceGroups/managedInstances/databases/backupLongTermRetentionPolicies"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testResourceGroup/providers/Microsoft.Sql/managedInstances/testInstance/databases/testDatabase/backupLongTermRetentionPolicies/default"), - // Properties: &armsql.BaseLongTermRetentionPolicyProperties{ - // MonthlyRetention: to.Ptr("P1Y"), - // WeekOfYear: to.Ptr[int32](5), - // WeeklyRetention: to.Ptr("P1M"), - // YearlyRetention: to.Ptr("P5Y"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceLongTermRetentionPolicyListByDatabase.json -func ExampleManagedInstanceLongTermRetentionPoliciesClient_NewListByDatabasePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewManagedInstanceLongTermRetentionPoliciesClient().NewListByDatabasePager("testResourceGroup", "testInstance", "testDatabase", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ManagedInstanceLongTermRetentionPolicyListResult = armsql.ManagedInstanceLongTermRetentionPolicyListResult{ - // Value: []*armsql.ManagedInstanceLongTermRetentionPolicy{ - // { - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.Sql/resourceGroups/managedInstances/databases/backupLongTermRetentionPolicies"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testResourceGroup/providers/Microsoft.Sql/managedInstances/testInstance/databases/testDatabase/backupLongTermRetentionPolicies/default"), - // Properties: &armsql.BaseLongTermRetentionPolicyProperties{ - // MonthlyRetention: to.Ptr("P1Y"), - // WeekOfYear: to.Ptr[int32](5), - // WeeklyRetention: to.Ptr("P1M"), - // YearlyRetention: to.Ptr("P5Y"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/sql/armsql/managedinstanceoperations_client.go b/sdk/resourcemanager/sql/armsql/managedinstanceoperations_client.go index 2d1188dbe842..dfe5ae52cb6b 100644 --- a/sdk/resourcemanager/sql/armsql/managedinstanceoperations_client.go +++ b/sdk/resourcemanager/sql/armsql/managedinstanceoperations_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armsql @@ -47,23 +46,25 @@ func NewManagedInstanceOperationsClient(subscriptionID string, credential azcore // Cancel - Cancels the asynchronous operation on the managed instance. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - managedInstanceName - The name of the managed instance. // - options - ManagedInstanceOperationsClientCancelOptions contains the optional parameters for the ManagedInstanceOperationsClient.Cancel // method. func (client *ManagedInstanceOperationsClient) Cancel(ctx context.Context, resourceGroupName string, managedInstanceName string, operationID string, options *ManagedInstanceOperationsClientCancelOptions) (ManagedInstanceOperationsClientCancelResponse, error) { + var err error req, err := client.cancelCreateRequest(ctx, resourceGroupName, managedInstanceName, operationID, options) if err != nil { return ManagedInstanceOperationsClientCancelResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ManagedInstanceOperationsClientCancelResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ManagedInstanceOperationsClientCancelResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ManagedInstanceOperationsClientCancelResponse{}, err } return ManagedInstanceOperationsClientCancelResponse{}, nil } @@ -89,7 +90,7 @@ func (client *ManagedInstanceOperationsClient) cancelCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -97,25 +98,28 @@ func (client *ManagedInstanceOperationsClient) cancelCreateRequest(ctx context.C // Get - Gets a management operation on a managed instance. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - managedInstanceName - The name of the managed instance. // - options - ManagedInstanceOperationsClientGetOptions contains the optional parameters for the ManagedInstanceOperationsClient.Get // method. func (client *ManagedInstanceOperationsClient) Get(ctx context.Context, resourceGroupName string, managedInstanceName string, operationID string, options *ManagedInstanceOperationsClientGetOptions) (ManagedInstanceOperationsClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, managedInstanceName, operationID, options) if err != nil { return ManagedInstanceOperationsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ManagedInstanceOperationsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ManagedInstanceOperationsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ManagedInstanceOperationsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -139,7 +143,7 @@ func (client *ManagedInstanceOperationsClient) getCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -156,7 +160,7 @@ func (client *ManagedInstanceOperationsClient) getHandleResponse(resp *http.Resp // NewListByManagedInstancePager - Gets a list of operations performed on the managed instance. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - managedInstanceName - The name of the managed instance. @@ -210,7 +214,7 @@ func (client *ManagedInstanceOperationsClient) listByManagedInstanceCreateReques return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/sql/armsql/managedinstanceoperations_client_example_test.go b/sdk/resourcemanager/sql/armsql/managedinstanceoperations_client_example_test.go deleted file mode 100644 index 6633fd0a560e..000000000000 --- a/sdk/resourcemanager/sql/armsql/managedinstanceoperations_client_example_test.go +++ /dev/null @@ -1,230 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsql_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sql/armsql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ListManagedInstanceOperations.json -func ExampleManagedInstanceOperationsClient_NewListByManagedInstancePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewManagedInstanceOperationsClient().NewListByManagedInstancePager("sqlcrudtest-7398", "sqlcrudtest-4645", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ManagedInstanceOperationListResult = armsql.ManagedInstanceOperationListResult{ - // Value: []*armsql.ManagedInstanceOperation{ - // { - // Name: to.Ptr("11111111-1111-1111-1111-111111111111"), - // Type: to.Ptr("Microsoft.Sql/managedInstances/operations"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/sqlcrudtest-7398/providers/Microsoft.Sql/managedInstances/sqlcrudtest-4645/operations/11111111-1111-1111-1111-111111111111"), - // Properties: &armsql.ManagedInstanceOperationProperties{ - // IsCancellable: to.Ptr(false), - // ManagedInstanceName: to.Ptr("sqlcrudtest-4645"), - // Operation: to.Ptr("UpsertManagedServer"), - // OperationFriendlyName: to.Ptr("UPDATE MANAGED SERVER"), - // PercentComplete: to.Ptr[int32](100), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-12-06T11:08:44.49Z"); return t}()), - // State: to.Ptr(armsql.ManagementOperationStateCancelled), - // }, - // }, - // { - // Name: to.Ptr("22222222-2222-2222-2222-222222222222"), - // Type: to.Ptr("Microsoft.Sql/managedInstances/operations"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/sqlcrudtest-7398/providers/Microsoft.Sql/managedInstances/sqlcrudtest-4645/operations/22222222-2222-2222-2222-222222222222"), - // Properties: &armsql.ManagedInstanceOperationProperties{ - // IsCancellable: to.Ptr(true), - // ManagedInstanceName: to.Ptr("sqlcrudtest-4645"), - // Operation: to.Ptr("UpsertManagedServer"), - // OperationFriendlyName: to.Ptr("UPDATE MANAGED SERVER"), - // OperationParameters: &armsql.ManagedInstanceOperationParametersPair{ - // CurrentParameters: &armsql.UpsertManagedServerOperationParameters{ - // Family: to.Ptr("Gen4"), - // StorageSizeInGB: to.Ptr[int32](32), - // Tier: to.Ptr("GeneralPurpose"), - // VCores: to.Ptr[int32](8), - // }, - // RequestedParameters: &armsql.UpsertManagedServerOperationParameters{ - // Family: to.Ptr("Gen4"), - // StorageSizeInGB: to.Ptr[int32](128), - // Tier: to.Ptr("BusinessCritical"), - // VCores: to.Ptr[int32](8), - // }, - // }, - // OperationSteps: &armsql.ManagedInstanceOperationSteps{ - // CurrentStep: to.Ptr[int32](3), - // StepsList: []*armsql.UpsertManagedServerOperationStep{ - // { - // Name: to.Ptr("Request validation"), - // Order: to.Ptr[int32](1), - // Status: to.Ptr(armsql.UpsertManagedServerOperationStepStatusCompleted), - // }, - // { - // Name: to.Ptr("Virtual Cluster resize/creation"), - // Order: to.Ptr[int32](2), - // Status: to.Ptr(armsql.UpsertManagedServerOperationStepStatusCompleted), - // }, - // { - // Name: to.Ptr("New SQL Instance Startup"), - // Order: to.Ptr[int32](3), - // Status: to.Ptr(armsql.UpsertManagedServerOperationStepStatusInProgress), - // }}, - // TotalSteps: to.Ptr("3"), - // }, - // PercentComplete: to.Ptr[int32](50), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-12-06T11:08:44.49Z"); return t}()), - // State: to.Ptr(armsql.ManagementOperationStateInProgress), - // }, - // }, - // { - // Name: to.Ptr("33333333-3333-3333-3333-333333333333"), - // Type: to.Ptr("Microsoft.Sql/managedInstances/operations"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/sqlcrudtest-7398/providers/Microsoft.Sql/managedInstances/sqlcrudtest-4645/operations/33333333-3333-3333-3333-333333333333"), - // Properties: &armsql.ManagedInstanceOperationProperties{ - // ErrorCode: to.Ptr[int32](45157), - // ErrorDescription: to.Ptr("Server 'sqlcrudtest-4645' is busy with another operation. Please try your operation later."), - // ErrorSeverity: to.Ptr[int32](16), - // IsCancellable: to.Ptr(false), - // IsUserError: to.Ptr(true), - // ManagedInstanceName: to.Ptr("sqlcrudtest-4645"), - // Operation: to.Ptr("UpsertManagedServer"), - // OperationFriendlyName: to.Ptr("UPDATE MANAGED SERVER"), - // PercentComplete: to.Ptr[int32](100), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-12-06T14:48:34.583Z"); return t}()), - // State: to.Ptr(armsql.ManagementOperationStateFailed), - // }, - // }, - // { - // Name: to.Ptr("44444444-4444-4444-4444-444444444444"), - // Type: to.Ptr("Microsoft.Sql/managedInstances/operations"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/sqlcrudtest-7398/providers/Microsoft.Sql/managedInstances/sqlcrudtest-4645/operations/44444444-4444-4444-4444-444444444444"), - // Properties: &armsql.ManagedInstanceOperationProperties{ - // ManagedInstanceName: to.Ptr("sqlcrudtest-4645"), - // Operation: to.Ptr("MakeAllManagedDatabasesAccessible"), - // OperationFriendlyName: to.Ptr("MAKE ALL MANAGED DBS ACCESSIBLE"), - // OperationSteps: &armsql.ManagedInstanceOperationSteps{ - // CurrentStep: to.Ptr[int32](1), - // StepsList: []*armsql.UpsertManagedServerOperationStep{ - // { - // Name: to.Ptr("Request validation"), - // Order: to.Ptr[int32](1), - // Status: to.Ptr(armsql.UpsertManagedServerOperationStepStatusFailed), - // }}, - // TotalSteps: to.Ptr("1"), - // }, - // PercentComplete: to.Ptr[int32](100), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-06-01T09:00:08.1Z"); return t}()), - // State: to.Ptr(armsql.ManagementOperationStateSucceeded), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/GetManagedInstanceOperation.json -func ExampleManagedInstanceOperationsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewManagedInstanceOperationsClient().Get(ctx, "sqlcrudtest-7398", "sqlcrudtest-4645", "00000000-1111-2222-3333-444444444444", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ManagedInstanceOperation = armsql.ManagedInstanceOperation{ - // Name: to.Ptr("11111111-1111-1111-1111-111111111111"), - // Type: to.Ptr("Microsoft.Sql/managedInstances/operations"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/sqlcrudtest-7398/providers/Microsoft.Sql/managedInstances/sqlcrudtest-4645/operations/11111111-1111-1111-1111-111111111111"), - // Properties: &armsql.ManagedInstanceOperationProperties{ - // IsCancellable: to.Ptr(false), - // ManagedInstanceName: to.Ptr("sqlcrudtest-4645"), - // Operation: to.Ptr("UpsertManagedServer"), - // OperationFriendlyName: to.Ptr("UPDATE MANAGED SERVER"), - // OperationSteps: &armsql.ManagedInstanceOperationSteps{ - // CurrentStep: to.Ptr[int32](2), - // StepsList: []*armsql.UpsertManagedServerOperationStep{ - // { - // Name: to.Ptr("Request validation"), - // Order: to.Ptr[int32](1), - // Status: to.Ptr(armsql.UpsertManagedServerOperationStepStatusCompleted), - // }, - // { - // Name: to.Ptr("New SQL Instance Startup"), - // Order: to.Ptr[int32](2), - // Status: to.Ptr(armsql.UpsertManagedServerOperationStepStatusCanceled), - // }, - // { - // Name: to.Ptr("Seeding database files"), - // Order: to.Ptr[int32](3), - // Status: to.Ptr(armsql.UpsertManagedServerOperationStepStatusNotStarted), - // }, - // { - // Name: to.Ptr("Preparing Failover and Failover"), - // Order: to.Ptr[int32](4), - // Status: to.Ptr(armsql.UpsertManagedServerOperationStepStatusNotStarted), - // }, - // { - // Name: to.Ptr("Old SQL Instance cleanup"), - // Order: to.Ptr[int32](5), - // Status: to.Ptr(armsql.UpsertManagedServerOperationStepStatusNotStarted), - // }}, - // TotalSteps: to.Ptr("5"), - // }, - // PercentComplete: to.Ptr[int32](100), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-12-06T11:08:44.49Z"); return t}()), - // State: to.Ptr(armsql.ManagementOperationStateCancelled), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/CancelManagedInstanceOperation.json -func ExampleManagedInstanceOperationsClient_Cancel() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewManagedInstanceOperationsClient().Cancel(ctx, "sqlcrudtest-7398", "sqlcrudtest-4645", "11111111-1111-1111-1111-111111111111", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/sql/armsql/managedinstanceprivateendpointconnections_client.go b/sdk/resourcemanager/sql/armsql/managedinstanceprivateendpointconnections_client.go index 92a95afa08f1..03f75814f25a 100644 --- a/sdk/resourcemanager/sql/armsql/managedinstanceprivateendpointconnections_client.go +++ b/sdk/resourcemanager/sql/armsql/managedinstanceprivateendpointconnections_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armsql @@ -47,7 +46,7 @@ func NewManagedInstancePrivateEndpointConnectionsClient(subscriptionID string, c // BeginCreateOrUpdate - Approve or reject a private endpoint connection with a given name. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - managedInstanceName - The name of the managed instance. @@ -59,7 +58,8 @@ func (client *ManagedInstancePrivateEndpointConnectionsClient) BeginCreateOrUpda if err != nil { return nil, err } - return runtime.NewPoller[ManagedInstancePrivateEndpointConnectionsClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[ManagedInstancePrivateEndpointConnectionsClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[ManagedInstancePrivateEndpointConnectionsClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -68,20 +68,22 @@ func (client *ManagedInstancePrivateEndpointConnectionsClient) BeginCreateOrUpda // CreateOrUpdate - Approve or reject a private endpoint connection with a given name. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview func (client *ManagedInstancePrivateEndpointConnectionsClient) createOrUpdate(ctx context.Context, resourceGroupName string, managedInstanceName string, privateEndpointConnectionName string, parameters ManagedInstancePrivateEndpointConnection, options *ManagedInstancePrivateEndpointConnectionsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, managedInstanceName, privateEndpointConnectionName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createOrUpdateCreateRequest creates the CreateOrUpdate request. @@ -108,16 +110,19 @@ func (client *ManagedInstancePrivateEndpointConnectionsClient) createOrUpdateCre return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // BeginDelete - Deletes a private endpoint connection with a given name. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - managedInstanceName - The name of the managed instance. @@ -129,7 +134,8 @@ func (client *ManagedInstancePrivateEndpointConnectionsClient) BeginDelete(ctx c if err != nil { return nil, err } - return runtime.NewPoller[ManagedInstancePrivateEndpointConnectionsClientDeleteResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[ManagedInstancePrivateEndpointConnectionsClientDeleteResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[ManagedInstancePrivateEndpointConnectionsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -138,20 +144,22 @@ func (client *ManagedInstancePrivateEndpointConnectionsClient) BeginDelete(ctx c // Delete - Deletes a private endpoint connection with a given name. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview func (client *ManagedInstancePrivateEndpointConnectionsClient) deleteOperation(ctx context.Context, resourceGroupName string, managedInstanceName string, privateEndpointConnectionName string, options *ManagedInstancePrivateEndpointConnectionsClientBeginDeleteOptions) (*http.Response, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, managedInstanceName, privateEndpointConnectionName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteCreateRequest creates the Delete request. @@ -178,7 +186,7 @@ func (client *ManagedInstancePrivateEndpointConnectionsClient) deleteCreateReque return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -186,7 +194,7 @@ func (client *ManagedInstancePrivateEndpointConnectionsClient) deleteCreateReque // Get - Gets a private endpoint connection. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - managedInstanceName - The name of the managed instance. @@ -194,18 +202,21 @@ func (client *ManagedInstancePrivateEndpointConnectionsClient) deleteCreateReque // - options - ManagedInstancePrivateEndpointConnectionsClientGetOptions contains the optional parameters for the ManagedInstancePrivateEndpointConnectionsClient.Get // method. func (client *ManagedInstancePrivateEndpointConnectionsClient) Get(ctx context.Context, resourceGroupName string, managedInstanceName string, privateEndpointConnectionName string, options *ManagedInstancePrivateEndpointConnectionsClientGetOptions) (ManagedInstancePrivateEndpointConnectionsClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, managedInstanceName, privateEndpointConnectionName, options) if err != nil { return ManagedInstancePrivateEndpointConnectionsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ManagedInstancePrivateEndpointConnectionsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ManagedInstancePrivateEndpointConnectionsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ManagedInstancePrivateEndpointConnectionsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -232,7 +243,7 @@ func (client *ManagedInstancePrivateEndpointConnectionsClient) getCreateRequest( return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -249,7 +260,7 @@ func (client *ManagedInstancePrivateEndpointConnectionsClient) getHandleResponse // NewListByManagedInstancePager - Gets all private endpoint connections on a server. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - managedInstanceName - The name of the managed instance. @@ -303,7 +314,7 @@ func (client *ManagedInstancePrivateEndpointConnectionsClient) listByManagedInst return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/sql/armsql/managedinstanceprivateendpointconnections_client_example_test.go b/sdk/resourcemanager/sql/armsql/managedinstanceprivateendpointconnections_client_example_test.go deleted file mode 100644 index 4932128800e5..000000000000 --- a/sdk/resourcemanager/sql/armsql/managedinstanceprivateendpointconnections_client_example_test.go +++ /dev/null @@ -1,183 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsql_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sql/armsql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstancePrivateEndpointConnectionGet.json -func ExampleManagedInstancePrivateEndpointConnectionsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewManagedInstancePrivateEndpointConnectionsClient().Get(ctx, "Default", "test-cl", "private-endpoint-connection-name", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ManagedInstancePrivateEndpointConnection = armsql.ManagedInstancePrivateEndpointConnection{ - // Name: to.Ptr("private-endpoint-connection-name"), - // Type: to.Ptr("Microsoft.Sql/managedInstances/privateEndpointConnections"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/managedInstances/test-cl/privateEndpointConnections/private-endpoint-connection-name"), - // Properties: &armsql.ManagedInstancePrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armsql.ManagedInstancePrivateEndpointProperty{ - // ID: to.Ptr("/subscriptions/55555555-6666-7777-8888-999999999999/resourceGroups/Default-Network/providers/Microsoft.Network/privateEndpoints/private-endpoint-name"), - // }, - // PrivateLinkServiceConnectionState: &armsql.ManagedInstancePrivateLinkServiceConnectionStateProperty{ - // Description: to.Ptr("Auto-approved"), - // ActionsRequired: to.Ptr("None"), - // Status: to.Ptr("Approved"), - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstancePrivateEndpointConnectionUpdate.json -func ExampleManagedInstancePrivateEndpointConnectionsClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewManagedInstancePrivateEndpointConnectionsClient().BeginCreateOrUpdate(ctx, "Default", "test-cl", "private-endpoint-connection-name", armsql.ManagedInstancePrivateEndpointConnection{ - Properties: &armsql.ManagedInstancePrivateEndpointConnectionProperties{ - PrivateLinkServiceConnectionState: &armsql.ManagedInstancePrivateLinkServiceConnectionStateProperty{ - Description: to.Ptr("Approved by johndoe@contoso.com"), - Status: to.Ptr("Approved"), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ManagedInstancePrivateEndpointConnection = armsql.ManagedInstancePrivateEndpointConnection{ - // Name: to.Ptr("private-endpoint-connection-name"), - // Type: to.Ptr("Microsoft.Sql/managedInstances/privateEndpointConnections"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/managedInstances/test-cl/privateEndpointConnections/private-endpoint-connection-name"), - // Properties: &armsql.ManagedInstancePrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armsql.ManagedInstancePrivateEndpointProperty{ - // ID: to.Ptr("/subscriptions/55555555-6666-7777-8888-999999999999/resourceGroups/Default-Network/providers/Microsoft.Network/privateEndpoints/private-endpoint-name"), - // }, - // PrivateLinkServiceConnectionState: &armsql.ManagedInstancePrivateLinkServiceConnectionStateProperty{ - // Description: to.Ptr("Approved by johndoe@contoso.com"), - // ActionsRequired: to.Ptr("None"), - // Status: to.Ptr("Approved"), - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstancePrivateEndpointConnectionDelete.json -func ExampleManagedInstancePrivateEndpointConnectionsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewManagedInstancePrivateEndpointConnectionsClient().BeginDelete(ctx, "Default", "test-cl", "private-endpoint-connection-name", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstancePrivateEndpointConnectionList.json -func ExampleManagedInstancePrivateEndpointConnectionsClient_NewListByManagedInstancePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewManagedInstancePrivateEndpointConnectionsClient().NewListByManagedInstancePager("Default", "test-cl", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ManagedInstancePrivateEndpointConnectionListResult = armsql.ManagedInstancePrivateEndpointConnectionListResult{ - // Value: []*armsql.ManagedInstancePrivateEndpointConnection{ - // { - // Name: to.Ptr("private-endpoint-connection-name"), - // Type: to.Ptr("Microsoft.Sql/managedInstances/privateEndpointConnections"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/managedInstances/test-cl/privateEndpointConnections/private-endpoint-connection-name"), - // Properties: &armsql.ManagedInstancePrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armsql.ManagedInstancePrivateEndpointProperty{ - // ID: to.Ptr("/subscriptions/55555555-6666-7777-8888-999999999999/resourceGroups/Default-Network/providers/Microsoft.Network/privateEndpoints/private-endpoint-name"), - // }, - // PrivateLinkServiceConnectionState: &armsql.ManagedInstancePrivateLinkServiceConnectionStateProperty{ - // Description: to.Ptr("Auto-approved"), - // ActionsRequired: to.Ptr("None"), - // Status: to.Ptr("Approved"), - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // }, - // { - // Name: to.Ptr("private-endpoint-connection-name-2"), - // Type: to.Ptr("Microsoft.Sql/managedInstances/privateEndpointConnections"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/managedInstances/test-cl/privateEndpointConnections/private-endpoint-connection-name-2"), - // Properties: &armsql.ManagedInstancePrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armsql.ManagedInstancePrivateEndpointProperty{ - // ID: to.Ptr("/subscriptions/55555555-6666-7777-8888-999999999999/resourceGroups/Default-Network/providers/Microsoft.Network/privateEndpoints/private-endpoint-name-2"), - // }, - // PrivateLinkServiceConnectionState: &armsql.ManagedInstancePrivateLinkServiceConnectionStateProperty{ - // Description: to.Ptr("Auto-approved"), - // ActionsRequired: to.Ptr("None"), - // Status: to.Ptr("Approved"), - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/sql/armsql/managedinstanceprivatelinkresources_client.go b/sdk/resourcemanager/sql/armsql/managedinstanceprivatelinkresources_client.go index 8c14343abe70..135f22ecf5ba 100644 --- a/sdk/resourcemanager/sql/armsql/managedinstanceprivatelinkresources_client.go +++ b/sdk/resourcemanager/sql/armsql/managedinstanceprivatelinkresources_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armsql @@ -47,7 +46,7 @@ func NewManagedInstancePrivateLinkResourcesClient(subscriptionID string, credent // Get - Gets a private link resource for SQL server. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - managedInstanceName - The name of the managed instance. @@ -55,18 +54,21 @@ func NewManagedInstancePrivateLinkResourcesClient(subscriptionID string, credent // - options - ManagedInstancePrivateLinkResourcesClientGetOptions contains the optional parameters for the ManagedInstancePrivateLinkResourcesClient.Get // method. func (client *ManagedInstancePrivateLinkResourcesClient) Get(ctx context.Context, resourceGroupName string, managedInstanceName string, groupName string, options *ManagedInstancePrivateLinkResourcesClientGetOptions) (ManagedInstancePrivateLinkResourcesClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, managedInstanceName, groupName, options) if err != nil { return ManagedInstancePrivateLinkResourcesClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ManagedInstancePrivateLinkResourcesClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ManagedInstancePrivateLinkResourcesClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ManagedInstancePrivateLinkResourcesClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -93,7 +95,7 @@ func (client *ManagedInstancePrivateLinkResourcesClient) getCreateRequest(ctx co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -110,7 +112,7 @@ func (client *ManagedInstancePrivateLinkResourcesClient) getHandleResponse(resp // NewListByManagedInstancePager - Gets the private link resources for SQL server. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - managedInstanceName - The name of the managed instance. @@ -164,7 +166,7 @@ func (client *ManagedInstancePrivateLinkResourcesClient) listByManagedInstanceCr return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/sql/armsql/managedinstanceprivatelinkresources_client_example_test.go b/sdk/resourcemanager/sql/armsql/managedinstanceprivatelinkresources_client_example_test.go deleted file mode 100644 index 67da4da6df93..000000000000 --- a/sdk/resourcemanager/sql/armsql/managedinstanceprivatelinkresources_client_example_test.go +++ /dev/null @@ -1,86 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsql_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sql/armsql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstancePrivateLinkResourcesList.json -func ExampleManagedInstancePrivateLinkResourcesClient_NewListByManagedInstancePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewManagedInstancePrivateLinkResourcesClient().NewListByManagedInstancePager("Default", "test-cl", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ManagedInstancePrivateLinkListResult = armsql.ManagedInstancePrivateLinkListResult{ - // Value: []*armsql.ManagedInstancePrivateLink{ - // { - // Name: to.Ptr("plr"), - // Type: to.Ptr("Microsoft.Sql/managedInstances/privateLinkResources"), - // ID: to.Ptr("subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/managedInstances/test-cl/privateLinkResources/plr"), - // Properties: &armsql.ManagedInstancePrivateLinkProperties{ - // GroupID: to.Ptr("managedInstance"), - // RequiredMembers: []*string{ - // to.Ptr("managedInstance")}, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstancePrivateLinkResourcesGet.json -func ExampleManagedInstancePrivateLinkResourcesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewManagedInstancePrivateLinkResourcesClient().Get(ctx, "Default", "test-cl", "plr", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ManagedInstancePrivateLink = armsql.ManagedInstancePrivateLink{ - // Name: to.Ptr("plr"), - // Type: to.Ptr("Microsoft.Sql/managedInstances/privateLinkResources"), - // ID: to.Ptr("subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/managedInstances/test-cl/privateLinkResources/plr"), - // Properties: &armsql.ManagedInstancePrivateLinkProperties{ - // GroupID: to.Ptr("managedInstance"), - // RequiredMembers: []*string{ - // to.Ptr("managedInstance")}, - // }, - // } -} diff --git a/sdk/resourcemanager/sql/armsql/managedinstances_client.go b/sdk/resourcemanager/sql/armsql/managedinstances_client.go index eb9f11d23a65..126b8d0875a4 100644 --- a/sdk/resourcemanager/sql/armsql/managedinstances_client.go +++ b/sdk/resourcemanager/sql/armsql/managedinstances_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armsql @@ -48,7 +47,7 @@ func NewManagedInstancesClient(subscriptionID string, credential azcore.TokenCre // BeginCreateOrUpdate - Creates or updates a managed instance. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-05-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - managedInstanceName - The name of the managed instance. @@ -61,7 +60,8 @@ func (client *ManagedInstancesClient) BeginCreateOrUpdate(ctx context.Context, r if err != nil { return nil, err } - return runtime.NewPoller[ManagedInstancesClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[ManagedInstancesClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[ManagedInstancesClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -70,20 +70,22 @@ func (client *ManagedInstancesClient) BeginCreateOrUpdate(ctx context.Context, r // CreateOrUpdate - Creates or updates a managed instance. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-05-01-preview +// Generated from API version 2022-11-01-preview func (client *ManagedInstancesClient) createOrUpdate(ctx context.Context, resourceGroupName string, managedInstanceName string, parameters ManagedInstance, options *ManagedInstancesClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, managedInstanceName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createOrUpdateCreateRequest creates the CreateOrUpdate request. @@ -106,16 +108,19 @@ func (client *ManagedInstancesClient) createOrUpdateCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-05-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // BeginDelete - Deletes a managed instance. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-05-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - managedInstanceName - The name of the managed instance. @@ -127,7 +132,8 @@ func (client *ManagedInstancesClient) BeginDelete(ctx context.Context, resourceG if err != nil { return nil, err } - return runtime.NewPoller[ManagedInstancesClientDeleteResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[ManagedInstancesClientDeleteResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[ManagedInstancesClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -136,20 +142,22 @@ func (client *ManagedInstancesClient) BeginDelete(ctx context.Context, resourceG // Delete - Deletes a managed instance. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-05-01-preview +// Generated from API version 2022-11-01-preview func (client *ManagedInstancesClient) deleteOperation(ctx context.Context, resourceGroupName string, managedInstanceName string, options *ManagedInstancesClientBeginDeleteOptions) (*http.Response, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, managedInstanceName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteCreateRequest creates the Delete request. @@ -172,7 +180,7 @@ func (client *ManagedInstancesClient) deleteCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-05-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -180,7 +188,7 @@ func (client *ManagedInstancesClient) deleteCreateRequest(ctx context.Context, r // BeginFailover - Failovers a managed instance. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-05-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - managedInstanceName - The name of the managed instance to failover. @@ -192,7 +200,8 @@ func (client *ManagedInstancesClient) BeginFailover(ctx context.Context, resourc if err != nil { return nil, err } - return runtime.NewPoller[ManagedInstancesClientFailoverResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[ManagedInstancesClientFailoverResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[ManagedInstancesClientFailoverResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -201,20 +210,22 @@ func (client *ManagedInstancesClient) BeginFailover(ctx context.Context, resourc // Failover - Failovers a managed instance. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-05-01-preview +// Generated from API version 2022-11-01-preview func (client *ManagedInstancesClient) failover(ctx context.Context, resourceGroupName string, managedInstanceName string, options *ManagedInstancesClientBeginFailoverOptions) (*http.Response, error) { + var err error req, err := client.failoverCreateRequest(ctx, resourceGroupName, managedInstanceName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // failoverCreateRequest creates the Failover request. @@ -240,7 +251,7 @@ func (client *ManagedInstancesClient) failoverCreateRequest(ctx context.Context, if options != nil && options.ReplicaType != nil { reqQP.Set("replicaType", string(*options.ReplicaType)) } - reqQP.Set("api-version", "2021-05-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -248,24 +259,27 @@ func (client *ManagedInstancesClient) failoverCreateRequest(ctx context.Context, // Get - Gets a managed instance. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-05-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - managedInstanceName - The name of the managed instance. // - options - ManagedInstancesClientGetOptions contains the optional parameters for the ManagedInstancesClient.Get method. func (client *ManagedInstancesClient) Get(ctx context.Context, resourceGroupName string, managedInstanceName string, options *ManagedInstancesClientGetOptions) (ManagedInstancesClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, managedInstanceName, options) if err != nil { return ManagedInstancesClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ManagedInstancesClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ManagedInstancesClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ManagedInstancesClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -291,7 +305,7 @@ func (client *ManagedInstancesClient) getCreateRequest(ctx context.Context, reso if options != nil && options.Expand != nil { reqQP.Set("$expand", *options.Expand) } - reqQP.Set("api-version", "2021-05-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -308,7 +322,7 @@ func (client *ManagedInstancesClient) getHandleResponse(resp *http.Response) (Ma // NewListPager - Gets a list of all managed instances in the subscription. // -// Generated from API version 2021-05-01-preview +// Generated from API version 2022-11-01-preview // - options - ManagedInstancesClientListOptions contains the optional parameters for the ManagedInstancesClient.NewListPager // method. func (client *ManagedInstancesClient) NewListPager(options *ManagedInstancesClientListOptions) *runtime.Pager[ManagedInstancesClientListResponse] { @@ -354,7 +368,7 @@ func (client *ManagedInstancesClient) listCreateRequest(ctx context.Context, opt if options != nil && options.Expand != nil { reqQP.Set("$expand", *options.Expand) } - reqQP.Set("api-version", "2021-05-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -371,7 +385,7 @@ func (client *ManagedInstancesClient) listHandleResponse(resp *http.Response) (M // NewListByInstancePoolPager - Gets a list of all managed instances in an instance pool. // -// Generated from API version 2021-05-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - instancePoolName - The instance pool name. @@ -428,7 +442,7 @@ func (client *ManagedInstancesClient) listByInstancePoolCreateRequest(ctx contex if options != nil && options.Expand != nil { reqQP.Set("$expand", *options.Expand) } - reqQP.Set("api-version", "2021-05-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -445,7 +459,7 @@ func (client *ManagedInstancesClient) listByInstancePoolHandleResponse(resp *htt // NewListByManagedInstancePager - Get top resource consuming queries of a managed instance. // -// Generated from API version 2021-05-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - managedInstanceName - The name of the managed instance. @@ -520,7 +534,7 @@ func (client *ManagedInstancesClient) listByManagedInstanceCreateRequest(ctx con if options != nil && options.ObservationMetric != nil { reqQP.Set("observationMetric", string(*options.ObservationMetric)) } - reqQP.Set("api-version", "2021-05-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -537,7 +551,7 @@ func (client *ManagedInstancesClient) listByManagedInstanceHandleResponse(resp * // NewListByResourceGroupPager - Gets a list of managed instances in a resource group. // -// Generated from API version 2021-05-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - options - ManagedInstancesClientListByResourceGroupOptions contains the optional parameters for the ManagedInstancesClient.NewListByResourceGroupPager @@ -589,7 +603,7 @@ func (client *ManagedInstancesClient) listByResourceGroupCreateRequest(ctx conte if options != nil && options.Expand != nil { reqQP.Set("$expand", *options.Expand) } - reqQP.Set("api-version", "2021-05-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -604,10 +618,224 @@ func (client *ManagedInstancesClient) listByResourceGroupHandleResponse(resp *ht return result, nil } +// NewListOutboundNetworkDependenciesByManagedInstancePager - Gets the collection of outbound network dependencies for the +// given managed instance. +// +// Generated from API version 2022-11-01-preview +// - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure +// Resource Manager API or the portal. +// - managedInstanceName - The name of the managed instance. +// - options - ManagedInstancesClientListOutboundNetworkDependenciesByManagedInstanceOptions contains the optional parameters +// for the ManagedInstancesClient.NewListOutboundNetworkDependenciesByManagedInstancePager method. +func (client *ManagedInstancesClient) NewListOutboundNetworkDependenciesByManagedInstancePager(resourceGroupName string, managedInstanceName string, options *ManagedInstancesClientListOutboundNetworkDependenciesByManagedInstanceOptions) *runtime.Pager[ManagedInstancesClientListOutboundNetworkDependenciesByManagedInstanceResponse] { + return runtime.NewPager(runtime.PagingHandler[ManagedInstancesClientListOutboundNetworkDependenciesByManagedInstanceResponse]{ + More: func(page ManagedInstancesClientListOutboundNetworkDependenciesByManagedInstanceResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ManagedInstancesClientListOutboundNetworkDependenciesByManagedInstanceResponse) (ManagedInstancesClientListOutboundNetworkDependenciesByManagedInstanceResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listOutboundNetworkDependenciesByManagedInstanceCreateRequest(ctx, resourceGroupName, managedInstanceName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ManagedInstancesClientListOutboundNetworkDependenciesByManagedInstanceResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ManagedInstancesClientListOutboundNetworkDependenciesByManagedInstanceResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ManagedInstancesClientListOutboundNetworkDependenciesByManagedInstanceResponse{}, runtime.NewResponseError(resp) + } + return client.listOutboundNetworkDependenciesByManagedInstanceHandleResponse(resp) + }, + }) +} + +// listOutboundNetworkDependenciesByManagedInstanceCreateRequest creates the ListOutboundNetworkDependenciesByManagedInstance request. +func (client *ManagedInstancesClient) listOutboundNetworkDependenciesByManagedInstanceCreateRequest(ctx context.Context, resourceGroupName string, managedInstanceName string, options *ManagedInstancesClientListOutboundNetworkDependenciesByManagedInstanceOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/outboundNetworkDependenciesEndpoints" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if managedInstanceName == "" { + return nil, errors.New("parameter managedInstanceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{managedInstanceName}", url.PathEscape(managedInstanceName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listOutboundNetworkDependenciesByManagedInstanceHandleResponse handles the ListOutboundNetworkDependenciesByManagedInstance response. +func (client *ManagedInstancesClient) listOutboundNetworkDependenciesByManagedInstanceHandleResponse(resp *http.Response) (ManagedInstancesClientListOutboundNetworkDependenciesByManagedInstanceResponse, error) { + result := ManagedInstancesClientListOutboundNetworkDependenciesByManagedInstanceResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.OutboundEnvironmentEndpointCollection); err != nil { + return ManagedInstancesClientListOutboundNetworkDependenciesByManagedInstanceResponse{}, err + } + return result, nil +} + +// BeginStart - Starts the managed instance. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-11-01-preview +// - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure +// Resource Manager API or the portal. +// - managedInstanceName - The name of the managed instance. +// - options - ManagedInstancesClientBeginStartOptions contains the optional parameters for the ManagedInstancesClient.BeginStart +// method. +func (client *ManagedInstancesClient) BeginStart(ctx context.Context, resourceGroupName string, managedInstanceName string, options *ManagedInstancesClientBeginStartOptions) (*runtime.Poller[ManagedInstancesClientStartResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.start(ctx, resourceGroupName, managedInstanceName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ManagedInstancesClientStartResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[ManagedInstancesClientStartResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Start - Starts the managed instance. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-11-01-preview +func (client *ManagedInstancesClient) start(ctx context.Context, resourceGroupName string, managedInstanceName string, options *ManagedInstancesClientBeginStartOptions) (*http.Response, error) { + var err error + req, err := client.startCreateRequest(ctx, resourceGroupName, managedInstanceName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// startCreateRequest creates the Start request. +func (client *ManagedInstancesClient) startCreateRequest(ctx context.Context, resourceGroupName string, managedInstanceName string, options *ManagedInstancesClientBeginStartOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/start" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if managedInstanceName == "" { + return nil, errors.New("parameter managedInstanceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{managedInstanceName}", url.PathEscape(managedInstanceName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// BeginStop - Stops the managed instance. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-11-01-preview +// - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure +// Resource Manager API or the portal. +// - managedInstanceName - The name of the managed instance. +// - options - ManagedInstancesClientBeginStopOptions contains the optional parameters for the ManagedInstancesClient.BeginStop +// method. +func (client *ManagedInstancesClient) BeginStop(ctx context.Context, resourceGroupName string, managedInstanceName string, options *ManagedInstancesClientBeginStopOptions) (*runtime.Poller[ManagedInstancesClientStopResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.stop(ctx, resourceGroupName, managedInstanceName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ManagedInstancesClientStopResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[ManagedInstancesClientStopResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Stop - Stops the managed instance. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-11-01-preview +func (client *ManagedInstancesClient) stop(ctx context.Context, resourceGroupName string, managedInstanceName string, options *ManagedInstancesClientBeginStopOptions) (*http.Response, error) { + var err error + req, err := client.stopCreateRequest(ctx, resourceGroupName, managedInstanceName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// stopCreateRequest creates the Stop request. +func (client *ManagedInstancesClient) stopCreateRequest(ctx context.Context, resourceGroupName string, managedInstanceName string, options *ManagedInstancesClientBeginStopOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/stop" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if managedInstanceName == "" { + return nil, errors.New("parameter managedInstanceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{managedInstanceName}", url.PathEscape(managedInstanceName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + // BeginUpdate - Updates a managed instance. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-05-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - managedInstanceName - The name of the managed instance. @@ -620,7 +848,8 @@ func (client *ManagedInstancesClient) BeginUpdate(ctx context.Context, resourceG if err != nil { return nil, err } - return runtime.NewPoller[ManagedInstancesClientUpdateResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[ManagedInstancesClientUpdateResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[ManagedInstancesClientUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -629,20 +858,22 @@ func (client *ManagedInstancesClient) BeginUpdate(ctx context.Context, resourceG // Update - Updates a managed instance. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-05-01-preview +// Generated from API version 2022-11-01-preview func (client *ManagedInstancesClient) update(ctx context.Context, resourceGroupName string, managedInstanceName string, parameters ManagedInstanceUpdate, options *ManagedInstancesClientBeginUpdateOptions) (*http.Response, error) { + var err error req, err := client.updateCreateRequest(ctx, resourceGroupName, managedInstanceName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // updateCreateRequest creates the Update request. @@ -665,8 +896,11 @@ func (client *ManagedInstancesClient) updateCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-05-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } diff --git a/sdk/resourcemanager/sql/armsql/managedinstances_client_example_test.go b/sdk/resourcemanager/sql/armsql/managedinstances_client_example_test.go deleted file mode 100644 index 332efa5b7435..000000000000 --- a/sdk/resourcemanager/sql/armsql/managedinstances_client_example_test.go +++ /dev/null @@ -1,1659 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsql_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sql/armsql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ManagedInstanceListByInstancePool.json -func ExampleManagedInstancesClient_NewListByInstancePoolPager_listManagedInstancesByInstancePool() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewManagedInstancesClient().NewListByInstancePoolPager("Test1", "pool1", &armsql.ManagedInstancesClientListByInstancePoolOptions{Expand: nil}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ManagedInstanceListResult = armsql.ManagedInstanceListResult{ - // Value: []*armsql.ManagedInstance{ - // { - // Name: to.Ptr("testinstance1"), - // Type: to.Ptr("Microsoft.Sql/managedInstances"), - // ID: to.Ptr("/subscriptions/20D7082A-0FC7-4468-82BD-542694D5042B/resourceGroups/Test1/providers/Microsoft.Sql/managedInstances/testinstance1"), - // Location: to.Ptr("canadacentral"), - // Properties: &armsql.ManagedInstanceProperties{ - // AdministratorLogin: to.Ptr("dummylogin"), - // Collation: to.Ptr("SQL_Latin1_General_CP1_CI_AS"), - // CurrentBackupStorageRedundancy: to.Ptr(armsql.BackupStorageRedundancyGeo), - // DNSZone: to.Ptr("1b4e2caff2530"), - // FullyQualifiedDomainName: to.Ptr("testinstance1.1b4e2caff2530.database.windows.net"), - // InstancePoolID: to.Ptr("/subscriptions/20D7082A-0FC7-4468-82BD-542694D5042B/resourceGroups/Test1/providers/Microsoft.Sql/instancePools/pool1"), - // LicenseType: to.Ptr(armsql.ManagedInstanceLicenseTypeLicenseIncluded), - // MaintenanceConfigurationID: to.Ptr("/subscriptions/20D7082A-0FC7-4468-82BD-542694D5042B/providers/Microsoft.Maintenance/publicMaintenanceConfigurations/SQL_CanadaCentral_MI_1"), - // MinimalTLSVersion: to.Ptr("1.2"), - // ProvisioningState: to.Ptr(armsql.ManagedInstancePropertiesProvisioningStateSucceeded), - // ProxyOverride: to.Ptr(armsql.ManagedInstanceProxyOverrideRedirect), - // PublicDataEndpointEnabled: to.Ptr(false), - // RequestedBackupStorageRedundancy: to.Ptr(armsql.BackupStorageRedundancyGeo), - // State: to.Ptr("Ready"), - // StorageSizeInGB: to.Ptr[int32](1024), - // SubnetID: to.Ptr("/subscriptions/20D7082A-0FC7-4468-82BD-542694D5042B/resourceGroups/Test1/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1"), - // VCores: to.Ptr[int32](8), - // }, - // SKU: &armsql.SKU{ - // Name: to.Ptr("GP_Gen5"), - // Capacity: to.Ptr[int32](8), - // Family: to.Ptr("Gen5"), - // Tier: to.Ptr("GeneralPurpose"), - // }, - // }, - // { - // Name: to.Ptr("testinstance2"), - // Type: to.Ptr("Microsoft.Sql/managedInstances"), - // ID: to.Ptr("/subscriptions/20D7082A-0FC7-4468-82BD-542694D5042B/resourceGroups/Test1/providers/Microsoft.Sql/managedInstances/testinstance2"), - // Location: to.Ptr("canadacentral"), - // Properties: &armsql.ManagedInstanceProperties{ - // AdministratorLogin: to.Ptr("dummylogin"), - // Collation: to.Ptr("SQL_Latin1_General_CP1_CI_AS"), - // CurrentBackupStorageRedundancy: to.Ptr(armsql.BackupStorageRedundancyGeo), - // DNSZone: to.Ptr("2c3d1bdae3412"), - // FullyQualifiedDomainName: to.Ptr("testinstance2.2c3d1bdae3412.database.windows.net"), - // InstancePoolID: to.Ptr("/subscriptions/20D7082A-0FC7-4468-82BD-542694D5042B/resourceGroups/Test1/providers/Microsoft.Sql/instancePools/pool1"), - // LicenseType: to.Ptr(armsql.ManagedInstanceLicenseType("Full")), - // MaintenanceConfigurationID: to.Ptr("/subscriptions/20D7082A-0FC7-4468-82BD-542694D5042B/providers/Microsoft.Maintenance/publicMaintenanceConfigurations/SQL_CanadaCentral_MI_1"), - // MinimalTLSVersion: to.Ptr("1.2"), - // ProvisioningState: to.Ptr(armsql.ManagedInstancePropertiesProvisioningStateSucceeded), - // ProxyOverride: to.Ptr(armsql.ManagedInstanceProxyOverrideRedirect), - // PublicDataEndpointEnabled: to.Ptr(false), - // RequestedBackupStorageRedundancy: to.Ptr(armsql.BackupStorageRedundancyGeo), - // State: to.Ptr("Ready"), - // StorageSizeInGB: to.Ptr[int32](1024), - // SubnetID: to.Ptr("/subscriptions/20D7082A-0FC7-4468-82BD-542694D5042B/resourceGroups/Test1/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1"), - // VCores: to.Ptr[int32](16), - // }, - // SKU: &armsql.SKU{ - // Name: to.Ptr("GP_Gen5"), - // Capacity: to.Ptr[int32](16), - // Family: to.Ptr("Gen5"), - // Tier: to.Ptr("GeneralPurpose"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ManagedInstanceListByInstancePoolWithExpandEqualsAdministrators.json -func ExampleManagedInstancesClient_NewListByInstancePoolPager_listManagedInstancesByInstancePoolWithExpandAdministratorsActivedirectory() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewManagedInstancesClient().NewListByInstancePoolPager("Test1", "pool1", &armsql.ManagedInstancesClientListByInstancePoolOptions{Expand: nil}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ManagedInstanceListResult = armsql.ManagedInstanceListResult{ - // Value: []*armsql.ManagedInstance{ - // { - // Name: to.Ptr("testinstance1"), - // Type: to.Ptr("Microsoft.Sql/managedInstances"), - // ID: to.Ptr("/subscriptions/20D7082A-0FC7-4468-82BD-542694D5042B/resourceGroups/Test1/providers/Microsoft.Sql/managedInstances/testinstance1"), - // Location: to.Ptr("canadacentral"), - // Properties: &armsql.ManagedInstanceProperties{ - // AdministratorLogin: to.Ptr("dummylogin"), - // Administrators: &armsql.ManagedInstanceExternalAdministrator{ - // AzureADOnlyAuthentication: to.Ptr(true), - // Login: to.Ptr("bob@contoso.com"), - // PrincipalType: to.Ptr(armsql.PrincipalTypeUser), - // Sid: to.Ptr("00000011-1111-2222-2222-123456789111"), - // TenantID: to.Ptr("00000011-1111-2222-2222-123456789111"), - // }, - // Collation: to.Ptr("SQL_Latin1_General_CP1_CI_AS"), - // CurrentBackupStorageRedundancy: to.Ptr(armsql.BackupStorageRedundancyGeo), - // DNSZone: to.Ptr("1b4e2caff2530"), - // FullyQualifiedDomainName: to.Ptr("testinstance1.1b4e2caff2530.database.windows.net"), - // InstancePoolID: to.Ptr("/subscriptions/20D7082A-0FC7-4468-82BD-542694D5042B/resourceGroups/Test1/providers/Microsoft.Sql/instancePools/pool1"), - // LicenseType: to.Ptr(armsql.ManagedInstanceLicenseTypeLicenseIncluded), - // MaintenanceConfigurationID: to.Ptr("/subscriptions/20D7082A-0FC7-4468-82BD-542694D5042B/providers/Microsoft.Maintenance/publicMaintenanceConfigurations/SQL_CanadaCentral_MI_1"), - // MinimalTLSVersion: to.Ptr("1.2"), - // ProvisioningState: to.Ptr(armsql.ManagedInstancePropertiesProvisioningStateSucceeded), - // ProxyOverride: to.Ptr(armsql.ManagedInstanceProxyOverrideRedirect), - // PublicDataEndpointEnabled: to.Ptr(false), - // RequestedBackupStorageRedundancy: to.Ptr(armsql.BackupStorageRedundancyGeo), - // State: to.Ptr("Ready"), - // StorageSizeInGB: to.Ptr[int32](1024), - // SubnetID: to.Ptr("/subscriptions/20D7082A-0FC7-4468-82BD-542694D5042B/resourceGroups/Test1/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1"), - // VCores: to.Ptr[int32](8), - // }, - // SKU: &armsql.SKU{ - // Name: to.Ptr("GP_Gen5"), - // Capacity: to.Ptr[int32](8), - // Family: to.Ptr("Gen5"), - // Tier: to.Ptr("GeneralPurpose"), - // }, - // }, - // { - // Name: to.Ptr("testinstance2"), - // Type: to.Ptr("Microsoft.Sql/managedInstances"), - // ID: to.Ptr("/subscriptions/20D7082A-0FC7-4468-82BD-542694D5042B/resourceGroups/Test1/providers/Microsoft.Sql/managedInstances/testinstance2"), - // Location: to.Ptr("canadacentral"), - // Properties: &armsql.ManagedInstanceProperties{ - // AdministratorLogin: to.Ptr("dummylogin"), - // Administrators: &armsql.ManagedInstanceExternalAdministrator{ - // AzureADOnlyAuthentication: to.Ptr(true), - // Login: to.Ptr("bob@contoso.com"), - // PrincipalType: to.Ptr(armsql.PrincipalTypeUser), - // Sid: to.Ptr("00000011-1111-2222-2222-123456789111"), - // TenantID: to.Ptr("00000011-1111-2222-2222-123456789111"), - // }, - // Collation: to.Ptr("SQL_Latin1_General_CP1_CI_AS"), - // CurrentBackupStorageRedundancy: to.Ptr(armsql.BackupStorageRedundancyGeo), - // DNSZone: to.Ptr("2c3d1bdae3412"), - // FullyQualifiedDomainName: to.Ptr("testinstance2.2c3d1bdae3412.database.windows.net"), - // InstancePoolID: to.Ptr("/subscriptions/20D7082A-0FC7-4468-82BD-542694D5042B/resourceGroups/Test1/providers/Microsoft.Sql/instancePools/pool1"), - // LicenseType: to.Ptr(armsql.ManagedInstanceLicenseType("Full")), - // MaintenanceConfigurationID: to.Ptr("/subscriptions/20D7082A-0FC7-4468-82BD-542694D5042B/providers/Microsoft.Maintenance/publicMaintenanceConfigurations/SQL_CanadaCentral_MI_2"), - // MinimalTLSVersion: to.Ptr("1.2"), - // ProvisioningState: to.Ptr(armsql.ManagedInstancePropertiesProvisioningStateSucceeded), - // ProxyOverride: to.Ptr(armsql.ManagedInstanceProxyOverrideRedirect), - // PublicDataEndpointEnabled: to.Ptr(false), - // RequestedBackupStorageRedundancy: to.Ptr(armsql.BackupStorageRedundancyGeo), - // State: to.Ptr("Ready"), - // StorageSizeInGB: to.Ptr[int32](1024), - // SubnetID: to.Ptr("/subscriptions/20D7082A-0FC7-4468-82BD-542694D5042B/resourceGroups/Test1/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1"), - // VCores: to.Ptr[int32](16), - // }, - // SKU: &armsql.SKU{ - // Name: to.Ptr("GP_Gen5"), - // Capacity: to.Ptr[int32](16), - // Family: to.Ptr("Gen5"), - // Tier: to.Ptr("GeneralPurpose"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ManagedInstanceList.json -func ExampleManagedInstancesClient_NewListPager_listManagedInstances() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewManagedInstancesClient().NewListPager(&armsql.ManagedInstancesClientListOptions{Expand: nil}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ManagedInstanceListResult = armsql.ManagedInstanceListResult{ - // Value: []*armsql.ManagedInstance{ - // { - // Name: to.Ptr("testinstance1"), - // Type: to.Ptr("Microsoft.Sql/managedInstances"), - // ID: to.Ptr("/subscriptions/20d7082a-0fc7-4468-82bd-542694d5042b/resourceGroups/Test1/providers/Microsoft.Sql/managedInstances/testinstance1"), - // Location: to.Ptr("japaneast"), - // Properties: &armsql.ManagedInstanceProperties{ - // AdministratorLogin: to.Ptr("dummylogin"), - // Collation: to.Ptr("SQL_Latin1_General_CP1_CI_AS"), - // CurrentBackupStorageRedundancy: to.Ptr(armsql.BackupStorageRedundancyGeo), - // DNSZone: to.Ptr("1b4e2caff2530"), - // FullyQualifiedDomainName: to.Ptr("testinstance1.1b4e2caff2530.database.windows.net"), - // LicenseType: to.Ptr(armsql.ManagedInstanceLicenseTypeLicenseIncluded), - // MaintenanceConfigurationID: to.Ptr("/subscriptions/20D7082A-0FC7-4468-82BD-542694D5042B/providers/Microsoft.Maintenance/publicMaintenanceConfigurations/SQL_JapanEast_MI_1"), - // MinimalTLSVersion: to.Ptr("1.2"), - // ProvisioningState: to.Ptr(armsql.ManagedInstancePropertiesProvisioningStateSucceeded), - // ProxyOverride: to.Ptr(armsql.ManagedInstanceProxyOverrideDefault), - // PublicDataEndpointEnabled: to.Ptr(false), - // RequestedBackupStorageRedundancy: to.Ptr(armsql.BackupStorageRedundancyGeo), - // State: to.Ptr("Ready"), - // StorageSizeInGB: to.Ptr[int32](1024), - // SubnetID: to.Ptr("/subscriptions/20D7082A-0FC7-4468-82BD-542694D5042B/resourceGroups/testrg/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1"), - // VCores: to.Ptr[int32](8), - // }, - // SKU: &armsql.SKU{ - // Name: to.Ptr("GP_Gen4"), - // Capacity: to.Ptr[int32](8), - // Family: to.Ptr("Gen4"), - // Tier: to.Ptr("GeneralPurpose"), - // }, - // }, - // { - // Name: to.Ptr("testinstance2"), - // Type: to.Ptr("Microsoft.Sql/managedInstances"), - // ID: to.Ptr("/subscriptions/20d7082a-0fc7-4468-82bd-542694d5042b/resourceGroups/Test1/providers/Microsoft.Sql/managedInstances/testinstance2"), - // Location: to.Ptr("japaneast"), - // Properties: &armsql.ManagedInstanceProperties{ - // AdministratorLogin: to.Ptr("dummylogin"), - // Collation: to.Ptr("SQL_Latin1_General_CP1_CI_AS"), - // CurrentBackupStorageRedundancy: to.Ptr(armsql.BackupStorageRedundancyGeo), - // DNSZone: to.Ptr("2c3d1bdae3412"), - // FullyQualifiedDomainName: to.Ptr("testinstance2.2c3d1bdae3412.database.windows.net"), - // LicenseType: to.Ptr(armsql.ManagedInstanceLicenseType("Full")), - // MaintenanceConfigurationID: to.Ptr("/subscriptions/20D7082A-0FC7-4468-82BD-542694D5042B/providers/Microsoft.Maintenance/publicMaintenanceConfigurations/SQL_JapanEast_MI_1"), - // MinimalTLSVersion: to.Ptr("1.2"), - // ProvisioningState: to.Ptr(armsql.ManagedInstancePropertiesProvisioningStateSucceeded), - // ProxyOverride: to.Ptr(armsql.ManagedInstanceProxyOverrideDefault), - // PublicDataEndpointEnabled: to.Ptr(false), - // RequestedBackupStorageRedundancy: to.Ptr(armsql.BackupStorageRedundancyGeo), - // State: to.Ptr("Ready"), - // StorageSizeInGB: to.Ptr[int32](1024), - // SubnetID: to.Ptr("/subscriptions/20D7082A-0FC7-4468-82BD-542694D5042B/resourceGroups/testrg/providers/Microsoft.Network/virtualNetworks/vnet2/subnets/subnet2"), - // VCores: to.Ptr[int32](16), - // }, - // SKU: &armsql.SKU{ - // Name: to.Ptr("BC_Gen5"), - // Capacity: to.Ptr[int32](16), - // Family: to.Ptr("Gen4"), - // Tier: to.Ptr("BusinessCritical"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ManagedInstanceListWithExpandEqualsAdministrators.json -func ExampleManagedInstancesClient_NewListPager_listManagedInstancesWithExpandAdministratorsActivedirectory() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewManagedInstancesClient().NewListPager(&armsql.ManagedInstancesClientListOptions{Expand: nil}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ManagedInstanceListResult = armsql.ManagedInstanceListResult{ - // Value: []*armsql.ManagedInstance{ - // { - // Name: to.Ptr("testinstance1"), - // Type: to.Ptr("Microsoft.Sql/managedInstances"), - // ID: to.Ptr("/subscriptions/20d7082a-0fc7-4468-82bd-542694d5042b/resourceGroups/Test1/providers/Microsoft.Sql/managedInstances/testinstance1"), - // Location: to.Ptr("japaneast"), - // Properties: &armsql.ManagedInstanceProperties{ - // AdministratorLogin: to.Ptr("dummylogin"), - // Administrators: &armsql.ManagedInstanceExternalAdministrator{ - // AzureADOnlyAuthentication: to.Ptr(true), - // Login: to.Ptr("bob@contoso.com"), - // PrincipalType: to.Ptr(armsql.PrincipalTypeUser), - // Sid: to.Ptr("00000011-1111-2222-2222-123456789111"), - // TenantID: to.Ptr("00000011-1111-2222-2222-123456789111"), - // }, - // Collation: to.Ptr("SQL_Latin1_General_CP1_CI_AS"), - // CurrentBackupStorageRedundancy: to.Ptr(armsql.BackupStorageRedundancyGeo), - // DNSZone: to.Ptr("1b4e2caff2530"), - // FullyQualifiedDomainName: to.Ptr("testinstance1.1b4e2caff2530.database.windows.net"), - // LicenseType: to.Ptr(armsql.ManagedInstanceLicenseTypeLicenseIncluded), - // MaintenanceConfigurationID: to.Ptr("/subscriptions/20D7082A-0FC7-4468-82BD-542694D5042B/providers/Microsoft.Maintenance/publicMaintenanceConfigurations/SQL_JapanEast_MI_1"), - // MinimalTLSVersion: to.Ptr("1.2"), - // ProvisioningState: to.Ptr(armsql.ManagedInstancePropertiesProvisioningStateSucceeded), - // ProxyOverride: to.Ptr(armsql.ManagedInstanceProxyOverrideDefault), - // PublicDataEndpointEnabled: to.Ptr(false), - // RequestedBackupStorageRedundancy: to.Ptr(armsql.BackupStorageRedundancyGeo), - // State: to.Ptr("Ready"), - // StorageSizeInGB: to.Ptr[int32](1024), - // SubnetID: to.Ptr("/subscriptions/20D7082A-0FC7-4468-82BD-542694D5042B/resourceGroups/testrg/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1"), - // VCores: to.Ptr[int32](8), - // }, - // SKU: &armsql.SKU{ - // Name: to.Ptr("GP_Gen4"), - // Capacity: to.Ptr[int32](8), - // Family: to.Ptr("Gen4"), - // Tier: to.Ptr("GeneralPurpose"), - // }, - // }, - // { - // Name: to.Ptr("testinstance2"), - // Type: to.Ptr("Microsoft.Sql/managedInstances"), - // ID: to.Ptr("/subscriptions/20d7082a-0fc7-4468-82bd-542694d5042b/resourceGroups/Test1/providers/Microsoft.Sql/managedInstances/testinstance2"), - // Location: to.Ptr("japaneast"), - // Properties: &armsql.ManagedInstanceProperties{ - // AdministratorLogin: to.Ptr("dummylogin"), - // Administrators: &armsql.ManagedInstanceExternalAdministrator{ - // AzureADOnlyAuthentication: to.Ptr(true), - // Login: to.Ptr("bob@contoso.com"), - // PrincipalType: to.Ptr(armsql.PrincipalTypeUser), - // Sid: to.Ptr("00000011-1111-2222-2222-123456789111"), - // TenantID: to.Ptr("00000011-1111-2222-2222-123456789111"), - // }, - // Collation: to.Ptr("SQL_Latin1_General_CP1_CI_AS"), - // CurrentBackupStorageRedundancy: to.Ptr(armsql.BackupStorageRedundancyGeo), - // DNSZone: to.Ptr("2c3d1bdae3412"), - // FullyQualifiedDomainName: to.Ptr("testinstance2.2c3d1bdae3412.database.windows.net"), - // LicenseType: to.Ptr(armsql.ManagedInstanceLicenseType("Full")), - // MaintenanceConfigurationID: to.Ptr("/subscriptions/20D7082A-0FC7-4468-82BD-542694D5042B/providers/Microsoft.Maintenance/publicMaintenanceConfigurations/SQL_JapanEast_MI_2"), - // MinimalTLSVersion: to.Ptr("1.2"), - // ProvisioningState: to.Ptr(armsql.ManagedInstancePropertiesProvisioningStateSucceeded), - // ProxyOverride: to.Ptr(armsql.ManagedInstanceProxyOverrideDefault), - // PublicDataEndpointEnabled: to.Ptr(false), - // RequestedBackupStorageRedundancy: to.Ptr(armsql.BackupStorageRedundancyGeo), - // State: to.Ptr("Ready"), - // StorageSizeInGB: to.Ptr[int32](1024), - // SubnetID: to.Ptr("/subscriptions/20D7082A-0FC7-4468-82BD-542694D5042B/resourceGroups/testrg/providers/Microsoft.Network/virtualNetworks/vnet2/subnets/subnet2"), - // VCores: to.Ptr[int32](16), - // }, - // SKU: &armsql.SKU{ - // Name: to.Ptr("BC_Gen5"), - // Capacity: to.Ptr[int32](16), - // Family: to.Ptr("Gen4"), - // Tier: to.Ptr("BusinessCritical"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ManagedInstanceListByResourceGroup.json -func ExampleManagedInstancesClient_NewListByResourceGroupPager_listManagedInstancesByResourceGroup() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewManagedInstancesClient().NewListByResourceGroupPager("Test1", &armsql.ManagedInstancesClientListByResourceGroupOptions{Expand: nil}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ManagedInstanceListResult = armsql.ManagedInstanceListResult{ - // Value: []*armsql.ManagedInstance{ - // { - // Name: to.Ptr("testinstance1"), - // Type: to.Ptr("Microsoft.Sql/managedInstances"), - // ID: to.Ptr("/subscriptions/20d7082a-0fc7-4468-82bd-542694d5042b/resourceGroups/Test1/providers/Microsoft.Sql/managedInstances/testinstance1"), - // Location: to.Ptr("japaneast"), - // Properties: &armsql.ManagedInstanceProperties{ - // AdministratorLogin: to.Ptr("dummylogin"), - // Collation: to.Ptr("SQL_Latin1_General_CP1_CI_AS"), - // CurrentBackupStorageRedundancy: to.Ptr(armsql.BackupStorageRedundancyGeo), - // DNSZone: to.Ptr("1b4e2caff2530"), - // FullyQualifiedDomainName: to.Ptr("testinstance1.1b4e2caff2530.database.windows.net"), - // LicenseType: to.Ptr(armsql.ManagedInstanceLicenseTypeLicenseIncluded), - // MaintenanceConfigurationID: to.Ptr("/subscriptions/20d7082a-0fc7-4468-82bd-542694d5042b/providers/Microsoft.Maintenance/publicMaintenanceConfigurations/SQL_JapanEast_MI_1"), - // MinimalTLSVersion: to.Ptr("1.2"), - // ProvisioningState: to.Ptr(armsql.ManagedInstancePropertiesProvisioningStateSucceeded), - // ProxyOverride: to.Ptr(armsql.ManagedInstanceProxyOverrideDefault), - // PublicDataEndpointEnabled: to.Ptr(false), - // RequestedBackupStorageRedundancy: to.Ptr(armsql.BackupStorageRedundancyGeo), - // State: to.Ptr("Ready"), - // StorageSizeInGB: to.Ptr[int32](1024), - // SubnetID: to.Ptr("/subscriptions/20D7082A-0FC7-4468-82BD-542694D5042B/resourceGroups/testrg/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1"), - // VCores: to.Ptr[int32](8), - // }, - // SKU: &armsql.SKU{ - // Name: to.Ptr("GP_Gen4"), - // Capacity: to.Ptr[int32](8), - // Family: to.Ptr("Gen4"), - // Tier: to.Ptr("GeneralPurpose"), - // }, - // }, - // { - // Name: to.Ptr("testinstance2"), - // Type: to.Ptr("Microsoft.Sql/managedInstances"), - // ID: to.Ptr("/subscriptions/20d7082a-0fc7-4468-82bd-542694d5042b/resourceGroups/Test1/providers/Microsoft.Sql/managedInstances/testinstance2"), - // Location: to.Ptr("japaneast"), - // Properties: &armsql.ManagedInstanceProperties{ - // AdministratorLogin: to.Ptr("dummylogin"), - // Collation: to.Ptr("SQL_Latin1_General_CP1_CI_AS"), - // CurrentBackupStorageRedundancy: to.Ptr(armsql.BackupStorageRedundancyGeo), - // DNSZone: to.Ptr("2c3d1bdae3412"), - // FullyQualifiedDomainName: to.Ptr("testinstance2.2c3d1bdae3412.database.windows.net"), - // LicenseType: to.Ptr(armsql.ManagedInstanceLicenseType("Full")), - // MaintenanceConfigurationID: to.Ptr("/subscriptions/20d7082a-0fc7-4468-82bd-542694d5042b/providers/Microsoft.Maintenance/publicMaintenanceConfigurations/SQL_JapanEast_MI_1"), - // MinimalTLSVersion: to.Ptr("1.2"), - // ProvisioningState: to.Ptr(armsql.ManagedInstancePropertiesProvisioningStateSucceeded), - // ProxyOverride: to.Ptr(armsql.ManagedInstanceProxyOverrideDefault), - // PublicDataEndpointEnabled: to.Ptr(false), - // RequestedBackupStorageRedundancy: to.Ptr(armsql.BackupStorageRedundancyGeo), - // State: to.Ptr("Ready"), - // StorageSizeInGB: to.Ptr[int32](1024), - // SubnetID: to.Ptr("/subscriptions/20D7082A-0FC7-4468-82BD-542694D5042B/resourceGroups/testrg/providers/Microsoft.Network/virtualNetworks/vnet2/subnets/subnet2"), - // VCores: to.Ptr[int32](16), - // }, - // SKU: &armsql.SKU{ - // Name: to.Ptr("BC_Gen5"), - // Capacity: to.Ptr[int32](16), - // Family: to.Ptr("Gen4"), - // Tier: to.Ptr("BusinessCritical"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ManagedInstanceListByResourceGroupWithExpandEqualsAdministrators.json -func ExampleManagedInstancesClient_NewListByResourceGroupPager_listManagedInstancesByResourceGroupWithExpandAdministratorsActivedirectory() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewManagedInstancesClient().NewListByResourceGroupPager("Test1", &armsql.ManagedInstancesClientListByResourceGroupOptions{Expand: nil}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ManagedInstanceListResult = armsql.ManagedInstanceListResult{ - // Value: []*armsql.ManagedInstance{ - // { - // Name: to.Ptr("testinstance1"), - // Type: to.Ptr("Microsoft.Sql/managedInstances"), - // ID: to.Ptr("/subscriptions/20d7082a-0fc7-4468-82bd-542694d5042b/resourceGroups/Test1/providers/Microsoft.Sql/managedInstances/testinstance1"), - // Location: to.Ptr("japaneast"), - // Properties: &armsql.ManagedInstanceProperties{ - // AdministratorLogin: to.Ptr("dummylogin"), - // Administrators: &armsql.ManagedInstanceExternalAdministrator{ - // AzureADOnlyAuthentication: to.Ptr(true), - // Login: to.Ptr("bob@contoso.com"), - // PrincipalType: to.Ptr(armsql.PrincipalTypeUser), - // Sid: to.Ptr("00000011-1111-2222-2222-123456789111"), - // TenantID: to.Ptr("00000011-1111-2222-2222-123456789111"), - // }, - // Collation: to.Ptr("SQL_Latin1_General_CP1_CI_AS"), - // CurrentBackupStorageRedundancy: to.Ptr(armsql.BackupStorageRedundancyGeo), - // DNSZone: to.Ptr("1b4e2caff2530"), - // FullyQualifiedDomainName: to.Ptr("testinstance1.1b4e2caff2530.database.windows.net"), - // LicenseType: to.Ptr(armsql.ManagedInstanceLicenseTypeLicenseIncluded), - // MaintenanceConfigurationID: to.Ptr("/subscriptions/20D7082A-0FC7-4468-82BD-542694D5042B/providers/Microsoft.Maintenance/publicMaintenanceConfigurations/SQL_JapanEast_MI_1"), - // MinimalTLSVersion: to.Ptr("1.2"), - // ProvisioningState: to.Ptr(armsql.ManagedInstancePropertiesProvisioningStateSucceeded), - // ProxyOverride: to.Ptr(armsql.ManagedInstanceProxyOverrideDefault), - // PublicDataEndpointEnabled: to.Ptr(false), - // RequestedBackupStorageRedundancy: to.Ptr(armsql.BackupStorageRedundancyGeo), - // State: to.Ptr("Ready"), - // StorageSizeInGB: to.Ptr[int32](1024), - // SubnetID: to.Ptr("/subscriptions/20D7082A-0FC7-4468-82BD-542694D5042B/resourceGroups/testrg/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1"), - // VCores: to.Ptr[int32](8), - // }, - // SKU: &armsql.SKU{ - // Name: to.Ptr("GP_Gen4"), - // Capacity: to.Ptr[int32](8), - // Family: to.Ptr("Gen4"), - // Tier: to.Ptr("GeneralPurpose"), - // }, - // }, - // { - // Name: to.Ptr("testinstance2"), - // Type: to.Ptr("Microsoft.Sql/managedInstances"), - // ID: to.Ptr("/subscriptions/20d7082a-0fc7-4468-82bd-542694d5042b/resourceGroups/Test1/providers/Microsoft.Sql/managedInstances/testinstance2"), - // Location: to.Ptr("japaneast"), - // Properties: &armsql.ManagedInstanceProperties{ - // AdministratorLogin: to.Ptr("dummylogin"), - // Administrators: &armsql.ManagedInstanceExternalAdministrator{ - // AzureADOnlyAuthentication: to.Ptr(true), - // Login: to.Ptr("bob@contoso.com"), - // PrincipalType: to.Ptr(armsql.PrincipalTypeUser), - // Sid: to.Ptr("00000011-1111-2222-2222-123456789111"), - // TenantID: to.Ptr("00000011-1111-2222-2222-123456789111"), - // }, - // Collation: to.Ptr("SQL_Latin1_General_CP1_CI_AS"), - // CurrentBackupStorageRedundancy: to.Ptr(armsql.BackupStorageRedundancyGeo), - // DNSZone: to.Ptr("2c3d1bdae3412"), - // FullyQualifiedDomainName: to.Ptr("testinstance2.2c3d1bdae3412.database.windows.net"), - // LicenseType: to.Ptr(armsql.ManagedInstanceLicenseType("Full")), - // MaintenanceConfigurationID: to.Ptr("/subscriptions/20D7082A-0FC7-4468-82BD-542694D5042B/providers/Microsoft.Maintenance/publicMaintenanceConfigurations/SQL_JapanEast_MI_2"), - // MinimalTLSVersion: to.Ptr("1.2"), - // ProvisioningState: to.Ptr(armsql.ManagedInstancePropertiesProvisioningStateSucceeded), - // ProxyOverride: to.Ptr(armsql.ManagedInstanceProxyOverrideDefault), - // PublicDataEndpointEnabled: to.Ptr(false), - // RequestedBackupStorageRedundancy: to.Ptr(armsql.BackupStorageRedundancyGeo), - // State: to.Ptr("Ready"), - // StorageSizeInGB: to.Ptr[int32](1024), - // SubnetID: to.Ptr("/subscriptions/20D7082A-0FC7-4468-82BD-542694D5042B/resourceGroups/testrg/providers/Microsoft.Network/virtualNetworks/vnet2/subnets/subnet2"), - // VCores: to.Ptr[int32](16), - // }, - // SKU: &armsql.SKU{ - // Name: to.Ptr("BC_Gen5"), - // Capacity: to.Ptr[int32](16), - // Family: to.Ptr("Gen4"), - // Tier: to.Ptr("BusinessCritical"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ManagedInstanceGet.json -func ExampleManagedInstancesClient_Get_getManagedInstance() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewManagedInstancesClient().Get(ctx, "testrg", "testinstance", &armsql.ManagedInstancesClientGetOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ManagedInstance = armsql.ManagedInstance{ - // Name: to.Ptr("testinstance"), - // Type: to.Ptr("Microsoft.Sql/managedInstances"), - // ID: to.Ptr("/subscriptions/20d7082a-0fc7-4468-82bd-542694d5042b/resourceGroups/testrg/providers/Microsoft.Sql/managedInstances/testinstance"), - // Location: to.Ptr("japaneast"), - // Tags: map[string]*string{ - // "key": to.Ptr("value"), - // }, - // Properties: &armsql.ManagedInstanceProperties{ - // AdministratorLogin: to.Ptr("dummylogin"), - // Collation: to.Ptr("SQL_Latin1_General_CP1_CI_AS"), - // CurrentBackupStorageRedundancy: to.Ptr(armsql.BackupStorageRedundancyGeo), - // DNSZone: to.Ptr("1b4e2caff2530"), - // FullyQualifiedDomainName: to.Ptr("testinstance.1b4e2caff2530.database.windows.net"), - // InstancePoolID: to.Ptr("/subscriptions/20d7082a-0fc7-4468-82bd-542694d5042b/resourceGroups/testrg/providers/Microsoft.Sql/instancePools/instancePool1"), - // LicenseType: to.Ptr(armsql.ManagedInstanceLicenseTypeLicenseIncluded), - // MaintenanceConfigurationID: to.Ptr("/subscriptions/20D7082A-0FC7-4468-82BD-542694D5042B/providers/Microsoft.Maintenance/publicMaintenanceConfigurations/SQL_JapanEast_MI_1"), - // MinimalTLSVersion: to.Ptr("1.2"), - // ProvisioningState: to.Ptr(armsql.ManagedInstancePropertiesProvisioningStateSucceeded), - // ProxyOverride: to.Ptr(armsql.ManagedInstanceProxyOverrideDefault), - // PublicDataEndpointEnabled: to.Ptr(false), - // RequestedBackupStorageRedundancy: to.Ptr(armsql.BackupStorageRedundancyGeo), - // ServicePrincipal: &armsql.ServicePrincipal{ - // Type: to.Ptr(armsql.ServicePrincipalTypeSystemAssigned), - // ClientID: to.Ptr("00000011-1111-2222-2222-123456789111"), - // PrincipalID: to.Ptr("00000011-1111-2222-2222-123456789111"), - // TenantID: to.Ptr("00000011-1111-2222-2222-123456789111"), - // }, - // State: to.Ptr("Ready"), - // StorageSizeInGB: to.Ptr[int32](1024), - // SubnetID: to.Ptr("/subscriptions/20D7082A-0FC7-4468-82BD-542694D5042B/resourceGroups/testrg/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1"), - // VCores: to.Ptr[int32](8), - // }, - // SKU: &armsql.SKU{ - // Name: to.Ptr("GP_Gen4"), - // Capacity: to.Ptr[int32](8), - // Family: to.Ptr("Gen4"), - // Tier: to.Ptr("GeneralPurpose"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ManagedInstanceGetWithExpandEqualsAdministrators.json -func ExampleManagedInstancesClient_Get_getManagedInstanceWithExpandAdministratorsActivedirectory() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewManagedInstancesClient().Get(ctx, "testrg", "testinstance", &armsql.ManagedInstancesClientGetOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ManagedInstance = armsql.ManagedInstance{ - // Name: to.Ptr("testinstance"), - // Type: to.Ptr("Microsoft.Sql/managedInstances"), - // ID: to.Ptr("/subscriptions/20d7082a-0fc7-4468-82bd-542694d5042b/resourceGroups/testrg/providers/Microsoft.Sql/managedInstances/testinstance"), - // Location: to.Ptr("japaneast"), - // Tags: map[string]*string{ - // "key": to.Ptr("value"), - // }, - // Properties: &armsql.ManagedInstanceProperties{ - // AdministratorLogin: to.Ptr("dummylogin"), - // Administrators: &armsql.ManagedInstanceExternalAdministrator{ - // AzureADOnlyAuthentication: to.Ptr(true), - // Login: to.Ptr("bob@contoso.com"), - // PrincipalType: to.Ptr(armsql.PrincipalTypeUser), - // Sid: to.Ptr("00000011-1111-2222-2222-123456789111"), - // TenantID: to.Ptr("00000011-1111-2222-2222-123456789111"), - // }, - // Collation: to.Ptr("SQL_Latin1_General_CP1_CI_AS"), - // CurrentBackupStorageRedundancy: to.Ptr(armsql.BackupStorageRedundancyGeo), - // DNSZone: to.Ptr("1b4e2caff2530"), - // FullyQualifiedDomainName: to.Ptr("testinstance.1b4e2caff2530.database.windows.net"), - // InstancePoolID: to.Ptr("/subscriptions/20d7082a-0fc7-4468-82bd-542694d5042b/resourceGroups/testrg/providers/Microsoft.Sql/instancePools/instancePool1"), - // LicenseType: to.Ptr(armsql.ManagedInstanceLicenseTypeLicenseIncluded), - // MaintenanceConfigurationID: to.Ptr("/subscriptions/20D7082A-0FC7-4468-82BD-542694D5042B/providers/Microsoft.Maintenance/publicMaintenanceConfigurations/SQL_JapanEast_MI_1"), - // MinimalTLSVersion: to.Ptr("1.2"), - // ProvisioningState: to.Ptr(armsql.ManagedInstancePropertiesProvisioningStateSucceeded), - // ProxyOverride: to.Ptr(armsql.ManagedInstanceProxyOverrideDefault), - // PublicDataEndpointEnabled: to.Ptr(false), - // RequestedBackupStorageRedundancy: to.Ptr(armsql.BackupStorageRedundancyGeo), - // State: to.Ptr("Ready"), - // StorageSizeInGB: to.Ptr[int32](1024), - // SubnetID: to.Ptr("/subscriptions/20D7082A-0FC7-4468-82BD-542694D5042B/resourceGroups/testrg/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1"), - // VCores: to.Ptr[int32](8), - // }, - // SKU: &armsql.SKU{ - // Name: to.Ptr("GP_Gen4"), - // Capacity: to.Ptr[int32](8), - // Family: to.Ptr("Gen4"), - // Tier: to.Ptr("GeneralPurpose"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ManagedInstanceCreateMax.json -func ExampleManagedInstancesClient_BeginCreateOrUpdate_createManagedInstanceWithAllProperties() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewManagedInstancesClient().BeginCreateOrUpdate(ctx, "testrg", "testinstance", armsql.ManagedInstance{ - Location: to.Ptr("Japan East"), - Tags: map[string]*string{ - "tagKey1": to.Ptr("TagValue1"), - }, - Properties: &armsql.ManagedInstanceProperties{ - AdministratorLogin: to.Ptr("dummylogin"), - AdministratorLoginPassword: to.Ptr("PLACEHOLDER"), - Administrators: &armsql.ManagedInstanceExternalAdministrator{ - AzureADOnlyAuthentication: to.Ptr(true), - Login: to.Ptr("bob@contoso.com"), - PrincipalType: to.Ptr(armsql.PrincipalTypeUser), - Sid: to.Ptr("00000011-1111-2222-2222-123456789111"), - TenantID: to.Ptr("00000011-1111-2222-2222-123456789111"), - }, - Collation: to.Ptr("SQL_Latin1_General_CP1_CI_AS"), - DNSZonePartner: to.Ptr("/subscriptions/20D7082A-0FC7-4468-82BD-542694D5042B/resourceGroups/testrg/providers/Microsoft.Sql/managedInstances/testinstance"), - InstancePoolID: to.Ptr("/subscriptions/20D7082A-0FC7-4468-82BD-542694D5042B/resourceGroups/testrg/providers/Microsoft.Sql/instancePools/pool1"), - LicenseType: to.Ptr(armsql.ManagedInstanceLicenseTypeLicenseIncluded), - MaintenanceConfigurationID: to.Ptr("/subscriptions/20D7082A-0FC7-4468-82BD-542694D5042B/providers/Microsoft.Maintenance/publicMaintenanceConfigurations/SQL_JapanEast_MI_1"), - MinimalTLSVersion: to.Ptr("1.2"), - ProxyOverride: to.Ptr(armsql.ManagedInstanceProxyOverrideRedirect), - PublicDataEndpointEnabled: to.Ptr(false), - RequestedBackupStorageRedundancy: to.Ptr(armsql.BackupStorageRedundancyGeo), - ServicePrincipal: &armsql.ServicePrincipal{ - Type: to.Ptr(armsql.ServicePrincipalTypeSystemAssigned), - }, - StorageSizeInGB: to.Ptr[int32](1024), - SubnetID: to.Ptr("/subscriptions/20D7082A-0FC7-4468-82BD-542694D5042B/resourceGroups/testrg/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1"), - TimezoneID: to.Ptr("UTC"), - VCores: to.Ptr[int32](8), - }, - SKU: &armsql.SKU{ - Name: to.Ptr("GP_Gen5"), - Tier: to.Ptr("GeneralPurpose"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ManagedInstance = armsql.ManagedInstance{ - // Name: to.Ptr("testinstance"), - // Type: to.Ptr("Microsoft.Sql/managedInstances"), - // ID: to.Ptr("/subscriptions/20d7082a-0fc7-4468-82bd-542694d5042b/resourceGroups/testrg/providers/Microsoft.Sql/managedInstances/testinstance"), - // Location: to.Ptr("japaneast"), - // Tags: map[string]*string{ - // "tagKey1": to.Ptr("TagValue1"), - // }, - // Properties: &armsql.ManagedInstanceProperties{ - // AdministratorLogin: to.Ptr("dummylogin"), - // Administrators: &armsql.ManagedInstanceExternalAdministrator{ - // AzureADOnlyAuthentication: to.Ptr(true), - // Login: to.Ptr("bob@contoso.com"), - // PrincipalType: to.Ptr(armsql.PrincipalTypeUser), - // Sid: to.Ptr("00000011-1111-2222-2222-123456789111"), - // TenantID: to.Ptr("00000011-1111-2222-2222-123456789111"), - // }, - // Collation: to.Ptr("SQL_Latin1_General_CP1_CI_AS"), - // CurrentBackupStorageRedundancy: to.Ptr(armsql.BackupStorageRedundancyGeo), - // DNSZone: to.Ptr("1b4e2caff2530"), - // FullyQualifiedDomainName: to.Ptr("testinstance.1b4e2caff2530.database.windows.net"), - // InstancePoolID: to.Ptr("/subscriptions/20d7082a-0fc7-4468-82bd-542694d5042b/resourceGroups/testrg/providers/Microsoft.Sql/instancePools/pool1"), - // LicenseType: to.Ptr(armsql.ManagedInstanceLicenseTypeLicenseIncluded), - // MaintenanceConfigurationID: to.Ptr("/subscriptions/20D7082A-0FC7-4468-82BD-542694D5042B/providers/Microsoft.Maintenance/publicMaintenanceConfigurations/SQL_JapanEast_MI_1"), - // MinimalTLSVersion: to.Ptr("1.2"), - // ProvisioningState: to.Ptr(armsql.ManagedInstancePropertiesProvisioningStateSucceeded), - // ProxyOverride: to.Ptr(armsql.ManagedInstanceProxyOverrideRedirect), - // PublicDataEndpointEnabled: to.Ptr(false), - // RequestedBackupStorageRedundancy: to.Ptr(armsql.BackupStorageRedundancyGeo), - // ServicePrincipal: &armsql.ServicePrincipal{ - // Type: to.Ptr(armsql.ServicePrincipalTypeSystemAssigned), - // ClientID: to.Ptr("00000011-1111-2222-2222-123456789111"), - // PrincipalID: to.Ptr("00000011-1111-2222-2222-123456789111"), - // TenantID: to.Ptr("00000011-1111-2222-2222-123456789111"), - // }, - // State: to.Ptr("Ready"), - // StorageSizeInGB: to.Ptr[int32](1024), - // SubnetID: to.Ptr("/subscriptions/20D7082A-0FC7-4468-82BD-542694D5042B/resourceGroups/testrg/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1"), - // TimezoneID: to.Ptr("UTC"), - // VCores: to.Ptr[int32](8), - // }, - // SKU: &armsql.SKU{ - // Name: to.Ptr("GP_Gen5"), - // Capacity: to.Ptr[int32](8), - // Family: to.Ptr("Gen5"), - // Tier: to.Ptr("GeneralPurpose"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ManagedInstanceCreateMin.json -func ExampleManagedInstancesClient_BeginCreateOrUpdate_createManagedInstanceWithMinimalProperties() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewManagedInstancesClient().BeginCreateOrUpdate(ctx, "testrg", "testinstance", armsql.ManagedInstance{ - Location: to.Ptr("Japan East"), - Properties: &armsql.ManagedInstanceProperties{ - AdministratorLogin: to.Ptr("dummylogin"), - AdministratorLoginPassword: to.Ptr("PLACEHOLDER"), - LicenseType: to.Ptr(armsql.ManagedInstanceLicenseTypeLicenseIncluded), - StorageSizeInGB: to.Ptr[int32](1024), - SubnetID: to.Ptr("/subscriptions/20D7082A-0FC7-4468-82BD-542694D5042B/resourceGroups/testrg/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1"), - VCores: to.Ptr[int32](8), - }, - SKU: &armsql.SKU{ - Name: to.Ptr("GP_Gen4"), - Tier: to.Ptr("GeneralPurpose"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ManagedInstance = armsql.ManagedInstance{ - // Name: to.Ptr("testinstance"), - // Type: to.Ptr("Microsoft.Sql/managedInstances"), - // ID: to.Ptr("/subscriptions/20d7082a-0fc7-4468-82bd-542694d5042b/resourceGroups/testrg/providers/Microsoft.Sql/managedInstances/testinstance"), - // Location: to.Ptr("japaneast"), - // Tags: map[string]*string{ - // }, - // Properties: &armsql.ManagedInstanceProperties{ - // AdministratorLogin: to.Ptr("dummylogin"), - // Collation: to.Ptr("SQL_Latin1_General_CP1_CI_AS"), - // CurrentBackupStorageRedundancy: to.Ptr(armsql.BackupStorageRedundancyGeo), - // DNSZone: to.Ptr("1b4e2caff2530"), - // FullyQualifiedDomainName: to.Ptr("testinstance.1b4e2caff2530.database.windows.net"), - // LicenseType: to.Ptr(armsql.ManagedInstanceLicenseTypeLicenseIncluded), - // ProvisioningState: to.Ptr(armsql.ManagedInstancePropertiesProvisioningStateSucceeded), - // ProxyOverride: to.Ptr(armsql.ManagedInstanceProxyOverrideRedirect), - // PublicDataEndpointEnabled: to.Ptr(false), - // RequestedBackupStorageRedundancy: to.Ptr(armsql.BackupStorageRedundancyGeo), - // State: to.Ptr("Ready"), - // StorageSizeInGB: to.Ptr[int32](1024), - // SubnetID: to.Ptr("/subscriptions/20D7082A-0FC7-4468-82BD-542694D5042B/resourceGroups/testrg/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1"), - // VCores: to.Ptr[int32](8), - // }, - // SKU: &armsql.SKU{ - // Name: to.Ptr("GP_Gen4"), - // Capacity: to.Ptr[int32](8), - // Family: to.Ptr("Gen4"), - // Tier: to.Ptr("GeneralPurpose"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ManagedInstanceDelete.json -func ExampleManagedInstancesClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewManagedInstancesClient().BeginDelete(ctx, "testrg", "testinstance", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ManagedInstanceRemoveMaintenanceConfiguration.json -func ExampleManagedInstancesClient_BeginUpdate_removeMaintenancePolicyFromManagedInstanceSelectDefaultMaintenancePolicy() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewManagedInstancesClient().BeginUpdate(ctx, "testrg", "testinstance", armsql.ManagedInstanceUpdate{ - Properties: &armsql.ManagedInstanceProperties{ - MaintenanceConfigurationID: to.Ptr("/subscriptions/20d7082a-0fc7-4468-82bd-542694d5042b/providers/Microsoft.Maintenance/publicMaintenanceConfigurations/SQL_Default"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ManagedInstance = armsql.ManagedInstance{ - // Name: to.Ptr("testinstance"), - // Type: to.Ptr("Microsoft.Sql/managedInstances"), - // ID: to.Ptr("/subscriptions/20d7082a-0fc7-4468-82bd-542694d5042b/resourceGroups/testrg/providers/Microsoft.Sql/managedInstances/testinstance"), - // Location: to.Ptr("japaneast"), - // Properties: &armsql.ManagedInstanceProperties{ - // AdministratorLogin: to.Ptr("dummylogin"), - // Collation: to.Ptr("SQL_Latin1_General_CP1_CI_AS"), - // DNSZone: to.Ptr("1b4e2caff2530"), - // FullyQualifiedDomainName: to.Ptr("testinstance.1b4e2caff2530.database.windows.net"), - // InstancePoolID: to.Ptr("/subscriptions/20d7082a-0fc7-4468-82bd-542694d5042b/resourceGroups/testrg/providers/Microsoft.Sql/instancePools/instancePool1"), - // LicenseType: to.Ptr(armsql.ManagedInstanceLicenseTypeLicenseIncluded), - // MaintenanceConfigurationID: to.Ptr("/subscriptions/20d7082a-0fc7-4468-82bd-542694d5042b/providers/Microsoft.Maintenance/publicMaintenanceConfigurations/SQL_Default"), - // ProxyOverride: to.Ptr(armsql.ManagedInstanceProxyOverrideDefault), - // PublicDataEndpointEnabled: to.Ptr(false), - // State: to.Ptr("Ready"), - // StorageSizeInGB: to.Ptr[int32](1024), - // SubnetID: to.Ptr("/subscriptions/20D7082A-0FC7-4468-82BD-542694D5042B/resourceGroups/testrg/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1"), - // VCores: to.Ptr[int32](8), - // }, - // SKU: &armsql.SKU{ - // Name: to.Ptr("GP_Gen4"), - // Capacity: to.Ptr[int32](8), - // Family: to.Ptr("Gen4"), - // Tier: to.Ptr("GeneralPurpose"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ManagedInstanceUpdateMax.json -func ExampleManagedInstancesClient_BeginUpdate_updateManagedInstanceWithAllProperties() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewManagedInstancesClient().BeginUpdate(ctx, "testrg", "testinstance", armsql.ManagedInstanceUpdate{ - Properties: &armsql.ManagedInstanceProperties{ - AdministratorLogin: to.Ptr("dummylogin"), - AdministratorLoginPassword: to.Ptr("PLACEHOLDER"), - Collation: to.Ptr("SQL_Latin1_General_CP1_CI_AS"), - LicenseType: to.Ptr(armsql.ManagedInstanceLicenseTypeBasePrice), - MaintenanceConfigurationID: to.Ptr("/subscriptions/20D7082A-0FC7-4468-82BD-542694D5042B/providers/Microsoft.Maintenance/publicMaintenanceConfigurations/SQL_JapanEast_MI_1"), - MinimalTLSVersion: to.Ptr("1.2"), - ProxyOverride: to.Ptr(armsql.ManagedInstanceProxyOverrideRedirect), - PublicDataEndpointEnabled: to.Ptr(false), - RequestedBackupStorageRedundancy: to.Ptr(armsql.BackupStorageRedundancyGeo), - StorageSizeInGB: to.Ptr[int32](448), - VCores: to.Ptr[int32](8), - }, - SKU: &armsql.SKU{ - Name: to.Ptr("GP_Gen4"), - Capacity: to.Ptr[int32](8), - Tier: to.Ptr("GeneralPurpose"), - }, - Tags: map[string]*string{ - "tagKey1": to.Ptr("TagValue1"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ManagedInstance = armsql.ManagedInstance{ - // Name: to.Ptr("testinstance"), - // Type: to.Ptr("Microsoft.Sql/managedInstances"), - // ID: to.Ptr("/subscriptions/20D7082A-0FC7-4468-82BD-542694D5042B/resourceGroups/testrg/providers/Microsoft.Sql/managedInstances/testinstance"), - // Location: to.Ptr("japaneast"), - // Tags: map[string]*string{ - // "tagKey1": to.Ptr("TagValue1"), - // }, - // Properties: &armsql.ManagedInstanceProperties{ - // AdministratorLogin: to.Ptr("dummylogin"), - // Collation: to.Ptr("SQL_Latin1_General_CP1_CI_AS"), - // CurrentBackupStorageRedundancy: to.Ptr(armsql.BackupStorageRedundancyGeo), - // DNSZone: to.Ptr("1b4e2caff2530"), - // FullyQualifiedDomainName: to.Ptr("testinstance.1b4e2caff2530.database.windows.net"), - // InstancePoolID: to.Ptr("/subscriptions/20d7082a-0fc7-4468-82bd-542694d5042b/resourceGroups/testrg/providers/Microsoft.Sql/instancePools/instancePool1"), - // LicenseType: to.Ptr(armsql.ManagedInstanceLicenseTypeBasePrice), - // MaintenanceConfigurationID: to.Ptr("/subscriptions/20D7082A-0FC7-4468-82BD-542694D5042B/providers/Microsoft.Maintenance/publicMaintenanceConfigurations/SQL_JapanEast_MI_1"), - // MinimalTLSVersion: to.Ptr("1.2"), - // ProxyOverride: to.Ptr(armsql.ManagedInstanceProxyOverrideRedirect), - // PublicDataEndpointEnabled: to.Ptr(false), - // RequestedBackupStorageRedundancy: to.Ptr(armsql.BackupStorageRedundancyGeo), - // State: to.Ptr("Ready"), - // StorageSizeInGB: to.Ptr[int32](448), - // SubnetID: to.Ptr("/subscriptions/20D7082A-0FC7-4468-82BD-542694D5042B/resourceGroups/testrg/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1"), - // VCores: to.Ptr[int32](8), - // }, - // SKU: &armsql.SKU{ - // Name: to.Ptr("GP_Gen4"), - // Capacity: to.Ptr[int32](8), - // Family: to.Ptr("Gen4"), - // Tier: to.Ptr("GeneralPurpose"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ManagedInstanceUpdateMin.json -func ExampleManagedInstancesClient_BeginUpdate_updateManagedInstanceWithMinimalProperties() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewManagedInstancesClient().BeginUpdate(ctx, "testrg", "testinstance", armsql.ManagedInstanceUpdate{ - Tags: map[string]*string{ - "tagKey1": to.Ptr("TagValue1"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ManagedInstance = armsql.ManagedInstance{ - // Name: to.Ptr("testinstance"), - // Type: to.Ptr("Microsoft.Sql/managedInstances"), - // ID: to.Ptr("/subscriptions/20d7082a-0fc7-4468-82bd-542694d5042b/resourceGroups/testrg/providers/Microsoft.Sql/managedInstances/testinstance"), - // Location: to.Ptr("japaneast"), - // Tags: map[string]*string{ - // "tagKey1": to.Ptr("TagValue1"), - // }, - // Properties: &armsql.ManagedInstanceProperties{ - // AdministratorLogin: to.Ptr("PLACEHOLDER"), - // Collation: to.Ptr("SQL_Latin1_General_CP1_CI_AS"), - // CurrentBackupStorageRedundancy: to.Ptr(armsql.BackupStorageRedundancyGeo), - // DNSZone: to.Ptr("1b4e2caff2530"), - // FullyQualifiedDomainName: to.Ptr("testinstance.1b4e2caff2530.database.windows.net"), - // InstancePoolID: to.Ptr("/subscriptions/20d7082a-0fc7-4468-82bd-542694d5042b/resourceGroups/testrg/providers/Microsoft.Sql/instancePools/instancePool1"), - // LicenseType: to.Ptr(armsql.ManagedInstanceLicenseTypeLicenseIncluded), - // MaintenanceConfigurationID: to.Ptr("/subscriptions/20d7082a-0fc7-4468-82bd-542694d5042b/providers/Microsoft.Maintenance/publicMaintenanceConfigurations/SQL_Default"), - // ProxyOverride: to.Ptr(armsql.ManagedInstanceProxyOverrideDefault), - // PublicDataEndpointEnabled: to.Ptr(false), - // RequestedBackupStorageRedundancy: to.Ptr(armsql.BackupStorageRedundancyGeo), - // State: to.Ptr("Ready"), - // StorageSizeInGB: to.Ptr[int32](1024), - // SubnetID: to.Ptr("/subscriptions/20D7082A-0FC7-4468-82BD-542694D5042B/resourceGroups/testrg/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1"), - // VCores: to.Ptr[int32](8), - // }, - // SKU: &armsql.SKU{ - // Name: to.Ptr("GP_Gen4"), - // Capacity: to.Ptr[int32](8), - // Family: to.Ptr("Gen4"), - // Tier: to.Ptr("GeneralPurpose"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ManagedInstanceTopQueriesList.json -func ExampleManagedInstancesClient_NewListByManagedInstancePager_obtainListOfInstancesTopResourceConsumingQueries() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewManagedInstancesClient().NewListByManagedInstancePager("sqlcrudtest-7398", "sqlcrudtest-4645", &armsql.ManagedInstancesClientListByManagedInstanceOptions{NumberOfQueries: nil, - Databases: nil, - StartTime: nil, - EndTime: nil, - Interval: to.Ptr(armsql.QueryTimeGrainTypePT1H), - AggregationFunction: nil, - ObservationMetric: to.Ptr(armsql.MetricTypeDuration), - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.TopQueriesListResult = armsql.TopQueriesListResult{ - // Value: []*armsql.TopQueries{ - // { - // AggregationFunction: to.Ptr("sum"), - // EndTime: to.Ptr("03/05/2020 13:00:00"), - // IntervalType: to.Ptr(armsql.QueryTimeGrainTypeP1D), - // NumberOfQueries: to.Ptr[int32](5), - // ObservationMetric: to.Ptr("cpu"), - // Queries: []*armsql.QueryStatisticsProperties{ - // { - // DatabaseName: to.Ptr("db1"), - // Intervals: []*armsql.QueryMetricInterval{ - // { - // ExecutionCount: to.Ptr[int64](1), - // IntervalStartTime: to.Ptr("03/03/2020 00:00:00"), - // Metrics: []*armsql.QueryMetricProperties{ - // { - // Name: to.Ptr("cpu"), - // DisplayName: to.Ptr("Cpu"), - // Unit: to.Ptr(armsql.QueryMetricUnitTypePercentage), - // Value: to.Ptr[float64](0.0015841714409722222), - // }, - // { - // Name: to.Ptr("io"), - // DisplayName: to.Ptr("Physical Io Reads"), - // Unit: to.Ptr(armsql.QueryMetricUnitTypePercentage), - // Value: to.Ptr[float64](0.000004340277777777778), - // }, - // { - // Name: to.Ptr("logIo"), - // DisplayName: to.Ptr("Log Writes"), - // Unit: to.Ptr(armsql.QueryMetricUnitTypePercentage), - // Value: to.Ptr[float64](0), - // }, - // { - // Name: to.Ptr("memory"), - // DisplayName: to.Ptr("Memory consumption"), - // Unit: to.Ptr(armsql.QueryMetricUnitTypeKB), - // Value: to.Ptr[float64](8336), - // }, - // { - // Name: to.Ptr("duration"), - // DisplayName: to.Ptr("Query duration"), - // Unit: to.Ptr(armsql.QueryMetricUnitTypeMicroseconds), - // Value: to.Ptr[float64](11306905), - // }}, - // }}, - // QueryID: to.Ptr("25"), - // }, - // { - // DatabaseName: to.Ptr("db1"), - // Intervals: []*armsql.QueryMetricInterval{ - // { - // ExecutionCount: to.Ptr[int64](1), - // IntervalStartTime: to.Ptr("03/03/2020 00:00:00"), - // Metrics: []*armsql.QueryMetricProperties{ - // { - // Name: to.Ptr("cpu"), - // DisplayName: to.Ptr("Cpu"), - // Unit: to.Ptr(armsql.QueryMetricUnitTypePercentage), - // Value: to.Ptr[float64](0.0009521432291666667), - // }, - // { - // Name: to.Ptr("io"), - // DisplayName: to.Ptr("Physical Io Reads"), - // Unit: to.Ptr(armsql.QueryMetricUnitTypePercentage), - // Value: to.Ptr[float64](2.3148148148148148e-7), - // }, - // { - // Name: to.Ptr("logIo"), - // DisplayName: to.Ptr("Log Writes"), - // Unit: to.Ptr(armsql.QueryMetricUnitTypePercentage), - // Value: to.Ptr[float64](0), - // }, - // { - // Name: to.Ptr("memory"), - // DisplayName: to.Ptr("Memory consumption"), - // Unit: to.Ptr(armsql.QueryMetricUnitTypeKB), - // Value: to.Ptr[float64](1024), - // }, - // { - // Name: to.Ptr("duration"), - // DisplayName: to.Ptr("Query duration"), - // Unit: to.Ptr(armsql.QueryMetricUnitTypeMicroseconds), - // Value: to.Ptr[float64](6620020), - // }}, - // }}, - // QueryID: to.Ptr("21"), - // }, - // { - // DatabaseName: to.Ptr("db3"), - // Intervals: []*armsql.QueryMetricInterval{ - // { - // ExecutionCount: to.Ptr[int64](104), - // IntervalStartTime: to.Ptr("03/04/2020 00:00:00"), - // Metrics: []*armsql.QueryMetricProperties{ - // { - // Name: to.Ptr("cpu"), - // DisplayName: to.Ptr("Cpu"), - // Unit: to.Ptr(armsql.QueryMetricUnitTypePercentage), - // Value: to.Ptr[float64](0.0008006611689814815), - // }, - // { - // Name: to.Ptr("io"), - // DisplayName: to.Ptr("Physical Io Reads"), - // Unit: to.Ptr(armsql.QueryMetricUnitTypePercentage), - // Value: to.Ptr[float64](0), - // }, - // { - // Name: to.Ptr("logIo"), - // DisplayName: to.Ptr("Log Writes"), - // Unit: to.Ptr(armsql.QueryMetricUnitTypePercentage), - // Value: to.Ptr[float64](0), - // }, - // { - // Name: to.Ptr("memory"), - // DisplayName: to.Ptr("Memory consumption"), - // Unit: to.Ptr(armsql.QueryMetricUnitTypeKB), - // Value: to.Ptr[float64](0), - // }, - // { - // Name: to.Ptr("duration"), - // DisplayName: to.Ptr("Query duration"), - // Unit: to.Ptr(armsql.QueryMetricUnitTypeMicroseconds), - // Value: to.Ptr[float64](5543088), - // }}, - // }}, - // QueryID: to.Ptr("3"), - // }, - // { - // DatabaseName: to.Ptr("db2"), - // Intervals: []*armsql.QueryMetricInterval{ - // { - // ExecutionCount: to.Ptr[int64](89), - // IntervalStartTime: to.Ptr("03/03/2020 00:00:00"), - // Metrics: []*armsql.QueryMetricProperties{ - // { - // Name: to.Ptr("cpu"), - // DisplayName: to.Ptr("Cpu"), - // Unit: to.Ptr(armsql.QueryMetricUnitTypePercentage), - // Value: to.Ptr[float64](0.0006882543402777778), - // }, - // { - // Name: to.Ptr("io"), - // DisplayName: to.Ptr("Physical Io Reads"), - // Unit: to.Ptr(armsql.QueryMetricUnitTypePercentage), - // Value: to.Ptr[float64](0), - // }, - // { - // Name: to.Ptr("logIo"), - // DisplayName: to.Ptr("Log Writes"), - // Unit: to.Ptr(armsql.QueryMetricUnitTypePercentage), - // Value: to.Ptr[float64](0), - // }, - // { - // Name: to.Ptr("memory"), - // DisplayName: to.Ptr("Memory consumption"), - // Unit: to.Ptr(armsql.QueryMetricUnitTypeKB), - // Value: to.Ptr[float64](0), - // }, - // { - // Name: to.Ptr("duration"), - // DisplayName: to.Ptr("Query duration"), - // Unit: to.Ptr(armsql.QueryMetricUnitTypeMicroseconds), - // Value: to.Ptr[float64](4761877), - // }}, - // }}, - // QueryID: to.Ptr("3"), - // }, - // { - // DatabaseName: to.Ptr("db3"), - // Intervals: []*armsql.QueryMetricInterval{ - // { - // ExecutionCount: to.Ptr[int64](1), - // IntervalStartTime: to.Ptr("03/04/2020 00:00:00"), - // Metrics: []*armsql.QueryMetricProperties{ - // { - // Name: to.Ptr("cpu"), - // DisplayName: to.Ptr("Cpu"), - // Unit: to.Ptr(armsql.QueryMetricUnitTypePercentage), - // Value: to.Ptr[float64](0.0006220661168981482), - // }, - // { - // Name: to.Ptr("io"), - // DisplayName: to.Ptr("Physical Io Reads"), - // Unit: to.Ptr(armsql.QueryMetricUnitTypePercentage), - // Value: to.Ptr[float64](0), - // }, - // { - // Name: to.Ptr("logIo"), - // DisplayName: to.Ptr("Log Writes"), - // Unit: to.Ptr(armsql.QueryMetricUnitTypePercentage), - // Value: to.Ptr[float64](0), - // }, - // { - // Name: to.Ptr("memory"), - // DisplayName: to.Ptr("Memory consumption"), - // Unit: to.Ptr(armsql.QueryMetricUnitTypeKB), - // Value: to.Ptr[float64](1024), - // }, - // { - // Name: to.Ptr("duration"), - // DisplayName: to.Ptr("Query duration"), - // Unit: to.Ptr(armsql.QueryMetricUnitTypeMicroseconds), - // Value: to.Ptr[float64](4454161), - // }}, - // }}, - // QueryID: to.Ptr("22"), - // }}, - // StartTime: to.Ptr("03/01/2020 00:00:00"), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ManagedInstanceTopQueriesListMax.json -func ExampleManagedInstancesClient_NewListByManagedInstancePager_obtainListOfInstancesTopResourceConsumingQueriesFullBlownRequestAndResponse() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewManagedInstancesClient().NewListByManagedInstancePager("sqlcrudtest-7398", "sqlcrudtest-4645", &armsql.ManagedInstancesClientListByManagedInstanceOptions{NumberOfQueries: nil, - Databases: to.Ptr("db1,db2"), - StartTime: to.Ptr("2020-03-10T12:00:00Z"), - EndTime: to.Ptr("2020-03-12T12:00:00Z"), - Interval: to.Ptr(armsql.QueryTimeGrainTypeP1D), - AggregationFunction: nil, - ObservationMetric: to.Ptr(armsql.MetricTypeCPU), - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.TopQueriesListResult = armsql.TopQueriesListResult{ - // Value: []*armsql.TopQueries{ - // { - // AggregationFunction: to.Ptr("sum"), - // EndTime: to.Ptr("03/12/2020 13:00:00"), - // IntervalType: to.Ptr(armsql.QueryTimeGrainTypeP1D), - // NumberOfQueries: to.Ptr[int32](5), - // ObservationMetric: to.Ptr("cpu"), - // Queries: []*armsql.QueryStatisticsProperties{ - // { - // DatabaseName: to.Ptr("db1"), - // Intervals: []*armsql.QueryMetricInterval{ - // { - // ExecutionCount: to.Ptr[int64](1), - // IntervalStartTime: to.Ptr("03/11/2020 00:00:00"), - // Metrics: []*armsql.QueryMetricProperties{ - // { - // Name: to.Ptr("cpu"), - // DisplayName: to.Ptr("Cpu"), - // Unit: to.Ptr(armsql.QueryMetricUnitTypePercentage), - // Value: to.Ptr[float64](0.0015934667245370371), - // }, - // { - // Name: to.Ptr("io"), - // DisplayName: to.Ptr("Physical Io Reads"), - // Unit: to.Ptr(armsql.QueryMetricUnitTypePercentage), - // Value: to.Ptr[float64](0.000004224537037037037), - // }, - // { - // Name: to.Ptr("logIo"), - // DisplayName: to.Ptr("Log Writes"), - // Unit: to.Ptr(armsql.QueryMetricUnitTypePercentage), - // Value: to.Ptr[float64](0), - // }, - // { - // Name: to.Ptr("memory"), - // DisplayName: to.Ptr("Memory consumption"), - // Unit: to.Ptr(armsql.QueryMetricUnitTypeKB), - // Value: to.Ptr[float64](8336), - // }, - // { - // Name: to.Ptr("duration"), - // DisplayName: to.Ptr("Query duration"), - // Unit: to.Ptr(armsql.QueryMetricUnitTypeMicroseconds), - // Value: to.Ptr[float64](11091296), - // }}, - // }}, - // QueryID: to.Ptr("28"), - // }, - // { - // DatabaseName: to.Ptr("db1"), - // Intervals: []*armsql.QueryMetricInterval{ - // { - // ExecutionCount: to.Ptr[int64](1), - // IntervalStartTime: to.Ptr("03/11/2020 00:00:00"), - // Metrics: []*armsql.QueryMetricProperties{ - // { - // Name: to.Ptr("cpu"), - // DisplayName: to.Ptr("Cpu"), - // Unit: to.Ptr(armsql.QueryMetricUnitTypePercentage), - // Value: to.Ptr[float64](0.0009522783564814815), - // }, - // { - // Name: to.Ptr("io"), - // DisplayName: to.Ptr("Physical Io Reads"), - // Unit: to.Ptr(armsql.QueryMetricUnitTypePercentage), - // Value: to.Ptr[float64](1.7361111111111112e-7), - // }, - // { - // Name: to.Ptr("logIo"), - // DisplayName: to.Ptr("Log Writes"), - // Unit: to.Ptr(armsql.QueryMetricUnitTypePercentage), - // Value: to.Ptr[float64](0), - // }, - // { - // Name: to.Ptr("memory"), - // DisplayName: to.Ptr("Memory consumption"), - // Unit: to.Ptr(armsql.QueryMetricUnitTypeKB), - // Value: to.Ptr[float64](1024), - // }, - // { - // Name: to.Ptr("duration"), - // DisplayName: to.Ptr("Query duration"), - // Unit: to.Ptr(armsql.QueryMetricUnitTypeMicroseconds), - // Value: to.Ptr[float64](6625562), - // }}, - // }}, - // QueryID: to.Ptr("24"), - // }, - // { - // DatabaseName: to.Ptr("db1"), - // Intervals: []*armsql.QueryMetricInterval{ - // { - // ExecutionCount: to.Ptr[int64](82), - // IntervalStartTime: to.Ptr("03/11/2020 00:00:00"), - // Metrics: []*armsql.QueryMetricProperties{ - // { - // Name: to.Ptr("cpu"), - // DisplayName: to.Ptr("Cpu"), - // Unit: to.Ptr(armsql.QueryMetricUnitTypePercentage), - // Value: to.Ptr[float64](0.0007183139467592593), - // }, - // { - // Name: to.Ptr("io"), - // DisplayName: to.Ptr("Physical Io Reads"), - // Unit: to.Ptr(armsql.QueryMetricUnitTypePercentage), - // Value: to.Ptr[float64](0), - // }, - // { - // Name: to.Ptr("logIo"), - // DisplayName: to.Ptr("Log Writes"), - // Unit: to.Ptr(armsql.QueryMetricUnitTypePercentage), - // Value: to.Ptr[float64](0), - // }, - // { - // Name: to.Ptr("memory"), - // DisplayName: to.Ptr("Memory consumption"), - // Unit: to.Ptr(armsql.QueryMetricUnitTypeKB), - // Value: to.Ptr[float64](0), - // }, - // { - // Name: to.Ptr("duration"), - // DisplayName: to.Ptr("Query duration"), - // Unit: to.Ptr(armsql.QueryMetricUnitTypeMicroseconds), - // Value: to.Ptr[float64](4970199), - // }}, - // }}, - // QueryID: to.Ptr("3"), - // }, - // { - // DatabaseName: to.Ptr("db1"), - // Intervals: []*armsql.QueryMetricInterval{ - // { - // ExecutionCount: to.Ptr[int64](1), - // IntervalStartTime: to.Ptr("03/11/2020 00:00:00"), - // Metrics: []*armsql.QueryMetricProperties{ - // { - // Name: to.Ptr("cpu"), - // DisplayName: to.Ptr("Cpu"), - // Unit: to.Ptr(armsql.QueryMetricUnitTypePercentage), - // Value: to.Ptr[float64](0.0006494454571759259), - // }, - // { - // Name: to.Ptr("io"), - // DisplayName: to.Ptr("Physical Io Reads"), - // Unit: to.Ptr(armsql.QueryMetricUnitTypePercentage), - // Value: to.Ptr[float64](0.000005034722222222222), - // }, - // { - // Name: to.Ptr("logIo"), - // DisplayName: to.Ptr("Log Writes"), - // Unit: to.Ptr(armsql.QueryMetricUnitTypePercentage), - // Value: to.Ptr[float64](0), - // }, - // { - // Name: to.Ptr("memory"), - // DisplayName: to.Ptr("Memory consumption"), - // Unit: to.Ptr(armsql.QueryMetricUnitTypeKB), - // Value: to.Ptr[float64](1024), - // }, - // { - // Name: to.Ptr("duration"), - // DisplayName: to.Ptr("Query duration"), - // Unit: to.Ptr(armsql.QueryMetricUnitTypeMicroseconds), - // Value: to.Ptr[float64](4530668), - // }}, - // }}, - // QueryID: to.Ptr("29"), - // }, - // { - // DatabaseName: to.Ptr("db2"), - // Intervals: []*armsql.QueryMetricInterval{ - // { - // ExecutionCount: to.Ptr[int64](1), - // IntervalStartTime: to.Ptr("03/11/2020 00:00:00"), - // Metrics: []*armsql.QueryMetricProperties{ - // { - // Name: to.Ptr("cpu"), - // DisplayName: to.Ptr("Cpu"), - // Unit: to.Ptr(armsql.QueryMetricUnitTypePercentage), - // Value: to.Ptr[float64](0.0006275368923611112), - // }, - // { - // Name: to.Ptr("io"), - // DisplayName: to.Ptr("Physical Io Reads"), - // Unit: to.Ptr(armsql.QueryMetricUnitTypePercentage), - // Value: to.Ptr[float64](0), - // }, - // { - // Name: to.Ptr("logIo"), - // DisplayName: to.Ptr("Log Writes"), - // Unit: to.Ptr(armsql.QueryMetricUnitTypePercentage), - // Value: to.Ptr[float64](0), - // }, - // { - // Name: to.Ptr("memory"), - // DisplayName: to.Ptr("Memory consumption"), - // Unit: to.Ptr(armsql.QueryMetricUnitTypeKB), - // Value: to.Ptr[float64](1024), - // }, - // { - // Name: to.Ptr("duration"), - // DisplayName: to.Ptr("Query duration"), - // Unit: to.Ptr(armsql.QueryMetricUnitTypeMicroseconds), - // Value: to.Ptr[float64](4349943), - // }}, - // }}, - // QueryID: to.Ptr("25"), - // }}, - // StartTime: to.Ptr("03/10/2020 00:00:00"), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ManagedInstanceTopQueriesListMin.json -func ExampleManagedInstancesClient_NewListByManagedInstancePager_obtainListOfInstancesTopResourceConsumingQueriesMinimalRequestAndResponse() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewManagedInstancesClient().NewListByManagedInstancePager("sqlcrudtest-7398", "sqlcrudtest-4645", &armsql.ManagedInstancesClientListByManagedInstanceOptions{NumberOfQueries: nil, - Databases: nil, - StartTime: nil, - EndTime: nil, - Interval: nil, - AggregationFunction: nil, - ObservationMetric: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.TopQueriesListResult = armsql.TopQueriesListResult{ - // Value: []*armsql.TopQueries{ - // { - // AggregationFunction: to.Ptr("sum"), - // EndTime: to.Ptr("03/11/2020 12:24:07"), - // IntervalType: to.Ptr(armsql.QueryTimeGrainTypePT1H), - // NumberOfQueries: to.Ptr[int32](5), - // ObservationMetric: to.Ptr("cpu"), - // Queries: []*armsql.QueryStatisticsProperties{ - // }, - // StartTime: to.Ptr("03/10/2020 12:00:00"), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/FailoverManagedInstance.json -func ExampleManagedInstancesClient_BeginFailover() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewManagedInstancesClient().BeginFailover(ctx, "group1", "instanceName", &armsql.ManagedInstancesClientBeginFailoverOptions{ReplicaType: to.Ptr(armsql.ReplicaTypePrimary)}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} diff --git a/sdk/resourcemanager/sql/armsql/managedinstancetdecertificates_client.go b/sdk/resourcemanager/sql/armsql/managedinstancetdecertificates_client.go index 5762f99c66da..f5b4c5bea451 100644 --- a/sdk/resourcemanager/sql/armsql/managedinstancetdecertificates_client.go +++ b/sdk/resourcemanager/sql/armsql/managedinstancetdecertificates_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armsql @@ -47,7 +46,7 @@ func NewManagedInstanceTdeCertificatesClient(subscriptionID string, credential a // BeginCreate - Creates a TDE certificate for a given server. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - managedInstanceName - The name of the managed instance. @@ -60,7 +59,8 @@ func (client *ManagedInstanceTdeCertificatesClient) BeginCreate(ctx context.Cont if err != nil { return nil, err } - return runtime.NewPoller[ManagedInstanceTdeCertificatesClientCreateResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[ManagedInstanceTdeCertificatesClientCreateResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[ManagedInstanceTdeCertificatesClientCreateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -69,20 +69,22 @@ func (client *ManagedInstanceTdeCertificatesClient) BeginCreate(ctx context.Cont // Create - Creates a TDE certificate for a given server. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview func (client *ManagedInstanceTdeCertificatesClient) create(ctx context.Context, resourceGroupName string, managedInstanceName string, parameters TdeCertificate, options *ManagedInstanceTdeCertificatesClientBeginCreateOptions) (*http.Response, error) { + var err error req, err := client.createCreateRequest(ctx, resourceGroupName, managedInstanceName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createCreateRequest creates the Create request. @@ -105,7 +107,10 @@ func (client *ManagedInstanceTdeCertificatesClient) createCreateRequest(ctx cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } diff --git a/sdk/resourcemanager/sql/armsql/managedinstancetdecertificates_client_example_test.go b/sdk/resourcemanager/sql/armsql/managedinstancetdecertificates_client_example_test.go deleted file mode 100644 index bfc5a0d835dc..000000000000 --- a/sdk/resourcemanager/sql/armsql/managedinstancetdecertificates_client_example_test.go +++ /dev/null @@ -1,44 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsql_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sql/armsql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceTdeCertificate.json -func ExampleManagedInstanceTdeCertificatesClient_BeginCreate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewManagedInstanceTdeCertificatesClient().BeginCreate(ctx, "testtdecert", "testtdecert", armsql.TdeCertificate{ - Properties: &armsql.TdeCertificateProperties{ - PrivateBlob: to.Ptr("MIIXXXXXXXX"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} diff --git a/sdk/resourcemanager/sql/armsql/managedinstancevulnerabilityassessments_client.go b/sdk/resourcemanager/sql/armsql/managedinstancevulnerabilityassessments_client.go index 843f90e33420..7ee4003afe6c 100644 --- a/sdk/resourcemanager/sql/armsql/managedinstancevulnerabilityassessments_client.go +++ b/sdk/resourcemanager/sql/armsql/managedinstancevulnerabilityassessments_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armsql @@ -49,7 +48,7 @@ func NewManagedInstanceVulnerabilityAssessmentsClient(subscriptionID string, cre // https://docs.microsoft.com/azure/azure-sql/database/sql-database-vulnerability-assessment-storage // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - managedInstanceName - The name of the managed instance for which the vulnerability assessment is defined. @@ -58,18 +57,21 @@ func NewManagedInstanceVulnerabilityAssessmentsClient(subscriptionID string, cre // - options - ManagedInstanceVulnerabilityAssessmentsClientCreateOrUpdateOptions contains the optional parameters for the ManagedInstanceVulnerabilityAssessmentsClient.CreateOrUpdate // method. func (client *ManagedInstanceVulnerabilityAssessmentsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, managedInstanceName string, vulnerabilityAssessmentName VulnerabilityAssessmentName, parameters ManagedInstanceVulnerabilityAssessment, options *ManagedInstanceVulnerabilityAssessmentsClientCreateOrUpdateOptions) (ManagedInstanceVulnerabilityAssessmentsClientCreateOrUpdateResponse, error) { + var err error req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, managedInstanceName, vulnerabilityAssessmentName, parameters, options) if err != nil { return ManagedInstanceVulnerabilityAssessmentsClientCreateOrUpdateResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ManagedInstanceVulnerabilityAssessmentsClientCreateOrUpdateResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { - return ManagedInstanceVulnerabilityAssessmentsClientCreateOrUpdateResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return ManagedInstanceVulnerabilityAssessmentsClientCreateOrUpdateResponse{}, err } - return client.createOrUpdateHandleResponse(resp) + resp, err := client.createOrUpdateHandleResponse(httpResp) + return resp, err } // createOrUpdateCreateRequest creates the CreateOrUpdate request. @@ -96,10 +98,13 @@ func (client *ManagedInstanceVulnerabilityAssessmentsClient) createOrUpdateCreat return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // createOrUpdateHandleResponse handles the CreateOrUpdate response. @@ -114,7 +119,7 @@ func (client *ManagedInstanceVulnerabilityAssessmentsClient) createOrUpdateHandl // Delete - Removes the managed instance's vulnerability assessment. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - managedInstanceName - The name of the managed instance for which the vulnerability assessment is defined. @@ -122,16 +127,18 @@ func (client *ManagedInstanceVulnerabilityAssessmentsClient) createOrUpdateHandl // - options - ManagedInstanceVulnerabilityAssessmentsClientDeleteOptions contains the optional parameters for the ManagedInstanceVulnerabilityAssessmentsClient.Delete // method. func (client *ManagedInstanceVulnerabilityAssessmentsClient) Delete(ctx context.Context, resourceGroupName string, managedInstanceName string, vulnerabilityAssessmentName VulnerabilityAssessmentName, options *ManagedInstanceVulnerabilityAssessmentsClientDeleteOptions) (ManagedInstanceVulnerabilityAssessmentsClientDeleteResponse, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, managedInstanceName, vulnerabilityAssessmentName, options) if err != nil { return ManagedInstanceVulnerabilityAssessmentsClientDeleteResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ManagedInstanceVulnerabilityAssessmentsClientDeleteResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ManagedInstanceVulnerabilityAssessmentsClientDeleteResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ManagedInstanceVulnerabilityAssessmentsClientDeleteResponse{}, err } return ManagedInstanceVulnerabilityAssessmentsClientDeleteResponse{}, nil } @@ -160,7 +167,7 @@ func (client *ManagedInstanceVulnerabilityAssessmentsClient) deleteCreateRequest return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -168,7 +175,7 @@ func (client *ManagedInstanceVulnerabilityAssessmentsClient) deleteCreateRequest // Get - Gets the managed instance's vulnerability assessment. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - managedInstanceName - The name of the managed instance for which the vulnerability assessment is defined. @@ -176,18 +183,21 @@ func (client *ManagedInstanceVulnerabilityAssessmentsClient) deleteCreateRequest // - options - ManagedInstanceVulnerabilityAssessmentsClientGetOptions contains the optional parameters for the ManagedInstanceVulnerabilityAssessmentsClient.Get // method. func (client *ManagedInstanceVulnerabilityAssessmentsClient) Get(ctx context.Context, resourceGroupName string, managedInstanceName string, vulnerabilityAssessmentName VulnerabilityAssessmentName, options *ManagedInstanceVulnerabilityAssessmentsClientGetOptions) (ManagedInstanceVulnerabilityAssessmentsClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, managedInstanceName, vulnerabilityAssessmentName, options) if err != nil { return ManagedInstanceVulnerabilityAssessmentsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ManagedInstanceVulnerabilityAssessmentsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ManagedInstanceVulnerabilityAssessmentsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ManagedInstanceVulnerabilityAssessmentsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -214,7 +224,7 @@ func (client *ManagedInstanceVulnerabilityAssessmentsClient) getCreateRequest(ct return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -231,7 +241,7 @@ func (client *ManagedInstanceVulnerabilityAssessmentsClient) getHandleResponse(r // NewListByInstancePager - Gets the managed instance's vulnerability assessment policies. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - managedInstanceName - The name of the managed instance for which the vulnerability assessments is defined. @@ -285,7 +295,7 @@ func (client *ManagedInstanceVulnerabilityAssessmentsClient) listByInstanceCreat return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/sql/armsql/managedinstancevulnerabilityassessments_client_example_test.go b/sdk/resourcemanager/sql/armsql/managedinstancevulnerabilityassessments_client_example_test.go deleted file mode 100644 index 2cfc746101ed..000000000000 --- a/sdk/resourcemanager/sql/armsql/managedinstancevulnerabilityassessments_client_example_test.go +++ /dev/null @@ -1,235 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsql_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sql/armsql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceVulnerabilityAssessmentGet.json -func ExampleManagedInstanceVulnerabilityAssessmentsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewManagedInstanceVulnerabilityAssessmentsClient().Get(ctx, "vulnerabilityaseessmenttest-4799", "vulnerabilityaseessmenttest-6440", armsql.VulnerabilityAssessmentNameDefault, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ManagedInstanceVulnerabilityAssessment = armsql.ManagedInstanceVulnerabilityAssessment{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.Sql/managedInstances/vulnerabilityAssessments"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/vulnerabilityaseessmenttest-4799/providers/Microsoft.Sql/managedInstances/vulnerabilityaseessmenttest-6440/vulnerabilityAssessments/default"), - // Properties: &armsql.ManagedInstanceVulnerabilityAssessmentProperties{ - // RecurringScans: &armsql.VulnerabilityAssessmentRecurringScansProperties{ - // EmailSubscriptionAdmins: to.Ptr(true), - // Emails: []*string{ - // to.Ptr("email1@mail.com"), - // to.Ptr("email2@mail.com")}, - // IsEnabled: to.Ptr(true), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceVulnerabilityAssessmentCreateMax.json -func ExampleManagedInstanceVulnerabilityAssessmentsClient_CreateOrUpdate_createAManagedInstancesVulnerabilityAssessmentWithAllParameters() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewManagedInstanceVulnerabilityAssessmentsClient().CreateOrUpdate(ctx, "vulnerabilityaseessmenttest-4799", "vulnerabilityaseessmenttest-6440", armsql.VulnerabilityAssessmentNameDefault, armsql.ManagedInstanceVulnerabilityAssessment{ - Properties: &armsql.ManagedInstanceVulnerabilityAssessmentProperties{ - RecurringScans: &armsql.VulnerabilityAssessmentRecurringScansProperties{ - EmailSubscriptionAdmins: to.Ptr(true), - Emails: []*string{ - to.Ptr("email1@mail.com"), - to.Ptr("email2@mail.com")}, - IsEnabled: to.Ptr(true), - }, - StorageAccountAccessKey: to.Ptr("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"), - StorageContainerPath: to.Ptr("https://myStorage.blob.core.windows.net/vulnerability-assessment/"), - StorageContainerSasKey: to.Ptr("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ManagedInstanceVulnerabilityAssessment = armsql.ManagedInstanceVulnerabilityAssessment{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.Sql/managedInstances/vulnerabilityAssessments"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/vulnerabilityaseessmenttest-4799/providers/Microsoft.Sql/managedInstances/vulnerabilityaseessmenttest-6440/vulnerabilityAssessments/default"), - // Properties: &armsql.ManagedInstanceVulnerabilityAssessmentProperties{ - // RecurringScans: &armsql.VulnerabilityAssessmentRecurringScansProperties{ - // EmailSubscriptionAdmins: to.Ptr(true), - // Emails: []*string{ - // to.Ptr("email1@mail.com"), - // to.Ptr("email2@mail.com")}, - // IsEnabled: to.Ptr(true), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceVulnerabilityAssessmentCreateStorageAccessKeyMin.json -func ExampleManagedInstanceVulnerabilityAssessmentsClient_CreateOrUpdate_createAManagedInstancesVulnerabilityAssessmentWithMinimalParametersWhenStorageAccountAccessKeyIsSpecified() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewManagedInstanceVulnerabilityAssessmentsClient().CreateOrUpdate(ctx, "vulnerabilityaseessmenttest-4799", "vulnerabilityaseessmenttest-6440", armsql.VulnerabilityAssessmentNameDefault, armsql.ManagedInstanceVulnerabilityAssessment{ - Properties: &armsql.ManagedInstanceVulnerabilityAssessmentProperties{ - StorageAccountAccessKey: to.Ptr("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"), - StorageContainerPath: to.Ptr("https://myStorage.blob.core.windows.net/vulnerability-assessment/"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ManagedInstanceVulnerabilityAssessment = armsql.ManagedInstanceVulnerabilityAssessment{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.Sql/managedInstances/vulnerabilityAssessments"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/vulnerabilityaseessmenttest-4799/providers/Microsoft.Sql/managedInstances/vulnerabilityaseessmenttest-6440/vulnerabilityAssessments/default"), - // Properties: &armsql.ManagedInstanceVulnerabilityAssessmentProperties{ - // RecurringScans: &armsql.VulnerabilityAssessmentRecurringScansProperties{ - // EmailSubscriptionAdmins: to.Ptr(false), - // Emails: []*string{ - // }, - // IsEnabled: to.Ptr(true), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceVulnerabilityAssessmentCreateContainerSasKeyMin.json -func ExampleManagedInstanceVulnerabilityAssessmentsClient_CreateOrUpdate_createAManagedInstancesVulnerabilityAssessmentWithMinimalParametersWhenStorageContainerSasKeyIsSpecified() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewManagedInstanceVulnerabilityAssessmentsClient().CreateOrUpdate(ctx, "vulnerabilityaseessmenttest-4799", "vulnerabilityaseessmenttest-6440", armsql.VulnerabilityAssessmentNameDefault, armsql.ManagedInstanceVulnerabilityAssessment{ - Properties: &armsql.ManagedInstanceVulnerabilityAssessmentProperties{ - StorageContainerPath: to.Ptr("https://myStorage.blob.core.windows.net/vulnerability-assessment/"), - StorageContainerSasKey: to.Ptr("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ManagedInstanceVulnerabilityAssessment = armsql.ManagedInstanceVulnerabilityAssessment{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.Sql/managedInstances/vulnerabilityAssessments"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/vulnerabilityaseessmenttest-4799/providers/Microsoft.Sql/managedInstances/vulnerabilityaseessmenttest-6440/vulnerabilityAssessments/default"), - // Properties: &armsql.ManagedInstanceVulnerabilityAssessmentProperties{ - // RecurringScans: &armsql.VulnerabilityAssessmentRecurringScansProperties{ - // EmailSubscriptionAdmins: to.Ptr(false), - // Emails: []*string{ - // }, - // IsEnabled: to.Ptr(true), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceVulnerabilityAssessmentDelete.json -func ExampleManagedInstanceVulnerabilityAssessmentsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewManagedInstanceVulnerabilityAssessmentsClient().Delete(ctx, "vulnerabilityaseessmenttest-4799", "vulnerabilityaseessmenttest-6440", armsql.VulnerabilityAssessmentNameDefault, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceVulnerabilityAssessmentListByInstance.json -func ExampleManagedInstanceVulnerabilityAssessmentsClient_NewListByInstancePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewManagedInstanceVulnerabilityAssessmentsClient().NewListByInstancePager("vulnerabilityaseessmenttest-4799", "vulnerabilityaseessmenttest-6440", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ManagedInstanceVulnerabilityAssessmentListResult = armsql.ManagedInstanceVulnerabilityAssessmentListResult{ - // Value: []*armsql.ManagedInstanceVulnerabilityAssessment{ - // { - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.Sql/managedInstances/vulnerabilityAssessments"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/vulnerabilityaseessmenttest-4799/providers/Microsoft.Sql/managedInstances/vulnerabilityaseessmenttest-6440/vulnerabilityAssessments/default"), - // Properties: &armsql.ManagedInstanceVulnerabilityAssessmentProperties{ - // RecurringScans: &armsql.VulnerabilityAssessmentRecurringScansProperties{ - // EmailSubscriptionAdmins: to.Ptr(true), - // Emails: []*string{ - // to.Ptr("email1@mail.com"), - // to.Ptr("email2@mail.com")}, - // IsEnabled: to.Ptr(true), - // }, - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/sql/armsql/managedledgerdigestuploads_client.go b/sdk/resourcemanager/sql/armsql/managedledgerdigestuploads_client.go new file mode 100644 index 000000000000..25cf1f79f47f --- /dev/null +++ b/sdk/resourcemanager/sql/armsql/managedledgerdigestuploads_client.go @@ -0,0 +1,352 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armsql + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// ManagedLedgerDigestUploadsClient contains the methods for the ManagedLedgerDigestUploads group. +// Don't use this type directly, use NewManagedLedgerDigestUploadsClient() instead. +type ManagedLedgerDigestUploadsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewManagedLedgerDigestUploadsClient creates a new instance of ManagedLedgerDigestUploadsClient with the specified values. +// - subscriptionID - The subscription ID that identifies an Azure subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewManagedLedgerDigestUploadsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ManagedLedgerDigestUploadsClient, error) { + cl, err := arm.NewClient(moduleName+".ManagedLedgerDigestUploadsClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ManagedLedgerDigestUploadsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreateOrUpdate - Enables upload ledger digests to an Azure Storage account or an Azure Confidential Ledger instance. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-11-01-preview +// - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure +// Resource Manager API or the portal. +// - managedInstanceName - The name of the managed instance. +// - databaseName - The name of the database. +// - ledgerDigestUploads - The name of the Ledger Digest Upload Configurations. +// - parameters - The Ledger Digest Storage Endpoint. +// - options - ManagedLedgerDigestUploadsClientBeginCreateOrUpdateOptions contains the optional parameters for the ManagedLedgerDigestUploadsClient.BeginCreateOrUpdate +// method. +func (client *ManagedLedgerDigestUploadsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, ledgerDigestUploads ManagedLedgerDigestUploadsName, parameters ManagedLedgerDigestUploads, options *ManagedLedgerDigestUploadsClientBeginCreateOrUpdateOptions) (*runtime.Poller[ManagedLedgerDigestUploadsClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, managedInstanceName, databaseName, ledgerDigestUploads, parameters, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller[ManagedLedgerDigestUploadsClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[ManagedLedgerDigestUploadsClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// CreateOrUpdate - Enables upload ledger digests to an Azure Storage account or an Azure Confidential Ledger instance. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-11-01-preview +func (client *ManagedLedgerDigestUploadsClient) createOrUpdate(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, ledgerDigestUploads ManagedLedgerDigestUploadsName, parameters ManagedLedgerDigestUploads, options *ManagedLedgerDigestUploadsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, managedInstanceName, databaseName, ledgerDigestUploads, parameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *ManagedLedgerDigestUploadsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, ledgerDigestUploads ManagedLedgerDigestUploadsName, parameters ManagedLedgerDigestUploads, options *ManagedLedgerDigestUploadsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/ledgerDigestUploads/{ledgerDigestUploads}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if managedInstanceName == "" { + return nil, errors.New("parameter managedInstanceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{managedInstanceName}", url.PathEscape(managedInstanceName)) + if databaseName == "" { + return nil, errors.New("parameter databaseName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{databaseName}", url.PathEscape(databaseName)) + if ledgerDigestUploads == "" { + return nil, errors.New("parameter ledgerDigestUploads cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{ledgerDigestUploads}", url.PathEscape(string(ledgerDigestUploads))) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// BeginDisable - Disables uploading ledger digests to an Azure Storage account or an Azure Confidential Ledger instance. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-11-01-preview +// - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure +// Resource Manager API or the portal. +// - managedInstanceName - The name of the managed instance. +// - databaseName - The name of the database. +// - options - ManagedLedgerDigestUploadsClientBeginDisableOptions contains the optional parameters for the ManagedLedgerDigestUploadsClient.BeginDisable +// method. +func (client *ManagedLedgerDigestUploadsClient) BeginDisable(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, ledgerDigestUploads ManagedLedgerDigestUploadsName, options *ManagedLedgerDigestUploadsClientBeginDisableOptions) (*runtime.Poller[ManagedLedgerDigestUploadsClientDisableResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.disable(ctx, resourceGroupName, managedInstanceName, databaseName, ledgerDigestUploads, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller[ManagedLedgerDigestUploadsClientDisableResponse](resp, client.internal.Pipeline(), nil) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[ManagedLedgerDigestUploadsClientDisableResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Disable - Disables uploading ledger digests to an Azure Storage account or an Azure Confidential Ledger instance. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-11-01-preview +func (client *ManagedLedgerDigestUploadsClient) disable(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, ledgerDigestUploads ManagedLedgerDigestUploadsName, options *ManagedLedgerDigestUploadsClientBeginDisableOptions) (*http.Response, error) { + var err error + req, err := client.disableCreateRequest(ctx, resourceGroupName, managedInstanceName, databaseName, ledgerDigestUploads, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// disableCreateRequest creates the Disable request. +func (client *ManagedLedgerDigestUploadsClient) disableCreateRequest(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, ledgerDigestUploads ManagedLedgerDigestUploadsName, options *ManagedLedgerDigestUploadsClientBeginDisableOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/ledgerDigestUploads/{ledgerDigestUploads}/disable" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if managedInstanceName == "" { + return nil, errors.New("parameter managedInstanceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{managedInstanceName}", url.PathEscape(managedInstanceName)) + if databaseName == "" { + return nil, errors.New("parameter databaseName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{databaseName}", url.PathEscape(databaseName)) + if ledgerDigestUploads == "" { + return nil, errors.New("parameter ledgerDigestUploads cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{ledgerDigestUploads}", url.PathEscape(string(ledgerDigestUploads))) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets the current ledger digest upload configuration for a database. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-11-01-preview +// - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure +// Resource Manager API or the portal. +// - managedInstanceName - The name of the managed instance. +// - databaseName - The name of the database. +// - options - ManagedLedgerDigestUploadsClientGetOptions contains the optional parameters for the ManagedLedgerDigestUploadsClient.Get +// method. +func (client *ManagedLedgerDigestUploadsClient) Get(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, ledgerDigestUploads ManagedLedgerDigestUploadsName, options *ManagedLedgerDigestUploadsClientGetOptions) (ManagedLedgerDigestUploadsClientGetResponse, error) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, managedInstanceName, databaseName, ledgerDigestUploads, options) + if err != nil { + return ManagedLedgerDigestUploadsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ManagedLedgerDigestUploadsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ManagedLedgerDigestUploadsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *ManagedLedgerDigestUploadsClient) getCreateRequest(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, ledgerDigestUploads ManagedLedgerDigestUploadsName, options *ManagedLedgerDigestUploadsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/ledgerDigestUploads/{ledgerDigestUploads}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if managedInstanceName == "" { + return nil, errors.New("parameter managedInstanceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{managedInstanceName}", url.PathEscape(managedInstanceName)) + if databaseName == "" { + return nil, errors.New("parameter databaseName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{databaseName}", url.PathEscape(databaseName)) + if ledgerDigestUploads == "" { + return nil, errors.New("parameter ledgerDigestUploads cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{ledgerDigestUploads}", url.PathEscape(string(ledgerDigestUploads))) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *ManagedLedgerDigestUploadsClient) getHandleResponse(resp *http.Response) (ManagedLedgerDigestUploadsClientGetResponse, error) { + result := ManagedLedgerDigestUploadsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ManagedLedgerDigestUploads); err != nil { + return ManagedLedgerDigestUploadsClientGetResponse{}, err + } + return result, nil +} + +// NewListByDatabasePager - Gets all ledger digest upload settings on a database. +// +// Generated from API version 2022-11-01-preview +// - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure +// Resource Manager API or the portal. +// - managedInstanceName - The name of the managed instance. +// - databaseName - The name of the database. +// - options - ManagedLedgerDigestUploadsClientListByDatabaseOptions contains the optional parameters for the ManagedLedgerDigestUploadsClient.NewListByDatabasePager +// method. +func (client *ManagedLedgerDigestUploadsClient) NewListByDatabasePager(resourceGroupName string, managedInstanceName string, databaseName string, options *ManagedLedgerDigestUploadsClientListByDatabaseOptions) *runtime.Pager[ManagedLedgerDigestUploadsClientListByDatabaseResponse] { + return runtime.NewPager(runtime.PagingHandler[ManagedLedgerDigestUploadsClientListByDatabaseResponse]{ + More: func(page ManagedLedgerDigestUploadsClientListByDatabaseResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ManagedLedgerDigestUploadsClientListByDatabaseResponse) (ManagedLedgerDigestUploadsClientListByDatabaseResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByDatabaseCreateRequest(ctx, resourceGroupName, managedInstanceName, databaseName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ManagedLedgerDigestUploadsClientListByDatabaseResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ManagedLedgerDigestUploadsClientListByDatabaseResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ManagedLedgerDigestUploadsClientListByDatabaseResponse{}, runtime.NewResponseError(resp) + } + return client.listByDatabaseHandleResponse(resp) + }, + }) +} + +// listByDatabaseCreateRequest creates the ListByDatabase request. +func (client *ManagedLedgerDigestUploadsClient) listByDatabaseCreateRequest(ctx context.Context, resourceGroupName string, managedInstanceName string, databaseName string, options *ManagedLedgerDigestUploadsClientListByDatabaseOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/ledgerDigestUploads" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if managedInstanceName == "" { + return nil, errors.New("parameter managedInstanceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{managedInstanceName}", url.PathEscape(managedInstanceName)) + if databaseName == "" { + return nil, errors.New("parameter databaseName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{databaseName}", url.PathEscape(databaseName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByDatabaseHandleResponse handles the ListByDatabase response. +func (client *ManagedLedgerDigestUploadsClient) listByDatabaseHandleResponse(resp *http.Response) (ManagedLedgerDigestUploadsClientListByDatabaseResponse, error) { + result := ManagedLedgerDigestUploadsClientListByDatabaseResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ManagedLedgerDigestUploadsListResult); err != nil { + return ManagedLedgerDigestUploadsClientListByDatabaseResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/sql/armsql/managedrestorabledroppeddatabasebackupshorttermretentionpolicies_client.go b/sdk/resourcemanager/sql/armsql/managedrestorabledroppeddatabasebackupshorttermretentionpolicies_client.go index bc44b2cc56c8..a30a9f32d395 100644 --- a/sdk/resourcemanager/sql/armsql/managedrestorabledroppeddatabasebackupshorttermretentionpolicies_client.go +++ b/sdk/resourcemanager/sql/armsql/managedrestorabledroppeddatabasebackupshorttermretentionpolicies_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armsql @@ -47,7 +46,7 @@ func NewManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClient(s // BeginCreateOrUpdate - Sets a database's short term retention policy. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - managedInstanceName - The name of the managed instance. @@ -62,7 +61,8 @@ func (client *ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesCl if err != nil { return nil, err } - return runtime.NewPoller[ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -71,20 +71,22 @@ func (client *ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesCl // CreateOrUpdate - Sets a database's short term retention policy. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview func (client *ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClient) createOrUpdate(ctx context.Context, resourceGroupName string, managedInstanceName string, restorableDroppedDatabaseID string, policyName ManagedShortTermRetentionPolicyName, parameters ManagedBackupShortTermRetentionPolicy, options *ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, managedInstanceName, restorableDroppedDatabaseID, policyName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createOrUpdateCreateRequest creates the CreateOrUpdate request. @@ -115,16 +117,19 @@ func (client *ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesCl return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // Get - Gets a dropped database's short term retention policy. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - managedInstanceName - The name of the managed instance. @@ -132,18 +137,21 @@ func (client *ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesCl // - options - ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClientGetOptions contains the optional parameters // for the ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClient.Get method. func (client *ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClient) Get(ctx context.Context, resourceGroupName string, managedInstanceName string, restorableDroppedDatabaseID string, policyName ManagedShortTermRetentionPolicyName, options *ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClientGetOptions) (ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, managedInstanceName, restorableDroppedDatabaseID, policyName, options) if err != nil { return ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -174,7 +182,7 @@ func (client *ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesCl return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -191,7 +199,7 @@ func (client *ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesCl // NewListByRestorableDroppedDatabasePager - Gets a dropped database's short term retention policy list. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - managedInstanceName - The name of the managed instance. @@ -250,7 +258,7 @@ func (client *ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesCl return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -268,7 +276,7 @@ func (client *ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesCl // BeginUpdate - Sets a database's short term retention policy. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - managedInstanceName - The name of the managed instance. @@ -282,7 +290,8 @@ func (client *ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesCl if err != nil { return nil, err } - return runtime.NewPoller[ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClientUpdateResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClientUpdateResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClientUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -291,20 +300,22 @@ func (client *ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesCl // Update - Sets a database's short term retention policy. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview func (client *ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClient) update(ctx context.Context, resourceGroupName string, managedInstanceName string, restorableDroppedDatabaseID string, policyName ManagedShortTermRetentionPolicyName, parameters ManagedBackupShortTermRetentionPolicy, options *ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClientBeginUpdateOptions) (*http.Response, error) { + var err error req, err := client.updateCreateRequest(ctx, resourceGroupName, managedInstanceName, restorableDroppedDatabaseID, policyName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // updateCreateRequest creates the Update request. @@ -335,8 +346,11 @@ func (client *ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesCl return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } diff --git a/sdk/resourcemanager/sql/armsql/managedrestorabledroppeddatabasebackupshorttermretentionpolicies_client_example_test.go b/sdk/resourcemanager/sql/armsql/managedrestorabledroppeddatabasebackupshorttermretentionpolicies_client_example_test.go deleted file mode 100644 index 2b13e8a8ea3a..000000000000 --- a/sdk/resourcemanager/sql/armsql/managedrestorabledroppeddatabasebackupshorttermretentionpolicies_client_example_test.go +++ /dev/null @@ -1,127 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsql_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sql/armsql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/GetManagedShortTermRetentionPolicyRestorableDropped.json -func ExampleManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClient().Get(ctx, "Default-SQL-SouthEastAsia", "testsvr", "testdb,131403269876900000", armsql.ManagedShortTermRetentionPolicyNameDefault, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ManagedBackupShortTermRetentionPolicy = armsql.ManagedBackupShortTermRetentionPolicy{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.Sql/managedInstances/restorableDroppedDatabases/backupShortTermRetentionPolicies"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/managedInstance/testsvr/restorableDroppedDatabases/testdb,131403269876900000/backupShortTermRetentionPolicies/default"), - // Properties: &armsql.ManagedBackupShortTermRetentionPolicyProperties{ - // RetentionDays: to.Ptr[int32](14), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/UpdateManagedShortTermRetentionPolicyRestorableDropped.json -func ExampleManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClient().BeginCreateOrUpdate(ctx, "resourceGroup", "testsvr", "testdb,131403269876900000", armsql.ManagedShortTermRetentionPolicyNameDefault, armsql.ManagedBackupShortTermRetentionPolicy{ - Properties: &armsql.ManagedBackupShortTermRetentionPolicyProperties{ - RetentionDays: to.Ptr[int32](14), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ManagedBackupShortTermRetentionPolicy = armsql.ManagedBackupShortTermRetentionPolicy{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.Sql/managedInstances/restorableDroppedDatabases/backupShortTermRetentionPolicies"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/resourceGroup/providers/Microsoft.Sql/managedInstances/testsvr/restorableDroppedDatabases/testdb,131403269876900000/backupShortTermRetentionPolicies/default"), - // Properties: &armsql.ManagedBackupShortTermRetentionPolicyProperties{ - // RetentionDays: to.Ptr[int32](14), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/GetListManagedShortTermRetentionPolicyRestorableDropped.json -func ExampleManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClient_NewListByRestorableDroppedDatabasePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClient().NewListByRestorableDroppedDatabasePager("Default-SQL-SouthEastAsia", "testsvr", "testdb,131403269876900000", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ManagedBackupShortTermRetentionPolicyListResult = armsql.ManagedBackupShortTermRetentionPolicyListResult{ - // Value: []*armsql.ManagedBackupShortTermRetentionPolicy{ - // { - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.Sql/managedInstances/restorableDroppedDatabases/backupShortTermRetentionPolicies"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/managedInstances/testsvr/restorableDroppedDatabases/testdb,131403269876900000/backupShortTermRetentionPolicies/default"), - // Properties: &armsql.ManagedBackupShortTermRetentionPolicyProperties{ - // RetentionDays: to.Ptr[int32](14), - // }, - // }, - // { - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.Sql/managedInstances/restorableDroppedDatabases/backupShortTermRetentionPolicies"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/managedInstances/testsvr/restorableDroppedDatabases/testdb,131403269876900000/backupShortTermRetentionPolicies/default"), - // Properties: &armsql.ManagedBackupShortTermRetentionPolicyProperties{ - // RetentionDays: to.Ptr[int32](14), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/sql/armsql/managedserverdnsaliases_client.go b/sdk/resourcemanager/sql/armsql/managedserverdnsaliases_client.go new file mode 100644 index 000000000000..3ffe80e02e20 --- /dev/null +++ b/sdk/resourcemanager/sql/armsql/managedserverdnsaliases_client.go @@ -0,0 +1,405 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armsql + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// ManagedServerDNSAliasesClient contains the methods for the ManagedServerDNSAliases group. +// Don't use this type directly, use NewManagedServerDNSAliasesClient() instead. +type ManagedServerDNSAliasesClient struct { + internal *arm.Client + subscriptionID string +} + +// NewManagedServerDNSAliasesClient creates a new instance of ManagedServerDNSAliasesClient with the specified values. +// - subscriptionID - The subscription ID that identifies an Azure subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewManagedServerDNSAliasesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ManagedServerDNSAliasesClient, error) { + cl, err := arm.NewClient(moduleName+".ManagedServerDNSAliasesClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ManagedServerDNSAliasesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginAcquire - Acquires managed server DNS alias from another managed server. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-11-01-preview +// - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure +// Resource Manager API or the portal. +// - managedInstanceName - The name of the managed instance. +// - options - ManagedServerDNSAliasesClientBeginAcquireOptions contains the optional parameters for the ManagedServerDNSAliasesClient.BeginAcquire +// method. +func (client *ManagedServerDNSAliasesClient) BeginAcquire(ctx context.Context, resourceGroupName string, managedInstanceName string, dnsAliasName string, parameters ManagedServerDNSAliasAcquisition, options *ManagedServerDNSAliasesClientBeginAcquireOptions) (*runtime.Poller[ManagedServerDNSAliasesClientAcquireResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.acquire(ctx, resourceGroupName, managedInstanceName, dnsAliasName, parameters, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller[ManagedServerDNSAliasesClientAcquireResponse](resp, client.internal.Pipeline(), nil) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[ManagedServerDNSAliasesClientAcquireResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Acquire - Acquires managed server DNS alias from another managed server. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-11-01-preview +func (client *ManagedServerDNSAliasesClient) acquire(ctx context.Context, resourceGroupName string, managedInstanceName string, dnsAliasName string, parameters ManagedServerDNSAliasAcquisition, options *ManagedServerDNSAliasesClientBeginAcquireOptions) (*http.Response, error) { + var err error + req, err := client.acquireCreateRequest(ctx, resourceGroupName, managedInstanceName, dnsAliasName, parameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// acquireCreateRequest creates the Acquire request. +func (client *ManagedServerDNSAliasesClient) acquireCreateRequest(ctx context.Context, resourceGroupName string, managedInstanceName string, dnsAliasName string, parameters ManagedServerDNSAliasAcquisition, options *ManagedServerDNSAliasesClientBeginAcquireOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/dnsAliases/{dnsAliasName}/acquire" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if managedInstanceName == "" { + return nil, errors.New("parameter managedInstanceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{managedInstanceName}", url.PathEscape(managedInstanceName)) + if dnsAliasName == "" { + return nil, errors.New("parameter dnsAliasName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{dnsAliasName}", url.PathEscape(dnsAliasName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// BeginCreateOrUpdate - Creates a managed server DNS alias. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-11-01-preview +// - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure +// Resource Manager API or the portal. +// - managedInstanceName - The name of the managed instance. +// - options - ManagedServerDNSAliasesClientBeginCreateOrUpdateOptions contains the optional parameters for the ManagedServerDNSAliasesClient.BeginCreateOrUpdate +// method. +func (client *ManagedServerDNSAliasesClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, managedInstanceName string, dnsAliasName string, parameters ManagedServerDNSAliasCreation, options *ManagedServerDNSAliasesClientBeginCreateOrUpdateOptions) (*runtime.Poller[ManagedServerDNSAliasesClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, managedInstanceName, dnsAliasName, parameters, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller[ManagedServerDNSAliasesClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[ManagedServerDNSAliasesClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// CreateOrUpdate - Creates a managed server DNS alias. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-11-01-preview +func (client *ManagedServerDNSAliasesClient) createOrUpdate(ctx context.Context, resourceGroupName string, managedInstanceName string, dnsAliasName string, parameters ManagedServerDNSAliasCreation, options *ManagedServerDNSAliasesClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, managedInstanceName, dnsAliasName, parameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *ManagedServerDNSAliasesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, managedInstanceName string, dnsAliasName string, parameters ManagedServerDNSAliasCreation, options *ManagedServerDNSAliasesClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/dnsAliases/{dnsAliasName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if managedInstanceName == "" { + return nil, errors.New("parameter managedInstanceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{managedInstanceName}", url.PathEscape(managedInstanceName)) + if dnsAliasName == "" { + return nil, errors.New("parameter dnsAliasName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{dnsAliasName}", url.PathEscape(dnsAliasName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Deletes the managed server DNS alias with the given name. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-11-01-preview +// - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure +// Resource Manager API or the portal. +// - managedInstanceName - The name of the managed instance. +// - options - ManagedServerDNSAliasesClientBeginDeleteOptions contains the optional parameters for the ManagedServerDNSAliasesClient.BeginDelete +// method. +func (client *ManagedServerDNSAliasesClient) BeginDelete(ctx context.Context, resourceGroupName string, managedInstanceName string, dnsAliasName string, options *ManagedServerDNSAliasesClientBeginDeleteOptions) (*runtime.Poller[ManagedServerDNSAliasesClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, managedInstanceName, dnsAliasName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller[ManagedServerDNSAliasesClientDeleteResponse](resp, client.internal.Pipeline(), nil) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[ManagedServerDNSAliasesClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Delete - Deletes the managed server DNS alias with the given name. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-11-01-preview +func (client *ManagedServerDNSAliasesClient) deleteOperation(ctx context.Context, resourceGroupName string, managedInstanceName string, dnsAliasName string, options *ManagedServerDNSAliasesClientBeginDeleteOptions) (*http.Response, error) { + var err error + req, err := client.deleteCreateRequest(ctx, resourceGroupName, managedInstanceName, dnsAliasName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *ManagedServerDNSAliasesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, managedInstanceName string, dnsAliasName string, options *ManagedServerDNSAliasesClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/dnsAliases/{dnsAliasName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if managedInstanceName == "" { + return nil, errors.New("parameter managedInstanceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{managedInstanceName}", url.PathEscape(managedInstanceName)) + if dnsAliasName == "" { + return nil, errors.New("parameter dnsAliasName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{dnsAliasName}", url.PathEscape(dnsAliasName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + return req, nil +} + +// Get - Gets a server DNS alias. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-11-01-preview +// - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure +// Resource Manager API or the portal. +// - managedInstanceName - The name of the managed instance. +// - options - ManagedServerDNSAliasesClientGetOptions contains the optional parameters for the ManagedServerDNSAliasesClient.Get +// method. +func (client *ManagedServerDNSAliasesClient) Get(ctx context.Context, resourceGroupName string, managedInstanceName string, dnsAliasName string, options *ManagedServerDNSAliasesClientGetOptions) (ManagedServerDNSAliasesClientGetResponse, error) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, managedInstanceName, dnsAliasName, options) + if err != nil { + return ManagedServerDNSAliasesClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ManagedServerDNSAliasesClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ManagedServerDNSAliasesClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *ManagedServerDNSAliasesClient) getCreateRequest(ctx context.Context, resourceGroupName string, managedInstanceName string, dnsAliasName string, options *ManagedServerDNSAliasesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/dnsAliases/{dnsAliasName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if managedInstanceName == "" { + return nil, errors.New("parameter managedInstanceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{managedInstanceName}", url.PathEscape(managedInstanceName)) + if dnsAliasName == "" { + return nil, errors.New("parameter dnsAliasName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{dnsAliasName}", url.PathEscape(dnsAliasName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *ManagedServerDNSAliasesClient) getHandleResponse(resp *http.Response) (ManagedServerDNSAliasesClientGetResponse, error) { + result := ManagedServerDNSAliasesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ManagedServerDNSAlias); err != nil { + return ManagedServerDNSAliasesClientGetResponse{}, err + } + return result, nil +} + +// NewListByManagedInstancePager - Gets a list of managed server DNS aliases for a managed server. +// +// Generated from API version 2022-11-01-preview +// - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure +// Resource Manager API or the portal. +// - managedInstanceName - The name of the managed instance. +// - options - ManagedServerDNSAliasesClientListByManagedInstanceOptions contains the optional parameters for the ManagedServerDNSAliasesClient.NewListByManagedInstancePager +// method. +func (client *ManagedServerDNSAliasesClient) NewListByManagedInstancePager(resourceGroupName string, managedInstanceName string, options *ManagedServerDNSAliasesClientListByManagedInstanceOptions) *runtime.Pager[ManagedServerDNSAliasesClientListByManagedInstanceResponse] { + return runtime.NewPager(runtime.PagingHandler[ManagedServerDNSAliasesClientListByManagedInstanceResponse]{ + More: func(page ManagedServerDNSAliasesClientListByManagedInstanceResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ManagedServerDNSAliasesClientListByManagedInstanceResponse) (ManagedServerDNSAliasesClientListByManagedInstanceResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByManagedInstanceCreateRequest(ctx, resourceGroupName, managedInstanceName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ManagedServerDNSAliasesClientListByManagedInstanceResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ManagedServerDNSAliasesClientListByManagedInstanceResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ManagedServerDNSAliasesClientListByManagedInstanceResponse{}, runtime.NewResponseError(resp) + } + return client.listByManagedInstanceHandleResponse(resp) + }, + }) +} + +// listByManagedInstanceCreateRequest creates the ListByManagedInstance request. +func (client *ManagedServerDNSAliasesClient) listByManagedInstanceCreateRequest(ctx context.Context, resourceGroupName string, managedInstanceName string, options *ManagedServerDNSAliasesClientListByManagedInstanceOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/dnsAliases" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if managedInstanceName == "" { + return nil, errors.New("parameter managedInstanceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{managedInstanceName}", url.PathEscape(managedInstanceName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByManagedInstanceHandleResponse handles the ListByManagedInstance response. +func (client *ManagedServerDNSAliasesClient) listByManagedInstanceHandleResponse(resp *http.Response) (ManagedServerDNSAliasesClientListByManagedInstanceResponse, error) { + result := ManagedServerDNSAliasesClientListByManagedInstanceResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ManagedServerDNSAliasListResult); err != nil { + return ManagedServerDNSAliasesClientListByManagedInstanceResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/sql/armsql/managedserversecurityalertpolicies_client.go b/sdk/resourcemanager/sql/armsql/managedserversecurityalertpolicies_client.go index c987cf04638a..a69ff69eb496 100644 --- a/sdk/resourcemanager/sql/armsql/managedserversecurityalertpolicies_client.go +++ b/sdk/resourcemanager/sql/armsql/managedserversecurityalertpolicies_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armsql @@ -47,7 +46,7 @@ func NewManagedServerSecurityAlertPoliciesClient(subscriptionID string, credenti // BeginCreateOrUpdate - Creates or updates a threat detection policy. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - managedInstanceName - The name of the managed instance. @@ -55,13 +54,14 @@ func NewManagedServerSecurityAlertPoliciesClient(subscriptionID string, credenti // - parameters - The managed server security alert policy. // - options - ManagedServerSecurityAlertPoliciesClientBeginCreateOrUpdateOptions contains the optional parameters for the ManagedServerSecurityAlertPoliciesClient.BeginCreateOrUpdate // method. -func (client *ManagedServerSecurityAlertPoliciesClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, managedInstanceName string, securityAlertPolicyName SecurityAlertPolicyName, parameters ManagedServerSecurityAlertPolicy, options *ManagedServerSecurityAlertPoliciesClientBeginCreateOrUpdateOptions) (*runtime.Poller[ManagedServerSecurityAlertPoliciesClientCreateOrUpdateResponse], error) { +func (client *ManagedServerSecurityAlertPoliciesClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, managedInstanceName string, securityAlertPolicyName SecurityAlertPolicyNameAutoGenerated, parameters ManagedServerSecurityAlertPolicy, options *ManagedServerSecurityAlertPoliciesClientBeginCreateOrUpdateOptions) (*runtime.Poller[ManagedServerSecurityAlertPoliciesClientCreateOrUpdateResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.createOrUpdate(ctx, resourceGroupName, managedInstanceName, securityAlertPolicyName, parameters, options) if err != nil { return nil, err } - return runtime.NewPoller[ManagedServerSecurityAlertPoliciesClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[ManagedServerSecurityAlertPoliciesClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[ManagedServerSecurityAlertPoliciesClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -70,24 +70,26 @@ func (client *ManagedServerSecurityAlertPoliciesClient) BeginCreateOrUpdate(ctx // CreateOrUpdate - Creates or updates a threat detection policy. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview -func (client *ManagedServerSecurityAlertPoliciesClient) createOrUpdate(ctx context.Context, resourceGroupName string, managedInstanceName string, securityAlertPolicyName SecurityAlertPolicyName, parameters ManagedServerSecurityAlertPolicy, options *ManagedServerSecurityAlertPoliciesClientBeginCreateOrUpdateOptions) (*http.Response, error) { +// Generated from API version 2022-11-01-preview +func (client *ManagedServerSecurityAlertPoliciesClient) createOrUpdate(ctx context.Context, resourceGroupName string, managedInstanceName string, securityAlertPolicyName SecurityAlertPolicyNameAutoGenerated, parameters ManagedServerSecurityAlertPolicy, options *ManagedServerSecurityAlertPoliciesClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, managedInstanceName, securityAlertPolicyName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *ManagedServerSecurityAlertPoliciesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, managedInstanceName string, securityAlertPolicyName SecurityAlertPolicyName, parameters ManagedServerSecurityAlertPolicy, options *ManagedServerSecurityAlertPoliciesClientBeginCreateOrUpdateOptions) (*policy.Request, error) { +func (client *ManagedServerSecurityAlertPoliciesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, managedInstanceName string, securityAlertPolicyName SecurityAlertPolicyNameAutoGenerated, parameters ManagedServerSecurityAlertPolicy, options *ManagedServerSecurityAlertPoliciesClientBeginCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/securityAlertPolicies/{securityAlertPolicyName}" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -110,39 +112,45 @@ func (client *ManagedServerSecurityAlertPoliciesClient) createOrUpdateCreateRequ return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // Get - Get a managed server's threat detection policy. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - managedInstanceName - The name of the managed instance. // - securityAlertPolicyName - The name of the security alert policy. // - options - ManagedServerSecurityAlertPoliciesClientGetOptions contains the optional parameters for the ManagedServerSecurityAlertPoliciesClient.Get // method. -func (client *ManagedServerSecurityAlertPoliciesClient) Get(ctx context.Context, resourceGroupName string, managedInstanceName string, securityAlertPolicyName SecurityAlertPolicyName, options *ManagedServerSecurityAlertPoliciesClientGetOptions) (ManagedServerSecurityAlertPoliciesClientGetResponse, error) { +func (client *ManagedServerSecurityAlertPoliciesClient) Get(ctx context.Context, resourceGroupName string, managedInstanceName string, securityAlertPolicyName SecurityAlertPolicyNameAutoGenerated, options *ManagedServerSecurityAlertPoliciesClientGetOptions) (ManagedServerSecurityAlertPoliciesClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, managedInstanceName, securityAlertPolicyName, options) if err != nil { return ManagedServerSecurityAlertPoliciesClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ManagedServerSecurityAlertPoliciesClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ManagedServerSecurityAlertPoliciesClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ManagedServerSecurityAlertPoliciesClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. -func (client *ManagedServerSecurityAlertPoliciesClient) getCreateRequest(ctx context.Context, resourceGroupName string, managedInstanceName string, securityAlertPolicyName SecurityAlertPolicyName, options *ManagedServerSecurityAlertPoliciesClientGetOptions) (*policy.Request, error) { +func (client *ManagedServerSecurityAlertPoliciesClient) getCreateRequest(ctx context.Context, resourceGroupName string, managedInstanceName string, securityAlertPolicyName SecurityAlertPolicyNameAutoGenerated, options *ManagedServerSecurityAlertPoliciesClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/securityAlertPolicies/{securityAlertPolicyName}" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -165,7 +173,7 @@ func (client *ManagedServerSecurityAlertPoliciesClient) getCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -182,7 +190,7 @@ func (client *ManagedServerSecurityAlertPoliciesClient) getHandleResponse(resp * // NewListByInstancePager - Get the managed server's threat detection policies. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - managedInstanceName - The name of the managed instance. @@ -236,7 +244,7 @@ func (client *ManagedServerSecurityAlertPoliciesClient) listByInstanceCreateRequ return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/sql/armsql/managedserversecurityalertpolicies_client_example_test.go b/sdk/resourcemanager/sql/armsql/managedserversecurityalertpolicies_client_example_test.go deleted file mode 100644 index b1cbc12a9553..000000000000 --- a/sdk/resourcemanager/sql/armsql/managedserversecurityalertpolicies_client_example_test.go +++ /dev/null @@ -1,231 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsql_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sql/armsql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedServerSecurityAlertGet.json -func ExampleManagedServerSecurityAlertPoliciesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewManagedServerSecurityAlertPoliciesClient().Get(ctx, "securityalert-4799", "securityalert-6440", armsql.SecurityAlertPolicyNameDefault, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ManagedServerSecurityAlertPolicy = armsql.ManagedServerSecurityAlertPolicy{ - // Name: to.Ptr("Default"), - // Type: to.Ptr("Microsoft.Sql/managedInstances/securityAlertPolicies"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/securityalert-4799/providers/Microsoft.Sql/managedInstances/securityalert-6440"), - // Properties: &armsql.SecurityAlertsPolicyProperties{ - // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-04-03T04:41:33.937Z"); return t}()), - // DisabledAlerts: []*string{ - // to.Ptr("Access_Anomaly")}, - // EmailAccountAdmins: to.Ptr(true), - // EmailAddresses: []*string{ - // to.Ptr("test@consoto.com;user@consoto.com")}, - // RetentionDays: to.Ptr[int32](0), - // State: to.Ptr(armsql.SecurityAlertsPolicyStateDisabled), - // StorageAccountAccessKey: to.Ptr(""), - // StorageEndpoint: to.Ptr(""), - // }, - // SystemData: &armsql.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-04-03T04:41:33.937Z"); return t}()), - // CreatedBy: to.Ptr("string"), - // CreatedByType: to.Ptr(armsql.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-04-03T04:41:33.937Z"); return t}()), - // LastModifiedBy: to.Ptr("string"), - // LastModifiedByType: to.Ptr(armsql.CreatedByTypeUser), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedServerSecurityAlertCreateMax.json -func ExampleManagedServerSecurityAlertPoliciesClient_BeginCreateOrUpdate_updateAManagedServersThreatDetectionPolicyWithAllParameters() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewManagedServerSecurityAlertPoliciesClient().BeginCreateOrUpdate(ctx, "securityalert-4799", "securityalert-6440", armsql.SecurityAlertPolicyNameDefault, armsql.ManagedServerSecurityAlertPolicy{ - Properties: &armsql.SecurityAlertsPolicyProperties{ - DisabledAlerts: []*string{ - to.Ptr("Access_Anomaly"), - to.Ptr("Usage_Anomaly")}, - EmailAccountAdmins: to.Ptr(true), - EmailAddresses: []*string{ - to.Ptr("testSecurityAlert@microsoft.com")}, - RetentionDays: to.Ptr[int32](5), - State: to.Ptr(armsql.SecurityAlertsPolicyStateEnabled), - StorageAccountAccessKey: to.Ptr("sdlfkjabc+sdlfkjsdlkfsjdfLDKFTERLKFDFKLjsdfksjdflsdkfD2342309432849328476458/3RSD=="), - StorageEndpoint: to.Ptr("https://mystorage.blob.core.windows.net"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ManagedServerSecurityAlertPolicy = armsql.ManagedServerSecurityAlertPolicy{ - // Name: to.Ptr("Default"), - // Type: to.Ptr("Microsoft.Sql/managedInstances/securityAlertPolicies"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/securityalert-4799/providers/Microsoft.Sql/managedInstances/securityalert-6440"), - // Properties: &armsql.SecurityAlertsPolicyProperties{ - // DisabledAlerts: []*string{ - // to.Ptr("Access_Anomaly"), - // to.Ptr("Usage_Anomaly")}, - // EmailAccountAdmins: to.Ptr(true), - // EmailAddresses: []*string{ - // to.Ptr("testSecurityAlert@microsoft.com")}, - // RetentionDays: to.Ptr[int32](5), - // State: to.Ptr(armsql.SecurityAlertsPolicyStateEnabled), - // StorageAccountAccessKey: to.Ptr(""), - // StorageEndpoint: to.Ptr("https://mystorage.blob.core.windows.net"), - // }, - // SystemData: &armsql.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-04-03T04:41:33.937Z"); return t}()), - // CreatedBy: to.Ptr("string"), - // CreatedByType: to.Ptr(armsql.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-04-03T04:41:33.937Z"); return t}()), - // LastModifiedBy: to.Ptr("string"), - // LastModifiedByType: to.Ptr(armsql.CreatedByTypeUser), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedServerSecurityAlertCreateMin.json -func ExampleManagedServerSecurityAlertPoliciesClient_BeginCreateOrUpdate_updateAManagedServersThreatDetectionPolicyWithMinimalParameters() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewManagedServerSecurityAlertPoliciesClient().BeginCreateOrUpdate(ctx, "securityalert-4799", "securityalert-6440", armsql.SecurityAlertPolicyNameDefault, armsql.ManagedServerSecurityAlertPolicy{ - Properties: &armsql.SecurityAlertsPolicyProperties{ - State: to.Ptr(armsql.SecurityAlertsPolicyStateEnabled), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ManagedServerSecurityAlertPolicy = armsql.ManagedServerSecurityAlertPolicy{ - // Name: to.Ptr("Default"), - // Type: to.Ptr("Microsoft.Sql/managedInstances/securityAlertPolicies"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/securityalert-4799/providers/Microsoft.Sql/managedInstances/securityalert-6440"), - // Properties: &armsql.SecurityAlertsPolicyProperties{ - // DisabledAlerts: []*string{ - // }, - // EmailAccountAdmins: to.Ptr(true), - // EmailAddresses: []*string{ - // }, - // RetentionDays: to.Ptr[int32](0), - // State: to.Ptr(armsql.SecurityAlertsPolicyStateEnabled), - // StorageAccountAccessKey: to.Ptr(""), - // StorageEndpoint: to.Ptr(""), - // }, - // SystemData: &armsql.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-04-03T04:41:33.937Z"); return t}()), - // CreatedBy: to.Ptr("string"), - // CreatedByType: to.Ptr(armsql.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-04-03T04:41:33.937Z"); return t}()), - // LastModifiedBy: to.Ptr("string"), - // LastModifiedByType: to.Ptr(armsql.CreatedByTypeUser), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedServerSecurityAlertListByInstance.json -func ExampleManagedServerSecurityAlertPoliciesClient_NewListByInstancePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewManagedServerSecurityAlertPoliciesClient().NewListByInstancePager("securityalert-4799", "securityalert-6440", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ManagedServerSecurityAlertPolicyListResult = armsql.ManagedServerSecurityAlertPolicyListResult{ - // Value: []*armsql.ManagedServerSecurityAlertPolicy{ - // { - // Name: to.Ptr("Default"), - // Type: to.Ptr("Microsoft.Sql/managedInstances/securityAlertPolicies"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/securityalert-4799/providers/Microsoft.Sql/managedInstances/securityalert-6440"), - // Properties: &armsql.SecurityAlertsPolicyProperties{ - // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-04-03T04:41:33.937Z"); return t}()), - // DisabledAlerts: []*string{ - // to.Ptr("Access_Anomaly")}, - // EmailAccountAdmins: to.Ptr(true), - // EmailAddresses: []*string{ - // to.Ptr("test@consoto.com;user@consoto.com")}, - // RetentionDays: to.Ptr[int32](0), - // State: to.Ptr(armsql.SecurityAlertsPolicyStateDisabled), - // StorageAccountAccessKey: to.Ptr(""), - // StorageEndpoint: to.Ptr(""), - // }, - // SystemData: &armsql.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-04-03T04:41:33.937Z"); return t}()), - // CreatedBy: to.Ptr("string"), - // CreatedByType: to.Ptr(armsql.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-04-03T04:41:33.937Z"); return t}()), - // LastModifiedBy: to.Ptr("string"), - // LastModifiedByType: to.Ptr(armsql.CreatedByTypeUser), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/sql/armsql/models.go b/sdk/resourcemanager/sql/armsql/models.go index 0cea9bf0525f..4f7f5b9ad90f 100644 --- a/sdk/resourcemanager/sql/armsql/models.go +++ b/sdk/resourcemanager/sql/armsql/models.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armsql @@ -14,534 +13,487 @@ import "time" // AdministratorListResult - A list of active directory administrators. type AdministratorListResult struct { // READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` + NextLink *string // READ-ONLY; Array of results. - Value []*ServerAzureADAdministrator `json:"value,omitempty" azure:"ro"` + Value []*ServerAzureADAdministrator } // AdministratorProperties - Properties of a active directory administrator. type AdministratorProperties struct { // REQUIRED; Type of the sever administrator. - AdministratorType *AdministratorType `json:"administratorType,omitempty"` + AdministratorType *AdministratorType // REQUIRED; Login name of the server administrator. - Login *string `json:"login,omitempty"` + Login *string // REQUIRED; SID (object ID) of the server administrator. - Sid *string `json:"sid,omitempty"` + Sid *string // Tenant ID of the administrator. - TenantID *string `json:"tenantId,omitempty"` + TenantID *string // READ-ONLY; Azure Active Directory only Authentication enabled. - AzureADOnlyAuthentication *bool `json:"azureADOnlyAuthentication,omitempty" azure:"ro"` + AzureADOnlyAuthentication *bool } // AdvancedThreatProtectionProperties - Properties of an Advanced Threat Protection state. type AdvancedThreatProtectionProperties struct { // REQUIRED; Specifies the state of the Advanced Threat Protection, whether it is enabled or disabled or a state has not been // applied yet on the specific database or server. - State *AdvancedThreatProtectionState `json:"state,omitempty"` + State *AdvancedThreatProtectionState // READ-ONLY; Specifies the UTC creation time of the policy. - CreationTime *time.Time `json:"creationTime,omitempty" azure:"ro"` + CreationTime *time.Time } // Advisor - Database, Server or Elastic Pool Advisor. type Advisor struct { // Resource properties. - Properties *AdvisorProperties `json:"properties,omitempty"` + Properties *AdvisorProperties // READ-ONLY; Resource ID. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; Resource kind. - Kind *string `json:"kind,omitempty" azure:"ro"` + Kind *string // READ-ONLY; Resource location. - Location *string `json:"location,omitempty" azure:"ro"` + Location *string // READ-ONLY; Resource name. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // AdvisorProperties - Properties for a Database, Server or Elastic Pool Advisor. type AdvisorProperties struct { // REQUIRED; Gets the auto-execute status (whether to let the system execute the recommendations) of this advisor. Possible // values are 'Enabled' and 'Disabled' - AutoExecuteStatus *AutoExecuteStatus `json:"autoExecuteStatus,omitempty"` + AutoExecuteStatus *AutoExecuteStatus // READ-ONLY; Gets the status of availability of this advisor to customers. Possible values are 'GA', 'PublicPreview', 'LimitedPublicPreview' // and 'PrivatePreview'. - AdvisorStatus *AdvisorStatus `json:"advisorStatus,omitempty" azure:"ro"` + AdvisorStatus *AdvisorStatus // READ-ONLY; Gets the resource from which current value of auto-execute status is inherited. Auto-execute status can be set // on (and inherited from) different levels in the resource hierarchy. Possible values are // 'Subscription', 'Server', 'ElasticPool', 'Database' and 'Default' (when status is not explicitly set on any level). - AutoExecuteStatusInheritedFrom *AutoExecuteStatusInheritedFrom `json:"autoExecuteStatusInheritedFrom,omitempty" azure:"ro"` + AutoExecuteStatusInheritedFrom *AutoExecuteStatusInheritedFrom // READ-ONLY; Gets the time when the current resource was analyzed for recommendations by this advisor. - LastChecked *time.Time `json:"lastChecked,omitempty" azure:"ro"` + LastChecked *time.Time // READ-ONLY; Gets that status of recommendations for this advisor and reason for not having any recommendations. Possible // values include, but are not limited to, 'Ok' (Recommendations available),LowActivity (not // enough workload to analyze), 'DbSeemsTuned' (Database is doing well), etc. - RecommendationsStatus *string `json:"recommendationsStatus,omitempty" azure:"ro"` + RecommendationsStatus *string // READ-ONLY; Gets the recommended actions for this advisor. - RecommendedActions []*RecommendedAction `json:"recommendedActions,omitempty" azure:"ro"` -} - -// AgentClientCreateOrUpdateOptions contains the optional parameters for the AgentClient.CreateOrUpdate method. -type AgentClientCreateOrUpdateOptions struct { - // placeholder for future optional parameters -} - -// AgentClientGetOptions contains the optional parameters for the AgentClient.Get method. -type AgentClientGetOptions struct { - // placeholder for future optional parameters + RecommendedActions []*RecommendedAction } // AgentConfiguration - A recoverable managed database resource. type AgentConfiguration struct { // Resource properties. - Properties *AgentConfigurationProperties `json:"properties,omitempty"` + Properties *AgentConfigurationProperties // READ-ONLY; Resource ID. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; Resource name. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // AgentConfigurationProperties - Sql agent configuration properties. type AgentConfigurationProperties struct { // The state of Sql Agent. - State *SQLAgentConfigurationPropertiesState `json:"state,omitempty"` + State *SQLAgentConfigurationPropertiesState } // AutoPauseDelayTimeRange - Supported auto pause delay time range type AutoPauseDelayTimeRange struct { // READ-ONLY; Default value is no value is provided - Default *int32 `json:"default,omitempty" azure:"ro"` + Default *int32 // READ-ONLY; Value that is used to not pause (infinite delay before pause) - DoNotPauseValue *int32 `json:"doNotPauseValue,omitempty" azure:"ro"` + DoNotPauseValue *int32 // READ-ONLY; Maximum value - MaxValue *int32 `json:"maxValue,omitempty" azure:"ro"` + MaxValue *int32 // READ-ONLY; Minimum value - MinValue *int32 `json:"minValue,omitempty" azure:"ro"` + MinValue *int32 // READ-ONLY; Step value for discrete values between the minimum value and the maximum value. - StepSize *int32 `json:"stepSize,omitempty" azure:"ro"` + StepSize *int32 // READ-ONLY; Unit of time that delay is expressed in - Unit *PauseDelayTimeUnit `json:"unit,omitempty" azure:"ro"` + Unit *PauseDelayTimeUnit } // AutomaticTuningOptions - Automatic tuning properties for individual advisors. type AutomaticTuningOptions struct { // Automatic tuning option desired state. - DesiredState *AutomaticTuningOptionModeDesired `json:"desiredState,omitempty"` + DesiredState *AutomaticTuningOptionModeDesired // READ-ONLY; Automatic tuning option actual state. - ActualState *AutomaticTuningOptionModeActual `json:"actualState,omitempty" azure:"ro"` + ActualState *AutomaticTuningOptionModeActual // READ-ONLY; Reason code if desired and actual state are different. - ReasonCode *int32 `json:"reasonCode,omitempty" azure:"ro"` + ReasonCode *int32 // READ-ONLY; Reason description if desired and actual state are different. - ReasonDesc *AutomaticTuningDisabledReason `json:"reasonDesc,omitempty" azure:"ro"` + ReasonDesc *AutomaticTuningDisabledReason } // AutomaticTuningServerOptions - Automatic tuning properties for individual advisors. type AutomaticTuningServerOptions struct { // Automatic tuning option desired state. - DesiredState *AutomaticTuningOptionModeDesired `json:"desiredState,omitempty"` + DesiredState *AutomaticTuningOptionModeDesired // READ-ONLY; Automatic tuning option actual state. - ActualState *AutomaticTuningOptionModeActual `json:"actualState,omitempty" azure:"ro"` + ActualState *AutomaticTuningOptionModeActual // READ-ONLY; Reason code if desired and actual state are different. - ReasonCode *int32 `json:"reasonCode,omitempty" azure:"ro"` + ReasonCode *int32 // READ-ONLY; Reason description if desired and actual state are different. - ReasonDesc *AutomaticTuningServerReason `json:"reasonDesc,omitempty" azure:"ro"` + ReasonDesc *AutomaticTuningServerReason } // AutomaticTuningServerProperties - Server-level Automatic Tuning properties. type AutomaticTuningServerProperties struct { // Automatic tuning desired state. - DesiredState *AutomaticTuningServerMode `json:"desiredState,omitempty"` + DesiredState *AutomaticTuningServerMode // Automatic tuning options definition. - Options map[string]*AutomaticTuningServerOptions `json:"options,omitempty"` + Options map[string]*AutomaticTuningServerOptions // READ-ONLY; Automatic tuning actual state. - ActualState *AutomaticTuningServerMode `json:"actualState,omitempty" azure:"ro"` + ActualState *AutomaticTuningServerMode } // AzureADOnlyAuthListResult - A list of active directory only authentications. type AzureADOnlyAuthListResult struct { // READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` + NextLink *string // READ-ONLY; Array of results. - Value []*ServerAzureADOnlyAuthentication `json:"value,omitempty" azure:"ro"` + Value []*ServerAzureADOnlyAuthentication } // AzureADOnlyAuthProperties - Properties of a active directory only authentication. type AzureADOnlyAuthProperties struct { // REQUIRED; Azure Active Directory only Authentication enabled. - AzureADOnlyAuthentication *bool `json:"azureADOnlyAuthentication,omitempty"` -} - -// BackupShortTermRetentionPoliciesClientBeginCreateOrUpdateOptions contains the optional parameters for the BackupShortTermRetentionPoliciesClient.BeginCreateOrUpdate -// method. -type BackupShortTermRetentionPoliciesClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// BackupShortTermRetentionPoliciesClientBeginUpdateOptions contains the optional parameters for the BackupShortTermRetentionPoliciesClient.BeginUpdate -// method. -type BackupShortTermRetentionPoliciesClientBeginUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// BackupShortTermRetentionPoliciesClientGetOptions contains the optional parameters for the BackupShortTermRetentionPoliciesClient.Get -// method. -type BackupShortTermRetentionPoliciesClientGetOptions struct { - // placeholder for future optional parameters -} - -// BackupShortTermRetentionPoliciesClientListByDatabaseOptions contains the optional parameters for the BackupShortTermRetentionPoliciesClient.NewListByDatabasePager -// method. -type BackupShortTermRetentionPoliciesClientListByDatabaseOptions struct { - // placeholder for future optional parameters + AzureADOnlyAuthentication *bool } // BackupShortTermRetentionPolicy - A short term retention policy. type BackupShortTermRetentionPolicy struct { // Resource properties. - Properties *BackupShortTermRetentionPolicyProperties `json:"properties,omitempty"` + Properties *BackupShortTermRetentionPolicyProperties // READ-ONLY; Resource ID. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; Resource name. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // BackupShortTermRetentionPolicyListResult - A list of short term retention policies. type BackupShortTermRetentionPolicyListResult struct { // READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` + NextLink *string // READ-ONLY; Array of results. - Value []*BackupShortTermRetentionPolicy `json:"value,omitempty" azure:"ro"` + Value []*BackupShortTermRetentionPolicy } // BackupShortTermRetentionPolicyProperties - Properties of a short term retention policy type BackupShortTermRetentionPolicyProperties struct { // The differential backup interval in hours. This is how many interval hours between each differential backup will be supported. // This is only applicable to live databases but not dropped databases. - DiffBackupIntervalInHours *DiffBackupIntervalInHours `json:"diffBackupIntervalInHours,omitempty"` + DiffBackupIntervalInHours *DiffBackupIntervalInHours // The backup retention period in days. This is how many days Point-in-Time Restore will be supported. - RetentionDays *int32 `json:"retentionDays,omitempty"` + RetentionDays *int32 } // BaseLongTermRetentionPolicyProperties - Properties of a long term retention policy type BaseLongTermRetentionPolicyProperties struct { // The monthly retention policy for an LTR backup in an ISO 8601 format. - MonthlyRetention *string `json:"monthlyRetention,omitempty"` + MonthlyRetention *string // The week of year to take the yearly backup in an ISO 8601 format. - WeekOfYear *int32 `json:"weekOfYear,omitempty"` + WeekOfYear *int32 // The weekly retention policy for an LTR backup in an ISO 8601 format. - WeeklyRetention *string `json:"weeklyRetention,omitempty"` + WeeklyRetention *string // The yearly retention policy for an LTR backup in an ISO 8601 format. - YearlyRetention *string `json:"yearlyRetention,omitempty"` + YearlyRetention *string +} + +// Baseline - SQL Vulnerability Assessment baseline Details +type Baseline struct { + // READ-ONLY; SQL Vulnerability Assessment baseline expected results + ExpectedResults [][]*string + + // READ-ONLY; SQL Vulnerability Assessment baseline update time (UTC) + UpdatedTime *time.Time +} + +// BaselineAdjustedResult - SQL Vulnerability Assessment baseline adjusted results +type BaselineAdjustedResult struct { + // READ-ONLY; SQL Vulnerability Assessment baseline details + Baseline *Baseline + + // READ-ONLY; SQL Vulnerability Assessment results that are not in baseline + ResultsNotInBaseline [][]*string + + // READ-ONLY; SQL Vulnerability Assessment results that are in baseline. + ResultsOnlyInBaseline [][]*string + + // READ-ONLY; SQL Vulnerability Assessment baseline status + Status *RuleStatus } -// CapabilitiesClientListByLocationOptions contains the optional parameters for the CapabilitiesClient.ListByLocation method. -type CapabilitiesClientListByLocationOptions struct { - // If specified, restricts the response to only include the selected item. - Include *CapabilityGroup +// BenchmarkReference - SQL Vulnerability Assessment benchmark reference +type BenchmarkReference struct { + // READ-ONLY; SQL Vulnerability Assessment benchmark name + Benchmark *string + + // READ-ONLY; SQL Vulnerability Assessment benchmark reference. + Reference *string } // CheckNameAvailabilityRequest - A request to check whether the specified name for a resource is available. type CheckNameAvailabilityRequest struct { // REQUIRED - Name *string `json:"name,omitempty"` + Name *string // CONSTANT; Field has constant value "Microsoft.Sql/servers", any specified value is ignored. - Type *string `json:"type,omitempty"` + Type *string } // CheckNameAvailabilityResponse - The result of a name availability check. type CheckNameAvailabilityResponse struct { // READ-ONLY; True if the name is available, otherwise false. - Available *bool `json:"available,omitempty" azure:"ro"` + Available *bool // READ-ONLY; A message explaining why the name is unavailable. Will be undefined if the name is available. - Message *string `json:"message,omitempty" azure:"ro"` + Message *string // READ-ONLY; The name whose availability was checked. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; The reason code explaining why the name is unavailable. Will be undefined if the name is available. - Reason *CheckNameAvailabilityReason `json:"reason,omitempty" azure:"ro"` + Reason *CheckNameAvailabilityReason } // CompleteDatabaseRestoreDefinition - Contains the information necessary to perform a complete database restore operation. type CompleteDatabaseRestoreDefinition struct { // REQUIRED; The last backup name to apply - LastBackupName *string `json:"lastBackupName,omitempty"` + LastBackupName *string } // CopyLongTermRetentionBackupParameters - Contains the information necessary to perform long term retention backup copy operation. type CopyLongTermRetentionBackupParameters struct { // Resource properties. - Properties *CopyLongTermRetentionBackupParametersProperties `json:"properties,omitempty"` + Properties *CopyLongTermRetentionBackupParametersProperties } // CopyLongTermRetentionBackupParametersProperties - Contains the properties to perform long term retention backup copy operation. type CopyLongTermRetentionBackupParametersProperties struct { // The storage redundancy type of the copied backup - TargetBackupStorageRedundancy *BackupStorageRedundancy `json:"targetBackupStorageRedundancy,omitempty"` + TargetBackupStorageRedundancy *BackupStorageRedundancy // The name of the database owns the copied backup. - TargetDatabaseName *string `json:"targetDatabaseName,omitempty"` + TargetDatabaseName *string // The resource group that owns the target server - TargetResourceGroup *string `json:"targetResourceGroup,omitempty"` + TargetResourceGroup *string // The fully qualified domain name of the target server - TargetServerFullyQualifiedDomainName *string `json:"targetServerFullyQualifiedDomainName,omitempty"` + TargetServerFullyQualifiedDomainName *string // The resource Id of the target server that owns the database - TargetServerResourceID *string `json:"targetServerResourceId,omitempty"` + TargetServerResourceID *string // The subscription that owns the target server - TargetSubscriptionID *string `json:"targetSubscriptionId,omitempty"` + TargetSubscriptionID *string } // CreateDatabaseRestorePointDefinition - Contains the information necessary to perform a create database restore point operation. type CreateDatabaseRestorePointDefinition struct { // REQUIRED; The restore point label to apply - RestorePointLabel *string `json:"restorePointLabel,omitempty"` -} - -// DNSRefreshConfigurationProperties - DNS refresh configuration properties. -type DNSRefreshConfigurationProperties struct { - // READ-ONLY; The status of the DNS refresh operation. - Status *DNSRefreshConfigurationPropertiesStatus `json:"status,omitempty" azure:"ro"` + RestorePointLabel *string } -// DataMaskingPoliciesClientCreateOrUpdateOptions contains the optional parameters for the DataMaskingPoliciesClient.CreateOrUpdate -// method. -type DataMaskingPoliciesClientCreateOrUpdateOptions struct { - // placeholder for future optional parameters -} - -// DataMaskingPoliciesClientGetOptions contains the optional parameters for the DataMaskingPoliciesClient.Get method. -type DataMaskingPoliciesClientGetOptions struct { - // placeholder for future optional parameters -} - -// DataMaskingPolicy - Represents a database data masking policy. +// DataMaskingPolicy - A database data masking policy. type DataMaskingPolicy struct { - // The properties of the data masking policy. - Properties *DataMaskingPolicyProperties `json:"properties,omitempty"` + // Resource properties. + Properties *DataMaskingPolicyProperties // READ-ONLY; Resource ID. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string - // READ-ONLY; The kind of data masking policy. Metadata, used for Azure portal. - Kind *string `json:"kind,omitempty" azure:"ro"` + // READ-ONLY; The kind of Data Masking Policy. Metadata, used for Azure portal. + Kind *string // READ-ONLY; The location of the data masking policy. - Location *string `json:"location,omitempty" azure:"ro"` + Location *string // READ-ONLY; Resource name. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // DataMaskingPolicyProperties - The properties of a database data masking policy. type DataMaskingPolicyProperties struct { // REQUIRED; The state of the data masking policy. - DataMaskingState *DataMaskingState `json:"dataMaskingState,omitempty"` + DataMaskingState *DataMaskingState // The list of the exempt principals. Specifies the semicolon-separated list of database users for which the data masking // policy does not apply. The specified users receive data results without masking // for all of the database queries. - ExemptPrincipals *string `json:"exemptPrincipals,omitempty"` + ExemptPrincipals *string // READ-ONLY; The list of the application principals. This is a legacy parameter and is no longer used. - ApplicationPrincipals *string `json:"applicationPrincipals,omitempty" azure:"ro"` + ApplicationPrincipals *string // READ-ONLY; The masking level. This is a legacy parameter and is no longer used. - MaskingLevel *string `json:"maskingLevel,omitempty" azure:"ro"` + MaskingLevel *string } -// DataMaskingRule - Represents a database data masking rule. +// DataMaskingRule - A database data masking rule. type DataMaskingRule struct { - // The properties of the resource. - Properties *DataMaskingRuleProperties `json:"properties,omitempty"` + // Resource properties. + Properties *DataMaskingRuleProperties // READ-ONLY; Resource ID. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; The kind of Data Masking Rule. Metadata, used for Azure portal. - Kind *string `json:"kind,omitempty" azure:"ro"` + Kind *string // READ-ONLY; The location of the data masking rule. - Location *string `json:"location,omitempty" azure:"ro"` + Location *string // READ-ONLY; Resource name. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } -// DataMaskingRuleListResult - The response to a list data masking rules request. +// DataMaskingRuleListResult - The list of database data masking rules. type DataMaskingRuleListResult struct { - // The list of database data masking rules. - Value []*DataMaskingRule `json:"value,omitempty"` + // READ-ONLY; Link to retrieve next page of results. + NextLink *string + + // READ-ONLY; Array of results. + Value []*DataMaskingRule } // DataMaskingRuleProperties - The properties of a database data masking rule. type DataMaskingRuleProperties struct { // REQUIRED; The column name on which the data masking rule is applied. - ColumnName *string `json:"columnName,omitempty"` + ColumnName *string // REQUIRED; The masking function that is used for the data masking rule. - MaskingFunction *DataMaskingFunction `json:"maskingFunction,omitempty"` + MaskingFunction *DataMaskingFunction // REQUIRED; The schema name on which the data masking rule is applied. - SchemaName *string `json:"schemaName,omitempty"` + SchemaName *string // REQUIRED; The table name on which the data masking rule is applied. - TableName *string `json:"tableName,omitempty"` + TableName *string // The alias name. This is a legacy parameter and is no longer used. - AliasName *string `json:"aliasName,omitempty"` + AliasName *string // The numberFrom property of the masking rule. Required if maskingFunction is set to Number, otherwise this parameter will // be ignored. - NumberFrom *string `json:"numberFrom,omitempty"` + NumberFrom *string // The numberTo property of the data masking rule. Required if maskingFunction is set to Number, otherwise this parameter // will be ignored. - NumberTo *string `json:"numberTo,omitempty"` + NumberTo *string // If maskingFunction is set to Text, the number of characters to show unmasked in the beginning of the string. Otherwise, // this parameter will be ignored. - PrefixSize *string `json:"prefixSize,omitempty"` + PrefixSize *string // If maskingFunction is set to Text, the character to use for masking the unexposed part of the string. Otherwise, this parameter // will be ignored. - ReplacementString *string `json:"replacementString,omitempty"` + ReplacementString *string // The rule state. Used to delete a rule. To delete an existing rule, specify the schemaName, tableName, columnName, maskingFunction, // and specify ruleState as disabled. However, if the rule doesn't // already exist, the rule will be created with ruleState set to enabled, regardless of the provided value of ruleState. - RuleState *DataMaskingRuleState `json:"ruleState,omitempty"` + RuleState *DataMaskingRuleState // If maskingFunction is set to Text, the number of characters to show unmasked at the end of the string. Otherwise, this // parameter will be ignored. - SuffixSize *string `json:"suffixSize,omitempty"` + SuffixSize *string // READ-ONLY; The rule Id. - ID *string `json:"id,omitempty" azure:"ro"` -} - -// DataMaskingRulesClientCreateOrUpdateOptions contains the optional parameters for the DataMaskingRulesClient.CreateOrUpdate -// method. -type DataMaskingRulesClientCreateOrUpdateOptions struct { - // placeholder for future optional parameters -} - -// DataMaskingRulesClientListByDatabaseOptions contains the optional parameters for the DataMaskingRulesClient.NewListByDatabasePager -// method. -type DataMaskingRulesClientListByDatabaseOptions struct { - // placeholder for future optional parameters + ID *string } // DataWarehouseUserActivities - User activities of a data warehouse type DataWarehouseUserActivities struct { // Resource properties. - Properties *DataWarehouseUserActivitiesProperties `json:"properties,omitempty"` + Properties *DataWarehouseUserActivitiesProperties // READ-ONLY; Resource ID. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; Resource name. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` -} - -// DataWarehouseUserActivitiesClientGetOptions contains the optional parameters for the DataWarehouseUserActivitiesClient.Get -// method. -type DataWarehouseUserActivitiesClientGetOptions struct { - // placeholder for future optional parameters -} - -// DataWarehouseUserActivitiesClientListByDatabaseOptions contains the optional parameters for the DataWarehouseUserActivitiesClient.NewListByDatabasePager -// method. -type DataWarehouseUserActivitiesClientListByDatabaseOptions struct { - // placeholder for future optional parameters + Type *string } // DataWarehouseUserActivitiesListResult - User activities of a data warehouse type DataWarehouseUserActivitiesListResult struct { // READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` + NextLink *string // READ-ONLY; Array of results. - Value []*DataWarehouseUserActivities `json:"value,omitempty" azure:"ro"` + Value []*DataWarehouseUserActivities } // DataWarehouseUserActivitiesProperties - User activities of a data warehouse. This currently includes the count of running // or suspended queries. For more information, please view the sys.dmpdwexec_requests dynamic management view (DMV). type DataWarehouseUserActivitiesProperties struct { // READ-ONLY; Count of running and suspended queries. - ActiveQueriesCount *int32 `json:"activeQueriesCount,omitempty" azure:"ro"` + ActiveQueriesCount *int32 } // Database - A database resource. type Database struct { // REQUIRED; Resource location. - Location *string `json:"location,omitempty"` + Location *string // The Azure Active Directory identity of the database. - Identity *DatabaseIdentity `json:"identity,omitempty"` + Identity *DatabaseIdentity // Resource properties. - Properties *DatabaseProperties `json:"properties,omitempty"` + Properties *DatabaseProperties // The database SKU. // The list of SKUs may vary by region and support offer. To determine the SKUs (including the SKU name, tier/edition, family, @@ -551,176 +503,112 @@ type Database struct { // ` // Get-AzSqlServerServiceObjective -Location // ` - SKU *SKU `json:"sku,omitempty"` + SKU *SKU // Resource tags. - Tags map[string]*string `json:"tags,omitempty"` + Tags map[string]*string // READ-ONLY; Resource ID. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; Kind of database. This is metadata used for the Azure portal experience. - Kind *string `json:"kind,omitempty" azure:"ro"` + Kind *string // READ-ONLY; Resource that manages the database. - ManagedBy *string `json:"managedBy,omitempty" azure:"ro"` + ManagedBy *string // READ-ONLY; Resource name. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // DatabaseAdvancedThreatProtection - A database Advanced Threat Protection. type DatabaseAdvancedThreatProtection struct { // Resource properties. - Properties *AdvancedThreatProtectionProperties `json:"properties,omitempty"` + Properties *AdvancedThreatProtectionProperties // READ-ONLY; Resource ID. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; Resource name. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; SystemData of AdvancedThreatProtectionResource. - SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` + SystemData *SystemData // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // DatabaseAdvancedThreatProtectionListResult - A list of the database's Advanced Threat Protection configurations. type DatabaseAdvancedThreatProtectionListResult struct { // READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` + NextLink *string // READ-ONLY; Array of results. - Value []*DatabaseAdvancedThreatProtection `json:"value,omitempty" azure:"ro"` -} - -// DatabaseAdvancedThreatProtectionSettingsClientCreateOrUpdateOptions contains the optional parameters for the DatabaseAdvancedThreatProtectionSettingsClient.CreateOrUpdate -// method. -type DatabaseAdvancedThreatProtectionSettingsClientCreateOrUpdateOptions struct { - // placeholder for future optional parameters -} - -// DatabaseAdvancedThreatProtectionSettingsClientGetOptions contains the optional parameters for the DatabaseAdvancedThreatProtectionSettingsClient.Get -// method. -type DatabaseAdvancedThreatProtectionSettingsClientGetOptions struct { - // placeholder for future optional parameters -} - -// DatabaseAdvancedThreatProtectionSettingsClientListByDatabaseOptions contains the optional parameters for the DatabaseAdvancedThreatProtectionSettingsClient.NewListByDatabasePager -// method. -type DatabaseAdvancedThreatProtectionSettingsClientListByDatabaseOptions struct { - // placeholder for future optional parameters -} - -// DatabaseAdvisorsClientGetOptions contains the optional parameters for the DatabaseAdvisorsClient.Get method. -type DatabaseAdvisorsClientGetOptions struct { - // placeholder for future optional parameters -} - -// DatabaseAdvisorsClientListByDatabaseOptions contains the optional parameters for the DatabaseAdvisorsClient.ListByDatabase -// method. -type DatabaseAdvisorsClientListByDatabaseOptions struct { - // The child resources to include in the response. - Expand *string -} - -// DatabaseAdvisorsClientUpdateOptions contains the optional parameters for the DatabaseAdvisorsClient.Update method. -type DatabaseAdvisorsClientUpdateOptions struct { - // placeholder for future optional parameters + Value []*DatabaseAdvancedThreatProtection } // DatabaseAutomaticTuning - Database-level Automatic Tuning. type DatabaseAutomaticTuning struct { // Resource properties. - Properties *DatabaseAutomaticTuningProperties `json:"properties,omitempty"` + Properties *DatabaseAutomaticTuningProperties // READ-ONLY; Resource ID. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; Resource name. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` -} - -// DatabaseAutomaticTuningClientGetOptions contains the optional parameters for the DatabaseAutomaticTuningClient.Get method. -type DatabaseAutomaticTuningClientGetOptions struct { - // placeholder for future optional parameters -} - -// DatabaseAutomaticTuningClientUpdateOptions contains the optional parameters for the DatabaseAutomaticTuningClient.Update -// method. -type DatabaseAutomaticTuningClientUpdateOptions struct { - // placeholder for future optional parameters + Type *string } // DatabaseAutomaticTuningProperties - Database-level Automatic Tuning properties. type DatabaseAutomaticTuningProperties struct { // Automatic tuning desired state. - DesiredState *AutomaticTuningMode `json:"desiredState,omitempty"` + DesiredState *AutomaticTuningMode // Automatic tuning options definition. - Options map[string]*AutomaticTuningOptions `json:"options,omitempty"` + Options map[string]*AutomaticTuningOptions // READ-ONLY; Automatic tuning actual state. - ActualState *AutomaticTuningMode `json:"actualState,omitempty" azure:"ro"` -} - -// DatabaseBlobAuditingPoliciesClientCreateOrUpdateOptions contains the optional parameters for the DatabaseBlobAuditingPoliciesClient.CreateOrUpdate -// method. -type DatabaseBlobAuditingPoliciesClientCreateOrUpdateOptions struct { - // placeholder for future optional parameters -} - -// DatabaseBlobAuditingPoliciesClientGetOptions contains the optional parameters for the DatabaseBlobAuditingPoliciesClient.Get -// method. -type DatabaseBlobAuditingPoliciesClientGetOptions struct { - // placeholder for future optional parameters -} - -// DatabaseBlobAuditingPoliciesClientListByDatabaseOptions contains the optional parameters for the DatabaseBlobAuditingPoliciesClient.NewListByDatabasePager -// method. -type DatabaseBlobAuditingPoliciesClientListByDatabaseOptions struct { - // placeholder for future optional parameters + ActualState *AutomaticTuningMode } // DatabaseBlobAuditingPolicy - A database blob auditing policy. type DatabaseBlobAuditingPolicy struct { // Resource properties. - Properties *DatabaseBlobAuditingPolicyProperties `json:"properties,omitempty"` + Properties *DatabaseBlobAuditingPolicyProperties // READ-ONLY; Resource ID. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; Resource kind. - Kind *string `json:"kind,omitempty" azure:"ro"` + Kind *string // READ-ONLY; Resource name. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // DatabaseBlobAuditingPolicyListResult - A list of database auditing settings. type DatabaseBlobAuditingPolicyListResult struct { // READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` + NextLink *string // READ-ONLY; Array of results. - Value []*DatabaseBlobAuditingPolicy `json:"value,omitempty" azure:"ro"` + Value []*DatabaseBlobAuditingPolicy } // DatabaseBlobAuditingPolicyProperties - Properties of a database blob auditing policy. type DatabaseBlobAuditingPolicyProperties struct { // REQUIRED; Specifies the state of the audit. If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled are required. - State *BlobAuditingPolicyState `json:"state,omitempty"` + State *BlobAuditingPolicyState // Specifies the Actions-Groups and Actions to audit. // The recommended set of action groups to use is the following combination - this will audit all the queries and stored procedures @@ -750,7 +638,7 @@ type DatabaseBlobAuditingPolicyProperties struct { // For example: SELECT on dbo.myTable by public SELECT on DATABASE::myDatabase by public SELECT on SCHEMA::mySchema by public // For more information, see Database-Level Audit Actions // [https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-actions] - AuditActionsAndGroups []*string `json:"auditActionsAndGroups,omitempty"` + AuditActionsAndGroups []*string // Specifies whether audit events are sent to Azure Monitor. In order to send the events to Azure Monitor, specify 'State' // as 'Enabled' and 'IsAzureMonitorTargetEnabled' as true. @@ -761,20 +649,20 @@ type DatabaseBlobAuditingPolicyProperties struct { // https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview // For more information, see Diagnostic Settings REST API [https://go.microsoft.com/fwlink/?linkid=2033207]or Diagnostic Settings // PowerShell [https://go.microsoft.com/fwlink/?linkid=2033043] - IsAzureMonitorTargetEnabled *bool `json:"isAzureMonitorTargetEnabled,omitempty"` + IsAzureMonitorTargetEnabled *bool // Specifies whether Managed Identity is used to access blob storage - IsManagedIdentityInUse *bool `json:"isManagedIdentityInUse,omitempty"` + IsManagedIdentityInUse *bool // Specifies whether storageAccountAccessKey value is the storage's secondary key. - IsStorageSecondaryKeyInUse *bool `json:"isStorageSecondaryKeyInUse,omitempty"` + IsStorageSecondaryKeyInUse *bool // Specifies the amount of time in milliseconds that can elapse before audit actions are forced to be processed. The default // minimum value is 1000 (1 second). The maximum is 2,147,483,647. - QueueDelayMs *int32 `json:"queueDelayMs,omitempty"` + QueueDelayMs *int32 // Specifies the number of days to keep in the audit logs in the storage account. - RetentionDays *int32 `json:"retentionDays,omitempty"` + RetentionDays *int32 // Specifies the identifier key of the auditing storage account. If state is Enabled and storageEndpoint is specified, not // specifying the storageAccountAccessKey will use SQL server system-assigned @@ -783,237 +671,227 @@ type DatabaseBlobAuditingPolicyProperties struct { // 2. Grant SQL Server identity access to the storage account by adding 'Storage Blob Data Contributor' RBAC role to the server // identity. For more information, see Auditing to storage using Managed // Identity authentication [https://go.microsoft.com/fwlink/?linkid=2114355] - StorageAccountAccessKey *string `json:"storageAccountAccessKey,omitempty"` + StorageAccountAccessKey *string // Specifies the blob storage subscription Id. - StorageAccountSubscriptionID *string `json:"storageAccountSubscriptionId,omitempty"` + StorageAccountSubscriptionID *string // Specifies the blob storage endpoint (e.g. https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint // or isAzureMonitorTargetEnabled is required. - StorageEndpoint *string `json:"storageEndpoint,omitempty"` + StorageEndpoint *string } // DatabaseColumn - A database column resource. type DatabaseColumn struct { // Resource properties. - Properties *DatabaseColumnProperties `json:"properties,omitempty"` + Properties *DatabaseColumnProperties // READ-ONLY; Resource ID. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; Resource name. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // DatabaseColumnListResult - A list of database columns. type DatabaseColumnListResult struct { // READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` + NextLink *string // READ-ONLY; Array of results. - Value []*DatabaseColumn `json:"value,omitempty" azure:"ro"` + Value []*DatabaseColumn } // DatabaseColumnProperties - Database column properties. type DatabaseColumnProperties struct { // The column data type. - ColumnType *ColumnDataType `json:"columnType,omitempty"` + ColumnType *ColumnDataType // Whether or not the column is computed. - IsComputed *bool `json:"isComputed,omitempty"` + IsComputed *bool // Whether or not the column belongs to a memory optimized table. - MemoryOptimized *bool `json:"memoryOptimized,omitempty"` + MemoryOptimized *bool // The table temporal type. - TemporalType *TableTemporalType `json:"temporalType,omitempty"` -} - -// DatabaseColumnsClientGetOptions contains the optional parameters for the DatabaseColumnsClient.Get method. -type DatabaseColumnsClientGetOptions struct { - // placeholder for future optional parameters -} - -// DatabaseColumnsClientListByDatabaseOptions contains the optional parameters for the DatabaseColumnsClient.NewListByDatabasePager -// method. -type DatabaseColumnsClientListByDatabaseOptions struct { - Column []string - OrderBy []string - Schema []string - // An opaque token that identifies a starting point in the collection. - Skiptoken *string - Table []string -} - -// DatabaseColumnsClientListByTableOptions contains the optional parameters for the DatabaseColumnsClient.NewListByTablePager -// method. -type DatabaseColumnsClientListByTableOptions struct { - // An OData filter expression that filters elements in the collection. - Filter *string + TemporalType *TableTemporalType } -// DatabaseExtensions - An export managed database operation result resource. +// DatabaseExtensions - An Import, Export, or PolybaseImport resource. type DatabaseExtensions struct { // Resource properties. - Properties *DatabaseExtensionsProperties `json:"properties,omitempty"` + Properties *DatabaseExtensionsProperties // READ-ONLY; Resource ID. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; Resource name. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } -// DatabaseExtensionsClientBeginCreateOrUpdateOptions contains the optional parameters for the DatabaseExtensionsClient.BeginCreateOrUpdate -// method. -type DatabaseExtensionsClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} +// DatabaseExtensionsProperties - Contains the database information after a successful Import, Export, or PolybaseImport +type DatabaseExtensionsProperties struct { + // REQUIRED; Operation mode of the operation: Import, Export, or PolybaseImport. + OperationMode *OperationMode -// DatabaseExtensionsClientGetOptions contains the optional parameters for the DatabaseExtensionsClient.Get method. -type DatabaseExtensionsClientGetOptions struct { - // placeholder for future optional parameters -} + // REQUIRED; Storage key for the storage account. + StorageKey *string -// DatabaseExtensionsClientListByDatabaseOptions contains the optional parameters for the DatabaseExtensionsClient.NewListByDatabasePager -// method. -type DatabaseExtensionsClientListByDatabaseOptions struct { - // placeholder for future optional parameters -} + // REQUIRED; Storage key type: StorageAccessKey or SharedAccessKey. + StorageKeyType *StorageKeyType -// DatabaseExtensionsProperties - Contains the database information after successful export. -type DatabaseExtensionsProperties struct { - // REQUIRED; Operation Mode. - OperationMode *OperationMode `json:"operationMode,omitempty"` + // REQUIRED; Storage Uri for the storage account. + StorageURI *string - // REQUIRED; Storage key. - StorageKey *string `json:"storageKey,omitempty"` + // Administrator login name. + AdministratorLogin *string - // REQUIRED; Storage key type. - StorageKeyType *StorageKeyType `json:"storageKeyType,omitempty"` + // Administrator login password. + AdministratorLoginPassword *string - // REQUIRED; Storage Uri. - StorageURI *string `json:"storageUri,omitempty"` + // Authentication type: SQL authentication or AD password. + AuthenticationType *string + + // Database edition for the newly created database in the case of an import operation. + DatabaseEdition *string + + // Database max size in bytes for the newly created database in the case of an import operation. + MaxSizeBytes *string + + // Optional resource information to enable network isolation for request. + NetworkIsolation *NetworkIsolationSettings + + // Database service level objective for the newly created database in the case of an import operation. + ServiceObjectiveName *string } // DatabaseIdentity - Azure Active Directory identity configuration for a resource. type DatabaseIdentity struct { // The identity type - Type *DatabaseIdentityType `json:"type,omitempty"` + Type *DatabaseIdentityType // The resource ids of the user assigned identities to use - UserAssignedIdentities map[string]*DatabaseUserIdentity `json:"userAssignedIdentities,omitempty"` + UserAssignedIdentities map[string]*DatabaseUserIdentity // READ-ONLY; The Azure Active Directory tenant id. - TenantID *string `json:"tenantId,omitempty" azure:"ro"` + TenantID *string +} + +// DatabaseKey - Database level key used for encryption at rest. +type DatabaseKey struct { + // READ-ONLY; The database key creation date. + CreationDate *time.Time + + // READ-ONLY; Subregion of the server key. + Subregion *string + + // READ-ONLY; Thumbprint of the database key. + Thumbprint *string + + // READ-ONLY; The database key type. Only supported value is 'AzureKeyVault'. + Type *DatabaseKeyType } // DatabaseListResult - A list of databases. type DatabaseListResult struct { // READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` + NextLink *string // READ-ONLY; Array of results. - Value []*Database `json:"value,omitempty" azure:"ro"` + Value []*Database } // DatabaseOperation - A database operation. type DatabaseOperation struct { // Resource properties. - Properties *DatabaseOperationProperties `json:"properties,omitempty"` + Properties *DatabaseOperationProperties // READ-ONLY; Resource ID. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; Resource name. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // DatabaseOperationListResult - The response to a list database operations request type DatabaseOperationListResult struct { // READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` + NextLink *string // READ-ONLY; Array of results. - Value []*DatabaseOperation `json:"value,omitempty" azure:"ro"` + Value []*DatabaseOperation } // DatabaseOperationProperties - The properties of a database operation. type DatabaseOperationProperties struct { // READ-ONLY; The name of the database the operation is being performed on. - DatabaseName *string `json:"databaseName,omitempty" azure:"ro"` + DatabaseName *string // READ-ONLY; The operation description. - Description *string `json:"description,omitempty" azure:"ro"` + Description *string // READ-ONLY; The operation error code. - ErrorCode *int32 `json:"errorCode,omitempty" azure:"ro"` + ErrorCode *int32 // READ-ONLY; The operation error description. - ErrorDescription *string `json:"errorDescription,omitempty" azure:"ro"` + ErrorDescription *string // READ-ONLY; The operation error severity. - ErrorSeverity *int32 `json:"errorSeverity,omitempty" azure:"ro"` + ErrorSeverity *int32 // READ-ONLY; The estimated completion time of the operation. - EstimatedCompletionTime *time.Time `json:"estimatedCompletionTime,omitempty" azure:"ro"` + EstimatedCompletionTime *time.Time // READ-ONLY; Whether the operation can be cancelled. - IsCancellable *bool `json:"isCancellable,omitempty" azure:"ro"` + IsCancellable *bool // READ-ONLY; Whether or not the error is a user error. - IsUserError *bool `json:"isUserError,omitempty" azure:"ro"` + IsUserError *bool // READ-ONLY; The name of operation. - Operation *string `json:"operation,omitempty" azure:"ro"` + Operation *string // READ-ONLY; The friendly name of operation. - OperationFriendlyName *string `json:"operationFriendlyName,omitempty" azure:"ro"` + OperationFriendlyName *string + + // READ-ONLY; The operation phase details. + OperationPhaseDetails *PhaseDetails // READ-ONLY; The percentage of the operation completed. - PercentComplete *int32 `json:"percentComplete,omitempty" azure:"ro"` + PercentComplete *int32 // READ-ONLY; The name of the server. - ServerName *string `json:"serverName,omitempty" azure:"ro"` + ServerName *string // READ-ONLY; The operation start time. - StartTime *time.Time `json:"startTime,omitempty" azure:"ro"` + StartTime *time.Time // READ-ONLY; The operation state. - State *ManagementOperationState `json:"state,omitempty" azure:"ro"` -} - -// DatabaseOperationsClientCancelOptions contains the optional parameters for the DatabaseOperationsClient.Cancel method. -type DatabaseOperationsClientCancelOptions struct { - // placeholder for future optional parameters -} - -// DatabaseOperationsClientListByDatabaseOptions contains the optional parameters for the DatabaseOperationsClient.NewListByDatabasePager -// method. -type DatabaseOperationsClientListByDatabaseOptions struct { - // placeholder for future optional parameters + State *ManagementOperationState } // DatabaseProperties - The database's properties. type DatabaseProperties struct { // Time in minutes after which database is automatically paused. A value of -1 means that automatic pause is disabled - AutoPauseDelay *int32 `json:"autoPauseDelay,omitempty"` + AutoPauseDelay *int32 + + // Specifies the availability zone the database is pinned to. + AvailabilityZone *AvailabilityZoneType // Collation of the metadata catalog. - CatalogCollation *CatalogCollationType `json:"catalogCollation,omitempty"` + CatalogCollation *CatalogCollationType // The collation of the database. - Collation *string `json:"collation,omitempty"` + Collation *string // Specifies the mode of database creation. // Default: regular database creation. @@ -1034,300 +912,386 @@ type DatabaseProperties struct { // RestoreLongTermRetentionBackup: Creates a database by restoring from a long term retention vault. recoveryServicesRecoveryPointResourceId // must be specified as the recovery point resource ID. // Copy, Secondary, and RestoreLongTermRetentionBackup are not supported for DataWarehouse edition. - CreateMode *CreateMode `json:"createMode,omitempty"` + CreateMode *CreateMode // The resource identifier of the elastic pool containing this database. - ElasticPoolID *string `json:"elasticPoolId,omitempty"` + ElasticPoolID *string + + // The azure key vault URI of the database if it's configured with per Database Customer Managed Keys. + EncryptionProtector *string // The Client id used for cross tenant per database CMK scenario - FederatedClientID *string `json:"federatedClientId,omitempty"` + FederatedClientID *string // The number of secondary replicas associated with the database that are used to provide high availability. Not applicable // to a Hyperscale database within an elastic pool. - HighAvailabilityReplicaCount *int32 `json:"highAvailabilityReplicaCount,omitempty"` + HighAvailabilityReplicaCount *int32 // Whether or not this database is a ledger database, which means all tables in the database are ledger tables. Note: the // value of this property cannot be changed after the database has been created. - IsLedgerOn *bool `json:"isLedgerOn,omitempty"` + IsLedgerOn *bool + + // The resource ids of the user assigned identities to use + Keys map[string]*DatabaseKey // The license type to apply for this database. LicenseIncluded if you need a license, or BasePrice if you have a license // and are eligible for the Azure Hybrid Benefit. - LicenseType *DatabaseLicenseType `json:"licenseType,omitempty"` + LicenseType *DatabaseLicenseType // The resource identifier of the long term retention backup associated with create operation of this database. - LongTermRetentionBackupResourceID *string `json:"longTermRetentionBackupResourceId,omitempty"` + LongTermRetentionBackupResourceID *string // Maintenance configuration id assigned to the database. This configuration defines the period when the maintenance updates // will occur. - MaintenanceConfigurationID *string `json:"maintenanceConfigurationId,omitempty"` + MaintenanceConfigurationID *string + + // Whether or not customer controlled manual cutover needs to be done during Update Database operation to Hyperscale tier. + // This property is only applicable when scaling database from Business Critical/General Purpose/Premium/Standard tier to + // Hyperscale tier. + // When manualCutover is specified, the scaling operation will wait for user input to trigger cutover to Hyperscale database. + // To trigger cutover, please provide 'performCutover' parameter when the Scaling operation is in Waiting state. + ManualCutover *bool // The max size of the database expressed in bytes. - MaxSizeBytes *int64 `json:"maxSizeBytes,omitempty"` + MaxSizeBytes *int64 // Minimal capacity that database will always have allocated, if not paused - MinCapacity *float64 `json:"minCapacity,omitempty"` + MinCapacity *float64 + + // To trigger customer controlled manual cutover during the wait state while Scaling operation is in progress. + // This property parameter is only applicable for scaling operations that are initiated along with 'manualCutover' parameter. + // This property is only applicable when scaling database from Business Critical/General Purpose/Premium/Standard tier to + // Hyperscale tier is already in progress. + // When performCutover is specified, the scaling operation will trigger cutover and perform role-change to Hyperscale database. + PerformCutover *bool + + // Type of enclave requested on the database i.e. Default or VBS enclaves. + PreferredEnclaveType *AlwaysEncryptedEnclaveType // The state of read-only routing. If enabled, connections that have application intent set to readonly in their connection // string may be routed to a readonly secondary replica in the same region. Not // applicable to a Hyperscale database within an elastic pool. - ReadScale *DatabaseReadScale `json:"readScale,omitempty"` + ReadScale *DatabaseReadScale // The resource identifier of the recoverable database associated with create operation of this database. - RecoverableDatabaseID *string `json:"recoverableDatabaseId,omitempty"` + RecoverableDatabaseID *string // The resource identifier of the recovery point associated with create operation of this database. - RecoveryServicesRecoveryPointID *string `json:"recoveryServicesRecoveryPointId,omitempty"` + RecoveryServicesRecoveryPointID *string // The storage account type to be used to store backups for this database. - RequestedBackupStorageRedundancy *BackupStorageRedundancy `json:"requestedBackupStorageRedundancy,omitempty"` + RequestedBackupStorageRedundancy *BackupStorageRedundancy // The resource identifier of the restorable dropped database associated with create operation of this database. - RestorableDroppedDatabaseID *string `json:"restorableDroppedDatabaseId,omitempty"` + RestorableDroppedDatabaseID *string // Specifies the point in time (ISO8601 format) of the source database that will be restored to create the new database. - RestorePointInTime *time.Time `json:"restorePointInTime,omitempty"` + RestorePointInTime *time.Time // The name of the sample schema to apply when creating this database. - SampleName *SampleName `json:"sampleName,omitempty"` + SampleName *SampleName - // The secondary type of the database if it is a secondary. Valid values are Geo and Named. - SecondaryType *SecondaryType `json:"secondaryType,omitempty"` + // The secondary type of the database if it is a secondary. Valid values are Geo, Named and Standby. + SecondaryType *SecondaryType // Specifies the time that the database was deleted. - SourceDatabaseDeletionDate *time.Time `json:"sourceDatabaseDeletionDate,omitempty"` + SourceDatabaseDeletionDate *time.Time // The resource identifier of the source database associated with create operation of this database. - SourceDatabaseID *string `json:"sourceDatabaseId,omitempty"` + SourceDatabaseID *string // The resource identifier of the source associated with the create operation of this database. + // This property is only supported for DataWarehouse edition and allows to restore across subscriptions. // When sourceResourceId is specified, sourceDatabaseId, recoverableDatabaseId, restorableDroppedDatabaseId and sourceDatabaseDeletionDate // must not be specified and CreateMode must be PointInTimeRestore, // Restore or Recover. - // When createMode is PointInTimeRestore, sourceResourceId must be the resource ID of an existing database or existing sql + // When createMode is PointInTimeRestore, sourceResourceId must be the resource ID of the existing database or existing sql // pool, and restorePointInTime must be specified. // When createMode is Restore, sourceResourceId must be the resource ID of restorable dropped database or restorable dropped // sql pool. // When createMode is Recover, sourceResourceId must be the resource ID of recoverable database or recoverable sql pool. - // This property allows to restore across subscriptions which is only supported for DataWarehouse edition. // When source subscription belongs to a different tenant than target subscription, “x-ms-authorization-auxiliary” header // must contain authentication token for the source tenant. For more details about // “x-ms-authorization-auxiliary” header see https://docs.microsoft.com/en-us/azure/azure-resource-manager/management/authenticate-multi-tenant - SourceResourceID *string `json:"sourceResourceId,omitempty"` + SourceResourceID *string // Whether or not this database is zone redundant, which means the replicas of this database will be spread across multiple // availability zones. - ZoneRedundant *bool `json:"zoneRedundant,omitempty"` + ZoneRedundant *bool // READ-ONLY; The creation date of the database (ISO8601 format). - CreationDate *time.Time `json:"creationDate,omitempty" azure:"ro"` + CreationDate *time.Time // READ-ONLY; The storage account type used to store backups for this database. - CurrentBackupStorageRedundancy *BackupStorageRedundancy `json:"currentBackupStorageRedundancy,omitempty" azure:"ro"` + CurrentBackupStorageRedundancy *BackupStorageRedundancy // READ-ONLY; The name and tier of the SKU. - CurrentSKU *SKU `json:"currentSku,omitempty" azure:"ro"` + CurrentSKU *SKU // READ-ONLY; The current service level objective name of the database. - CurrentServiceObjectiveName *string `json:"currentServiceObjectiveName,omitempty" azure:"ro"` + CurrentServiceObjectiveName *string // READ-ONLY; The ID of the database. - DatabaseID *string `json:"databaseId,omitempty" azure:"ro"` + DatabaseID *string // READ-ONLY; The default secondary region for this database. - DefaultSecondaryLocation *string `json:"defaultSecondaryLocation,omitempty" azure:"ro"` + DefaultSecondaryLocation *string // READ-ONLY; This records the earliest start date and time that restore is available for this database (ISO8601 format). - EarliestRestoreDate *time.Time `json:"earliestRestoreDate,omitempty" azure:"ro"` + EarliestRestoreDate *time.Time // READ-ONLY; Failover Group resource identifier that this database belongs to. - FailoverGroupID *string `json:"failoverGroupId,omitempty" azure:"ro"` + FailoverGroupID *string // READ-ONLY; Infra encryption is enabled for this database. - IsInfraEncryptionEnabled *bool `json:"isInfraEncryptionEnabled,omitempty" azure:"ro"` + IsInfraEncryptionEnabled *bool // READ-ONLY; The max log size for this database. - MaxLogSizeBytes *int64 `json:"maxLogSizeBytes,omitempty" azure:"ro"` + MaxLogSizeBytes *int64 // READ-ONLY; The date when database was paused by user configuration or action(ISO8601 format). Null if the database is ready. - PausedDate *time.Time `json:"pausedDate,omitempty" azure:"ro"` + PausedDate *time.Time // READ-ONLY; The requested service level objective name of the database. - RequestedServiceObjectiveName *string `json:"requestedServiceObjectiveName,omitempty" azure:"ro"` + RequestedServiceObjectiveName *string // READ-ONLY; The date when database was resumed by user action or database login (ISO8601 format). Null if the database is // paused. - ResumedDate *time.Time `json:"resumedDate,omitempty" azure:"ro"` + ResumedDate *time.Time // READ-ONLY; The status of the database. - Status *DatabaseStatus `json:"status,omitempty" azure:"ro"` + Status *DatabaseStatus } -// DatabaseRecommendedActionsClientGetOptions contains the optional parameters for the DatabaseRecommendedActionsClient.Get -// method. -type DatabaseRecommendedActionsClientGetOptions struct { - // placeholder for future optional parameters +// DatabaseSQLVulnerabilityAssessmentBaselineSet - A database sql vulnerability assessment baseline set. +type DatabaseSQLVulnerabilityAssessmentBaselineSet struct { + // Resource properties. + Properties *DatabaseSQLVulnerabilityAssessmentBaselineSetProperties + + // READ-ONLY; Resource ID. + ID *string + + // READ-ONLY; Resource name. + Name *string + + // READ-ONLY; SystemData of DatabaseSqlVulnerabilityAssessmentBaselineSetResource. + SystemData *SystemData + + // READ-ONLY; Resource type. + Type *string } -// DatabaseRecommendedActionsClientListByDatabaseAdvisorOptions contains the optional parameters for the DatabaseRecommendedActionsClient.ListByDatabaseAdvisor -// method. -type DatabaseRecommendedActionsClientListByDatabaseAdvisorOptions struct { - // placeholder for future optional parameters +// DatabaseSQLVulnerabilityAssessmentBaselineSetListResult - A list of SQL Vulnerability Assessments baseline set. +type DatabaseSQLVulnerabilityAssessmentBaselineSetListResult struct { + // READ-ONLY; Link to retrieve next page of results. + NextLink *string + + // READ-ONLY; Array of results. + Value []*DatabaseSQLVulnerabilityAssessmentBaselineSet } -// DatabaseRecommendedActionsClientUpdateOptions contains the optional parameters for the DatabaseRecommendedActionsClient.Update -// method. -type DatabaseRecommendedActionsClientUpdateOptions struct { - // placeholder for future optional parameters +// DatabaseSQLVulnerabilityAssessmentBaselineSetProperties - Properties of a database Sql Vulnerability Assessment baseline +// set. +type DatabaseSQLVulnerabilityAssessmentBaselineSetProperties struct { + // REQUIRED; The baseline set result + Results map[string][][]*string } -// DatabaseSchema - A database schema resource. -type DatabaseSchema struct { +// DatabaseSQLVulnerabilityAssessmentRuleBaseline - A database sql vulnerability assessment rule baseline. +type DatabaseSQLVulnerabilityAssessmentRuleBaseline struct { + // Resource properties. + Properties *DatabaseSQLVulnerabilityAssessmentRuleBaselineProperties + // READ-ONLY; Resource ID. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; Resource name. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string + + // READ-ONLY; SystemData of DatabaseSqlVulnerabilityAssessmentRuleBaselineResource. + SystemData *SystemData // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } -// DatabaseSchemaListResult - A list of database schemas. -type DatabaseSchemaListResult struct { - // READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` +// DatabaseSQLVulnerabilityAssessmentRuleBaselineInput - A database sql vulnerability assessment rule baseline input. +type DatabaseSQLVulnerabilityAssessmentRuleBaselineInput struct { + // Resource properties. + Properties *DatabaseSQLVulnerabilityAssessmentRuleBaselineInputProperties - // READ-ONLY; Array of results. - Value []*DatabaseSchema `json:"value,omitempty" azure:"ro"` + // READ-ONLY; Resource ID. + ID *string + + // READ-ONLY; Resource name. + Name *string + + // READ-ONLY; SystemData of DatabaseSqlVulnerabilityAssessmentRuleBaselineInputResource. + SystemData *SystemData + + // READ-ONLY; Resource type. + Type *string +} + +// DatabaseSQLVulnerabilityAssessmentRuleBaselineInputProperties - Properties of a database Sql Vulnerability Assessment rule +// baseline. +type DatabaseSQLVulnerabilityAssessmentRuleBaselineInputProperties struct { + // REQUIRED; The latest scan flag + LatestScan *bool + + // REQUIRED; The rule baseline result + Results [][]*string } -// DatabaseSchemasClientGetOptions contains the optional parameters for the DatabaseSchemasClient.Get method. -type DatabaseSchemasClientGetOptions struct { - // placeholder for future optional parameters +// DatabaseSQLVulnerabilityAssessmentRuleBaselineListInput - A database sql vulnerability assessment rule baseline list input. +type DatabaseSQLVulnerabilityAssessmentRuleBaselineListInput struct { + // Resource properties. + Properties *DatabaseSQLVulnerabilityAssessmentRuleBaselineListInputProperties + + // READ-ONLY; Resource ID. + ID *string + + // READ-ONLY; Resource name. + Name *string + + // READ-ONLY; SystemData of DatabaseSqlVulnerabilityAssessmentRuleBaselineListInputResource. + SystemData *SystemData + + // READ-ONLY; Resource type. + Type *string } -// DatabaseSchemasClientListByDatabaseOptions contains the optional parameters for the DatabaseSchemasClient.NewListByDatabasePager -// method. -type DatabaseSchemasClientListByDatabaseOptions struct { - // An OData filter expression that filters elements in the collection. - Filter *string +// DatabaseSQLVulnerabilityAssessmentRuleBaselineListInputProperties - Properties of a database Sql Vulnerability Assessment +// rule baseline. +type DatabaseSQLVulnerabilityAssessmentRuleBaselineListInputProperties struct { + // REQUIRED; The latest scan flag + LatestScan *bool + + // REQUIRED; The rule baseline result list + Results map[string][][]*string } -// DatabaseSecurityAlertListResult - A list of the database's security alert policies. -type DatabaseSecurityAlertListResult struct { +// DatabaseSQLVulnerabilityAssessmentRuleBaselineListResult - A list of SQL Vulnerability Assessments rule baseline. +type DatabaseSQLVulnerabilityAssessmentRuleBaselineListResult struct { // READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` + NextLink *string // READ-ONLY; Array of results. - Value []*DatabaseSecurityAlertPolicy `json:"value,omitempty" azure:"ro"` + Value []*DatabaseSQLVulnerabilityAssessmentRuleBaseline +} + +// DatabaseSQLVulnerabilityAssessmentRuleBaselineProperties - Properties of a database Sql Vulnerability Assessment rule baseline. +type DatabaseSQLVulnerabilityAssessmentRuleBaselineProperties struct { + // REQUIRED; The rule baseline result + Results [][]*string } -// DatabaseSecurityAlertPoliciesClientCreateOrUpdateOptions contains the optional parameters for the DatabaseSecurityAlertPoliciesClient.CreateOrUpdate -// method. -type DatabaseSecurityAlertPoliciesClientCreateOrUpdateOptions struct { - // placeholder for future optional parameters +// DatabaseSchema - A database schema resource. +type DatabaseSchema struct { + // READ-ONLY; Resource ID. + ID *string + + // READ-ONLY; Resource name. + Name *string + + // READ-ONLY; Resource type. + Type *string } -// DatabaseSecurityAlertPoliciesClientGetOptions contains the optional parameters for the DatabaseSecurityAlertPoliciesClient.Get -// method. -type DatabaseSecurityAlertPoliciesClientGetOptions struct { - // placeholder for future optional parameters +// DatabaseSchemaListResult - A list of database schemas. +type DatabaseSchemaListResult struct { + // READ-ONLY; Link to retrieve next page of results. + NextLink *string + + // READ-ONLY; Array of results. + Value []*DatabaseSchema } -// DatabaseSecurityAlertPoliciesClientListByDatabaseOptions contains the optional parameters for the DatabaseSecurityAlertPoliciesClient.NewListByDatabasePager -// method. -type DatabaseSecurityAlertPoliciesClientListByDatabaseOptions struct { - // placeholder for future optional parameters +// DatabaseSecurityAlertListResult - A list of the database's security alert policies. +type DatabaseSecurityAlertListResult struct { + // READ-ONLY; Link to retrieve next page of results. + NextLink *string + + // READ-ONLY; Array of results. + Value []*DatabaseSecurityAlertPolicy } // DatabaseSecurityAlertPolicy - A database security alert policy. type DatabaseSecurityAlertPolicy struct { // Resource properties. - Properties *SecurityAlertsPolicyProperties `json:"properties,omitempty"` + Properties *SecurityAlertsPolicyProperties // READ-ONLY; Resource ID. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; Resource name. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; SystemData of SecurityAlertPolicyResource. - SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` + SystemData *SystemData // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // DatabaseTable - A database table resource. type DatabaseTable struct { // Resource properties. - Properties *DatabaseTableProperties `json:"properties,omitempty"` + Properties *DatabaseTableProperties // READ-ONLY; Resource ID. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; Resource name. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // DatabaseTableListResult - A list of database tables. type DatabaseTableListResult struct { // READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` + NextLink *string // READ-ONLY; Array of results. - Value []*DatabaseTable `json:"value,omitempty" azure:"ro"` + Value []*DatabaseTable } // DatabaseTableProperties - Database table properties. type DatabaseTableProperties struct { // Whether or not the table is memory optimized. - MemoryOptimized *bool `json:"memoryOptimized,omitempty"` + MemoryOptimized *bool // The table temporal type. - TemporalType *TableTemporalType `json:"temporalType,omitempty"` -} - -// DatabaseTablesClientGetOptions contains the optional parameters for the DatabaseTablesClient.Get method. -type DatabaseTablesClientGetOptions struct { - // placeholder for future optional parameters -} - -// DatabaseTablesClientListBySchemaOptions contains the optional parameters for the DatabaseTablesClient.NewListBySchemaPager -// method. -type DatabaseTablesClientListBySchemaOptions struct { - // An OData filter expression that filters elements in the collection. - Filter *string + TemporalType *TableTemporalType } // DatabaseUpdate - A database update resource. type DatabaseUpdate struct { // Database identity - Identity *DatabaseIdentity `json:"identity,omitempty"` + Identity *DatabaseIdentity // Resource properties. - Properties *DatabaseUpdateProperties `json:"properties,omitempty"` + Properties *DatabaseUpdateProperties // The name and tier of the SKU. - SKU *SKU `json:"sku,omitempty"` + SKU *SKU // Resource tags. - Tags map[string]*string `json:"tags,omitempty"` + Tags map[string]*string } // DatabaseUpdateProperties - A database update properties. type DatabaseUpdateProperties struct { // Time in minutes after which database is automatically paused. A value of -1 means that automatic pause is disabled - AutoPauseDelay *int32 `json:"autoPauseDelay,omitempty"` + AutoPauseDelay *int32 // Collation of the metadata catalog. - CatalogCollation *CatalogCollationType `json:"catalogCollation,omitempty"` + CatalogCollation *CatalogCollationType // The collation of the database. - Collation *string `json:"collation,omitempty"` + Collation *string // Specifies the mode of database creation. // Default: regular database creation. @@ -1348,610 +1312,447 @@ type DatabaseUpdateProperties struct { // RestoreLongTermRetentionBackup: Creates a database by restoring from a long term retention vault. recoveryServicesRecoveryPointResourceId // must be specified as the recovery point resource ID. // Copy, Secondary, and RestoreLongTermRetentionBackup are not supported for DataWarehouse edition. - CreateMode *CreateMode `json:"createMode,omitempty"` + CreateMode *CreateMode // The resource identifier of the elastic pool containing this database. - ElasticPoolID *string `json:"elasticPoolId,omitempty"` + ElasticPoolID *string + + // The azure key vault URI of the database if it's configured with per Database Customer Managed Keys. + EncryptionProtector *string // The Client id used for cross tenant per database CMK scenario - FederatedClientID *string `json:"federatedClientId,omitempty"` + FederatedClientID *string // The number of secondary replicas associated with the database that are used to provide high availability. Not applicable // to a Hyperscale database within an elastic pool. - HighAvailabilityReplicaCount *int32 `json:"highAvailabilityReplicaCount,omitempty"` + HighAvailabilityReplicaCount *int32 // Whether or not this database is a ledger database, which means all tables in the database are ledger tables. Note: the // value of this property cannot be changed after the database has been created. - IsLedgerOn *bool `json:"isLedgerOn,omitempty"` + IsLedgerOn *bool + + // The resource ids of the user assigned identities to use + Keys map[string]*DatabaseKey // The license type to apply for this database. LicenseIncluded if you need a license, or BasePrice if you have a license // and are eligible for the Azure Hybrid Benefit. - LicenseType *DatabaseLicenseType `json:"licenseType,omitempty"` + LicenseType *DatabaseLicenseType // The resource identifier of the long term retention backup associated with create operation of this database. - LongTermRetentionBackupResourceID *string `json:"longTermRetentionBackupResourceId,omitempty"` + LongTermRetentionBackupResourceID *string // Maintenance configuration id assigned to the database. This configuration defines the period when the maintenance updates // will occur. - MaintenanceConfigurationID *string `json:"maintenanceConfigurationId,omitempty"` + MaintenanceConfigurationID *string + + // Whether or not customer controlled manual cutover needs to be done during Update Database operation to Hyperscale tier. + // This property is only applicable when scaling database from Business Critical/General Purpose/Premium/Standard tier to + // Hyperscale tier. + // When manualCutover is specified, the scaling operation will wait for user input to trigger cutover to Hyperscale database. + // To trigger cutover, please provide 'performCutover' parameter when the Scaling operation is in Waiting state. + ManualCutover *bool // The max size of the database expressed in bytes. - MaxSizeBytes *int64 `json:"maxSizeBytes,omitempty"` + MaxSizeBytes *int64 // Minimal capacity that database will always have allocated, if not paused - MinCapacity *float64 `json:"minCapacity,omitempty"` + MinCapacity *float64 + + // To trigger customer controlled manual cutover during the wait state while Scaling operation is in progress. + // This property parameter is only applicable for scaling operations that are initiated along with 'manualCutover' parameter. + // This property is only applicable when scaling database from Business Critical/General Purpose/Premium/Standard tier to + // Hyperscale tier is already in progress. + // When performCutover is specified, the scaling operation will trigger cutover and perform role-change to Hyperscale database. + PerformCutover *bool + + // Type of enclave requested on the database i.e. Default or VBS enclaves. + PreferredEnclaveType *AlwaysEncryptedEnclaveType // The state of read-only routing. If enabled, connections that have application intent set to readonly in their connection // string may be routed to a readonly secondary replica in the same region. Not // applicable to a Hyperscale database within an elastic pool. - ReadScale *DatabaseReadScale `json:"readScale,omitempty"` + ReadScale *DatabaseReadScale // The resource identifier of the recoverable database associated with create operation of this database. - RecoverableDatabaseID *string `json:"recoverableDatabaseId,omitempty"` + RecoverableDatabaseID *string // The resource identifier of the recovery point associated with create operation of this database. - RecoveryServicesRecoveryPointID *string `json:"recoveryServicesRecoveryPointId,omitempty"` + RecoveryServicesRecoveryPointID *string // The storage account type to be used to store backups for this database. - RequestedBackupStorageRedundancy *BackupStorageRedundancy `json:"requestedBackupStorageRedundancy,omitempty"` + RequestedBackupStorageRedundancy *BackupStorageRedundancy // The resource identifier of the restorable dropped database associated with create operation of this database. - RestorableDroppedDatabaseID *string `json:"restorableDroppedDatabaseId,omitempty"` + RestorableDroppedDatabaseID *string // Specifies the point in time (ISO8601 format) of the source database that will be restored to create the new database. - RestorePointInTime *time.Time `json:"restorePointInTime,omitempty"` + RestorePointInTime *time.Time // The name of the sample schema to apply when creating this database. - SampleName *SampleName `json:"sampleName,omitempty"` + SampleName *SampleName - // The secondary type of the database if it is a secondary. Valid values are Geo and Named. - SecondaryType *SecondaryType `json:"secondaryType,omitempty"` + // The secondary type of the database if it is a secondary. Valid values are Geo, Named and Standby. + SecondaryType *SecondaryType // Specifies the time that the database was deleted. - SourceDatabaseDeletionDate *time.Time `json:"sourceDatabaseDeletionDate,omitempty"` + SourceDatabaseDeletionDate *time.Time // The resource identifier of the source database associated with create operation of this database. - SourceDatabaseID *string `json:"sourceDatabaseId,omitempty"` + SourceDatabaseID *string // Whether or not this database is zone redundant, which means the replicas of this database will be spread across multiple // availability zones. - ZoneRedundant *bool `json:"zoneRedundant,omitempty"` + ZoneRedundant *bool // READ-ONLY; The creation date of the database (ISO8601 format). - CreationDate *time.Time `json:"creationDate,omitempty" azure:"ro"` + CreationDate *time.Time // READ-ONLY; The storage account type used to store backups for this database. - CurrentBackupStorageRedundancy *BackupStorageRedundancy `json:"currentBackupStorageRedundancy,omitempty" azure:"ro"` + CurrentBackupStorageRedundancy *BackupStorageRedundancy // READ-ONLY; The name and tier of the SKU. - CurrentSKU *SKU `json:"currentSku,omitempty" azure:"ro"` + CurrentSKU *SKU // READ-ONLY; The current service level objective name of the database. - CurrentServiceObjectiveName *string `json:"currentServiceObjectiveName,omitempty" azure:"ro"` + CurrentServiceObjectiveName *string // READ-ONLY; The ID of the database. - DatabaseID *string `json:"databaseId,omitempty" azure:"ro"` + DatabaseID *string // READ-ONLY; The default secondary region for this database. - DefaultSecondaryLocation *string `json:"defaultSecondaryLocation,omitempty" azure:"ro"` + DefaultSecondaryLocation *string // READ-ONLY; This records the earliest start date and time that restore is available for this database (ISO8601 format). - EarliestRestoreDate *time.Time `json:"earliestRestoreDate,omitempty" azure:"ro"` + EarliestRestoreDate *time.Time // READ-ONLY; Failover Group resource identifier that this database belongs to. - FailoverGroupID *string `json:"failoverGroupId,omitempty" azure:"ro"` + FailoverGroupID *string // READ-ONLY; Infra encryption is enabled for this database. - IsInfraEncryptionEnabled *bool `json:"isInfraEncryptionEnabled,omitempty" azure:"ro"` + IsInfraEncryptionEnabled *bool // READ-ONLY; The max log size for this database. - MaxLogSizeBytes *int64 `json:"maxLogSizeBytes,omitempty" azure:"ro"` + MaxLogSizeBytes *int64 // READ-ONLY; The date when database was paused by user configuration or action(ISO8601 format). Null if the database is ready. - PausedDate *time.Time `json:"pausedDate,omitempty" azure:"ro"` + PausedDate *time.Time // READ-ONLY; The requested service level objective name of the database. - RequestedServiceObjectiveName *string `json:"requestedServiceObjectiveName,omitempty" azure:"ro"` + RequestedServiceObjectiveName *string // READ-ONLY; The date when database was resumed by user action or database login (ISO8601 format). Null if the database is // paused. - ResumedDate *time.Time `json:"resumedDate,omitempty" azure:"ro"` + ResumedDate *time.Time // READ-ONLY; The status of the database. - Status *DatabaseStatus `json:"status,omitempty" azure:"ro"` + Status *DatabaseStatus } // DatabaseUsage - Usage metric of a database. type DatabaseUsage struct { // Resource properties. - Properties *DatabaseUsageProperties `json:"properties,omitempty"` + Properties *DatabaseUsageProperties // READ-ONLY; Resource ID. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; Resource name. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // DatabaseUsageListResult - A list of database usage metrics. type DatabaseUsageListResult struct { // READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` + NextLink *string // READ-ONLY; Array of results. - Value []*DatabaseUsage `json:"value,omitempty" azure:"ro"` + Value []*DatabaseUsage } // DatabaseUsageProperties - Properties of a database usage. type DatabaseUsageProperties struct { // READ-ONLY; Current value of the metric. - CurrentValue *float64 `json:"currentValue,omitempty" azure:"ro"` + CurrentValue *float64 // READ-ONLY; User-readable name of the metric. - DisplayName *string `json:"displayName,omitempty" azure:"ro"` + DisplayName *string // READ-ONLY; Boundary value of the metric. - Limit *float64 `json:"limit,omitempty" azure:"ro"` + Limit *float64 // READ-ONLY; Unit of the metric. - Unit *string `json:"unit,omitempty" azure:"ro"` -} - -// DatabaseUsagesClientListByDatabaseOptions contains the optional parameters for the DatabaseUsagesClient.NewListByDatabasePager -// method. -type DatabaseUsagesClientListByDatabaseOptions struct { - // placeholder for future optional parameters + Unit *string } // DatabaseUserIdentity - Azure Active Directory identity configuration for a resource. type DatabaseUserIdentity struct { // READ-ONLY; The Azure Active Directory client id. - ClientID *string `json:"clientId,omitempty" azure:"ro"` + ClientID *string // READ-ONLY; The Azure Active Directory principal id. - PrincipalID *string `json:"principalId,omitempty" azure:"ro"` + PrincipalID *string } // DatabaseVulnerabilityAssessment - A database vulnerability assessment. type DatabaseVulnerabilityAssessment struct { // Resource properties. - Properties *DatabaseVulnerabilityAssessmentProperties `json:"properties,omitempty"` + Properties *DatabaseVulnerabilityAssessmentProperties // READ-ONLY; Resource ID. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; Resource name. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // DatabaseVulnerabilityAssessmentListResult - A list of the database's vulnerability assessments. type DatabaseVulnerabilityAssessmentListResult struct { // READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` + NextLink *string // READ-ONLY; Array of results. - Value []*DatabaseVulnerabilityAssessment `json:"value,omitempty" azure:"ro"` + Value []*DatabaseVulnerabilityAssessment } // DatabaseVulnerabilityAssessmentProperties - Properties of a database Vulnerability Assessment. type DatabaseVulnerabilityAssessmentProperties struct { // The recurring scans settings - RecurringScans *VulnerabilityAssessmentRecurringScansProperties `json:"recurringScans,omitempty"` + RecurringScans *VulnerabilityAssessmentRecurringScansProperties // Specifies the identifier key of the storage account for vulnerability assessment scan results. If 'StorageContainerSasKey' - // isn't specified, storageAccountAccessKey is required. - StorageAccountAccessKey *string `json:"storageAccountAccessKey,omitempty"` + // isn't specified, storageAccountAccessKey is required. Applies only if the + // storage account is not behind a Vnet or a firewall + StorageAccountAccessKey *string // A blob storage container path to hold the scan results (e.g. https://myStorage.blob.core.windows.net/VaScans/). It is required // if server level vulnerability assessment policy doesn't set - StorageContainerPath *string `json:"storageContainerPath,omitempty"` + StorageContainerPath *string // A shared access signature (SAS Key) that has write access to the blob container specified in 'storageContainerPath' parameter. // If 'storageAccountAccessKey' isn't specified, StorageContainerSasKey is - // required. - StorageContainerSasKey *string `json:"storageContainerSasKey,omitempty"` + // required. Applies only if the storage account is not behind a Vnet or a firewall + StorageContainerSasKey *string } // DatabaseVulnerabilityAssessmentRuleBaseline - A database vulnerability assessment rule baseline. type DatabaseVulnerabilityAssessmentRuleBaseline struct { // Resource properties. - Properties *DatabaseVulnerabilityAssessmentRuleBaselineProperties `json:"properties,omitempty"` + Properties *DatabaseVulnerabilityAssessmentRuleBaselineProperties + + // READ-ONLY; Resource ID. + ID *string + + // READ-ONLY; Resource name. + Name *string + + // READ-ONLY; Resource type. + Type *string +} + +// DatabaseVulnerabilityAssessmentRuleBaselineAutoGenerated - A database vulnerability assessment rule baseline. +type DatabaseVulnerabilityAssessmentRuleBaselineAutoGenerated struct { + // Resource properties. + Properties *DatabaseVulnerabilityAssessmentRuleBaselinePropertiesAutoGenerated // READ-ONLY; Resource ID. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; Resource name. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // DatabaseVulnerabilityAssessmentRuleBaselineItem - Properties for an Azure SQL Database Vulnerability Assessment rule baseline's // result. type DatabaseVulnerabilityAssessmentRuleBaselineItem struct { // REQUIRED; The rule baseline result - Result []*string `json:"result,omitempty"` + Result []*string } // DatabaseVulnerabilityAssessmentRuleBaselineProperties - Properties of a database Vulnerability Assessment rule baseline. type DatabaseVulnerabilityAssessmentRuleBaselineProperties struct { // REQUIRED; The rule baseline result - BaselineResults []*DatabaseVulnerabilityAssessmentRuleBaselineItem `json:"baselineResults,omitempty"` -} - -// DatabaseVulnerabilityAssessmentRuleBaselinesClientCreateOrUpdateOptions contains the optional parameters for the DatabaseVulnerabilityAssessmentRuleBaselinesClient.CreateOrUpdate -// method. -type DatabaseVulnerabilityAssessmentRuleBaselinesClientCreateOrUpdateOptions struct { - // placeholder for future optional parameters + BaselineResults []*DatabaseVulnerabilityAssessmentRuleBaselineItem } -// DatabaseVulnerabilityAssessmentRuleBaselinesClientDeleteOptions contains the optional parameters for the DatabaseVulnerabilityAssessmentRuleBaselinesClient.Delete -// method. -type DatabaseVulnerabilityAssessmentRuleBaselinesClientDeleteOptions struct { - // placeholder for future optional parameters -} - -// DatabaseVulnerabilityAssessmentRuleBaselinesClientGetOptions contains the optional parameters for the DatabaseVulnerabilityAssessmentRuleBaselinesClient.Get -// method. -type DatabaseVulnerabilityAssessmentRuleBaselinesClientGetOptions struct { - // placeholder for future optional parameters +// DatabaseVulnerabilityAssessmentRuleBaselinePropertiesAutoGenerated - Properties of a database Vulnerability Assessment +// rule baseline. +type DatabaseVulnerabilityAssessmentRuleBaselinePropertiesAutoGenerated struct { + // REQUIRED; The rule baseline result + BaselineResults []*DatabaseVulnerabilityAssessmentRuleBaselineItem } // DatabaseVulnerabilityAssessmentScanExportProperties - Properties of the export operation's result. type DatabaseVulnerabilityAssessmentScanExportProperties struct { // READ-ONLY; Location of the exported report (e.g. https://myStorage.blob.core.windows.net/VaScans/scans/serverName/databaseName/scan_scanId.xlsx). - ExportedReportLocation *string `json:"exportedReportLocation,omitempty" azure:"ro"` -} - -// DatabaseVulnerabilityAssessmentScansClientBeginInitiateScanOptions contains the optional parameters for the DatabaseVulnerabilityAssessmentScansClient.BeginInitiateScan -// method. -type DatabaseVulnerabilityAssessmentScansClientBeginInitiateScanOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// DatabaseVulnerabilityAssessmentScansClientExportOptions contains the optional parameters for the DatabaseVulnerabilityAssessmentScansClient.Export -// method. -type DatabaseVulnerabilityAssessmentScansClientExportOptions struct { - // placeholder for future optional parameters -} - -// DatabaseVulnerabilityAssessmentScansClientGetOptions contains the optional parameters for the DatabaseVulnerabilityAssessmentScansClient.Get -// method. -type DatabaseVulnerabilityAssessmentScansClientGetOptions struct { - // placeholder for future optional parameters -} - -// DatabaseVulnerabilityAssessmentScansClientListByDatabaseOptions contains the optional parameters for the DatabaseVulnerabilityAssessmentScansClient.NewListByDatabasePager -// method. -type DatabaseVulnerabilityAssessmentScansClientListByDatabaseOptions struct { - // placeholder for future optional parameters + ExportedReportLocation *string } // DatabaseVulnerabilityAssessmentScansExport - A database Vulnerability Assessment scan export resource. type DatabaseVulnerabilityAssessmentScansExport struct { // Resource properties. - Properties *DatabaseVulnerabilityAssessmentScanExportProperties `json:"properties,omitempty"` + Properties *DatabaseVulnerabilityAssessmentScanExportProperties // READ-ONLY; Resource ID. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; Resource name. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` -} - -// DatabaseVulnerabilityAssessmentsClientCreateOrUpdateOptions contains the optional parameters for the DatabaseVulnerabilityAssessmentsClient.CreateOrUpdate -// method. -type DatabaseVulnerabilityAssessmentsClientCreateOrUpdateOptions struct { - // placeholder for future optional parameters -} - -// DatabaseVulnerabilityAssessmentsClientDeleteOptions contains the optional parameters for the DatabaseVulnerabilityAssessmentsClient.Delete -// method. -type DatabaseVulnerabilityAssessmentsClientDeleteOptions struct { - // placeholder for future optional parameters -} - -// DatabaseVulnerabilityAssessmentsClientGetOptions contains the optional parameters for the DatabaseVulnerabilityAssessmentsClient.Get -// method. -type DatabaseVulnerabilityAssessmentsClientGetOptions struct { - // placeholder for future optional parameters -} - -// DatabaseVulnerabilityAssessmentsClientListByDatabaseOptions contains the optional parameters for the DatabaseVulnerabilityAssessmentsClient.NewListByDatabasePager -// method. -type DatabaseVulnerabilityAssessmentsClientListByDatabaseOptions struct { - // placeholder for future optional parameters -} - -// DatabasesClientBeginCreateOrUpdateOptions contains the optional parameters for the DatabasesClient.BeginCreateOrUpdate -// method. -type DatabasesClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// DatabasesClientBeginDeleteOptions contains the optional parameters for the DatabasesClient.BeginDelete method. -type DatabasesClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// DatabasesClientBeginExportOptions contains the optional parameters for the DatabasesClient.BeginExport method. -type DatabasesClientBeginExportOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// DatabasesClientBeginFailoverOptions contains the optional parameters for the DatabasesClient.BeginFailover method. -type DatabasesClientBeginFailoverOptions struct { - // The type of replica to be failed over. - ReplicaType *ReplicaType - // Resumes the LRO from the provided token. - ResumeToken string -} - -// DatabasesClientBeginImportOptions contains the optional parameters for the DatabasesClient.BeginImport method. -type DatabasesClientBeginImportOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// DatabasesClientBeginPauseOptions contains the optional parameters for the DatabasesClient.BeginPause method. -type DatabasesClientBeginPauseOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// DatabasesClientBeginResumeOptions contains the optional parameters for the DatabasesClient.BeginResume method. -type DatabasesClientBeginResumeOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// DatabasesClientBeginUpdateOptions contains the optional parameters for the DatabasesClient.BeginUpdate method. -type DatabasesClientBeginUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// DatabasesClientBeginUpgradeDataWarehouseOptions contains the optional parameters for the DatabasesClient.BeginUpgradeDataWarehouse -// method. -type DatabasesClientBeginUpgradeDataWarehouseOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// DatabasesClientGetOptions contains the optional parameters for the DatabasesClient.Get method. -type DatabasesClientGetOptions struct { - // placeholder for future optional parameters -} - -// DatabasesClientListByElasticPoolOptions contains the optional parameters for the DatabasesClient.NewListByElasticPoolPager -// method. -type DatabasesClientListByElasticPoolOptions struct { - // placeholder for future optional parameters -} - -// DatabasesClientListByServerOptions contains the optional parameters for the DatabasesClient.NewListByServerPager method. -type DatabasesClientListByServerOptions struct { - SkipToken *string -} - -// DatabasesClientListInaccessibleByServerOptions contains the optional parameters for the DatabasesClient.NewListInaccessibleByServerPager -// method. -type DatabasesClientListInaccessibleByServerOptions struct { - // placeholder for future optional parameters -} - -// DatabasesClientListMetricDefinitionsOptions contains the optional parameters for the DatabasesClient.NewListMetricDefinitionsPager -// method. -type DatabasesClientListMetricDefinitionsOptions struct { - // placeholder for future optional parameters -} - -// DatabasesClientListMetricsOptions contains the optional parameters for the DatabasesClient.NewListMetricsPager method. -type DatabasesClientListMetricsOptions struct { - // placeholder for future optional parameters -} - -// DatabasesClientRenameOptions contains the optional parameters for the DatabasesClient.Rename method. -type DatabasesClientRenameOptions struct { - // placeholder for future optional parameters + Type *string } // DeletedServer - A deleted server. type DeletedServer struct { // Resource properties. - Properties *DeletedServerProperties `json:"properties,omitempty"` + Properties *DeletedServerProperties // READ-ONLY; Resource ID. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; Resource name. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // DeletedServerListResult - A list of deleted servers. type DeletedServerListResult struct { // READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` + NextLink *string // READ-ONLY; Array of results. - Value []*DeletedServer `json:"value,omitempty" azure:"ro"` + Value []*DeletedServer } // DeletedServerProperties - The properties of a deleted server. type DeletedServerProperties struct { // READ-ONLY; The deletion time of the deleted server. - DeletionTime *time.Time `json:"deletionTime,omitempty" azure:"ro"` + DeletionTime *time.Time // READ-ONLY; The fully qualified domain name of the server. - FullyQualifiedDomainName *string `json:"fullyQualifiedDomainName,omitempty" azure:"ro"` + FullyQualifiedDomainName *string // READ-ONLY; The original ID of the server before deletion. - OriginalID *string `json:"originalId,omitempty" azure:"ro"` + OriginalID *string // READ-ONLY; The version of the deleted server. - Version *string `json:"version,omitempty" azure:"ro"` -} - -// DeletedServersClientBeginRecoverOptions contains the optional parameters for the DeletedServersClient.BeginRecover method. -type DeletedServersClientBeginRecoverOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// DeletedServersClientGetOptions contains the optional parameters for the DeletedServersClient.Get method. -type DeletedServersClientGetOptions struct { - // placeholder for future optional parameters -} - -// DeletedServersClientListByLocationOptions contains the optional parameters for the DeletedServersClient.NewListByLocationPager -// method. -type DeletedServersClientListByLocationOptions struct { - // placeholder for future optional parameters -} - -// DeletedServersClientListOptions contains the optional parameters for the DeletedServersClient.NewListPager method. -type DeletedServersClientListOptions struct { - // placeholder for future optional parameters + Version *string } // DistributedAvailabilityGroup - Distributed availability group between box and Sql Managed Instance. type DistributedAvailabilityGroup struct { // Resource properties. - Properties *DistributedAvailabilityGroupProperties `json:"properties,omitempty"` + Properties *DistributedAvailabilityGroupProperties // READ-ONLY; Resource ID. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; Resource name. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // DistributedAvailabilityGroupProperties - The properties of a distributed availability group. type DistributedAvailabilityGroupProperties struct { // The primary availability group name - PrimaryAvailabilityGroupName *string `json:"primaryAvailabilityGroupName,omitempty"` + PrimaryAvailabilityGroupName *string // The replication mode of a distributed availability group. Parameter will be ignored during link creation. - ReplicationMode *ReplicationMode `json:"replicationMode,omitempty"` + ReplicationMode *ReplicationMode // The secondary availability group name - SecondaryAvailabilityGroupName *string `json:"secondaryAvailabilityGroupName,omitempty"` + SecondaryAvailabilityGroupName *string // The source endpoint - SourceEndpoint *string `json:"sourceEndpoint,omitempty"` + SourceEndpoint *string // The name of the target database - TargetDatabase *string `json:"targetDatabase,omitempty"` + TargetDatabase *string // READ-ONLY; The distributed availability group id - DistributedAvailabilityGroupID *string `json:"distributedAvailabilityGroupId,omitempty" azure:"ro"` + DistributedAvailabilityGroupID *string + + // READ-ONLY; Role of managed instance + InstanceRole *string // READ-ONLY; The last hardened lsn - LastHardenedLsn *string `json:"lastHardenedLsn,omitempty" azure:"ro"` + LastHardenedLsn *string // READ-ONLY; The link state - LinkState *string `json:"linkState,omitempty" azure:"ro"` + LinkState *string // READ-ONLY; The source replica id - SourceReplicaID *string `json:"sourceReplicaId,omitempty" azure:"ro"` + SourceReplicaID *string // READ-ONLY; The target replica id - TargetReplicaID *string `json:"targetReplicaId,omitempty" azure:"ro"` + TargetReplicaID *string } -// DistributedAvailabilityGroupsClientBeginCreateOrUpdateOptions contains the optional parameters for the DistributedAvailabilityGroupsClient.BeginCreateOrUpdate -// method. -type DistributedAvailabilityGroupsClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// DistributedAvailabilityGroupsClientBeginDeleteOptions contains the optional parameters for the DistributedAvailabilityGroupsClient.BeginDelete -// method. -type DistributedAvailabilityGroupsClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// DistributedAvailabilityGroupsClientBeginUpdateOptions contains the optional parameters for the DistributedAvailabilityGroupsClient.BeginUpdate -// method. -type DistributedAvailabilityGroupsClientBeginUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// DistributedAvailabilityGroupsClientGetOptions contains the optional parameters for the DistributedAvailabilityGroupsClient.Get -// method. -type DistributedAvailabilityGroupsClientGetOptions struct { - // placeholder for future optional parameters -} +// DistributedAvailabilityGroupSetRole - Distributed availability group failover request. +type DistributedAvailabilityGroupSetRole struct { + // REQUIRED; New role of managed instance in a distributed availability group, can be Primary or Secondary. + InstanceRole *InstanceRole -// DistributedAvailabilityGroupsClientListByInstanceOptions contains the optional parameters for the DistributedAvailabilityGroupsClient.NewListByInstancePager -// method. -type DistributedAvailabilityGroupsClientListByInstanceOptions struct { - // placeholder for future optional parameters + // REQUIRED; The type of the role change, can be Planned or Forced. + RoleChangeType *RoleChangeType } // DistributedAvailabilityGroupsListResult - A list of distributed availability groups in instance. type DistributedAvailabilityGroupsListResult struct { // READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` + NextLink *string // READ-ONLY; Array of results. - Value []*DistributedAvailabilityGroup `json:"value,omitempty" azure:"ro"` + Value []*DistributedAvailabilityGroup } // EditionCapability - The edition capability. type EditionCapability struct { // The reason for the capability not being available. - Reason *string `json:"reason,omitempty"` + Reason *string // READ-ONLY; The database edition name. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; The read scale capability for the edition. - ReadScale *ReadScaleCapability `json:"readScale,omitempty" azure:"ro"` + ReadScale *ReadScaleCapability // READ-ONLY; The status of the capability. - Status *CapabilityStatus `json:"status,omitempty" azure:"ro"` + Status *CapabilityStatus // READ-ONLY; The list of supported service objectives for the edition. - SupportedServiceLevelObjectives []*ServiceObjectiveCapability `json:"supportedServiceLevelObjectives,omitempty" azure:"ro"` + SupportedServiceLevelObjectives []*ServiceObjectiveCapability // READ-ONLY; The list of supported storage capabilities for this edition - SupportedStorageCapabilities []*StorageCapability `json:"supportedStorageCapabilities,omitempty" azure:"ro"` + SupportedStorageCapabilities []*StorageCapability + + // READ-ONLY; Whether or not zone pinning is supported for the edition. + ZonePinning *bool // READ-ONLY; Whether or not zone redundancy is supported for the edition. - ZoneRedundant *bool `json:"zoneRedundant,omitempty" azure:"ro"` + ZoneRedundant *bool } // ElasticPool - An elastic pool. type ElasticPool struct { // REQUIRED; Resource location. - Location *string `json:"location,omitempty"` + Location *string // Resource properties. - Properties *ElasticPoolProperties `json:"properties,omitempty"` + Properties *ElasticPoolProperties // The elastic pool SKU. // The list of SKUs may vary by region and support offer. To determine the SKUs (including the SKU name, tier/edition, family, @@ -1959,683 +1760,436 @@ type ElasticPool struct { // use the Capabilities_ListByLocation REST API or the following command: // az sql elastic-pool list-editions -l -o table // ` - SKU *SKU `json:"sku,omitempty"` + SKU *SKU // Resource tags. - Tags map[string]*string `json:"tags,omitempty"` + Tags map[string]*string // READ-ONLY; Resource ID. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; Kind of elastic pool. This is metadata used for the Azure portal experience. - Kind *string `json:"kind,omitempty" azure:"ro"` + Kind *string // READ-ONLY; Resource name. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` -} - -// ElasticPoolActivitiesClientListByElasticPoolOptions contains the optional parameters for the ElasticPoolActivitiesClient.NewListByElasticPoolPager -// method. -type ElasticPoolActivitiesClientListByElasticPoolOptions struct { - // placeholder for future optional parameters -} - -// ElasticPoolActivity - Represents the activity on an elastic pool. -type ElasticPoolActivity struct { - // The geo-location where the resource lives - Location *string `json:"location,omitempty"` - - // The properties representing the resource. - Properties *ElasticPoolActivityProperties `json:"properties,omitempty"` - - // READ-ONLY; Resource ID. - ID *string `json:"id,omitempty" azure:"ro"` - - // READ-ONLY; Resource name. - Name *string `json:"name,omitempty" azure:"ro"` - - // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` -} - -// ElasticPoolActivityListResult - Represents the response to a list elastic pool activity request. -type ElasticPoolActivityListResult struct { - // REQUIRED; The list of elastic pool activities. - Value []*ElasticPoolActivity `json:"value,omitempty"` -} - -// ElasticPoolActivityProperties - Represents the properties of an elastic pool. -type ElasticPoolActivityProperties struct { - // READ-ONLY; The name of the elastic pool. - ElasticPoolName *string `json:"elasticPoolName,omitempty" azure:"ro"` - - // READ-ONLY; The time the operation finished (ISO8601 format). - EndTime *time.Time `json:"endTime,omitempty" azure:"ro"` - - // READ-ONLY; The error code if available. - ErrorCode *int32 `json:"errorCode,omitempty" azure:"ro"` - - // READ-ONLY; The error message if available. - ErrorMessage *string `json:"errorMessage,omitempty" azure:"ro"` - - // READ-ONLY; The error severity if available. - ErrorSeverity *int32 `json:"errorSeverity,omitempty" azure:"ro"` - - // READ-ONLY; The operation name. - Operation *string `json:"operation,omitempty" azure:"ro"` - - // READ-ONLY; The unique operation ID. - OperationID *string `json:"operationId,omitempty" azure:"ro"` - - // READ-ONLY; The percentage complete if available. - PercentComplete *int32 `json:"percentComplete,omitempty" azure:"ro"` - - // READ-ONLY; The requested per database DTU cap. - RequestedDatabaseDtuCap *int32 `json:"requestedDatabaseDtuCap,omitempty" azure:"ro"` - - // READ-ONLY; The requested per database DTU guarantee. - RequestedDatabaseDtuGuarantee *int32 `json:"requestedDatabaseDtuGuarantee,omitempty" azure:"ro"` - - // READ-ONLY; The requested max DTU per database if available. - RequestedDatabaseDtuMax *int32 `json:"requestedDatabaseDtuMax,omitempty" azure:"ro"` - - // READ-ONLY; The requested min DTU per database if available. - RequestedDatabaseDtuMin *int32 `json:"requestedDatabaseDtuMin,omitempty" azure:"ro"` - - // READ-ONLY; The requested DTU for the pool if available. - RequestedDtu *int32 `json:"requestedDtu,omitempty" azure:"ro"` - - // READ-ONLY; The requested DTU guarantee. - RequestedDtuGuarantee *int32 `json:"requestedDtuGuarantee,omitempty" azure:"ro"` - - // READ-ONLY; The requested name for the elastic pool if available. - RequestedElasticPoolName *string `json:"requestedElasticPoolName,omitempty" azure:"ro"` - - // READ-ONLY; The requested storage limit for the pool in GB if available. - RequestedStorageLimitInGB *int64 `json:"requestedStorageLimitInGB,omitempty" azure:"ro"` - - // READ-ONLY; The requested storage limit in MB. - RequestedStorageLimitInMB *int32 `json:"requestedStorageLimitInMB,omitempty" azure:"ro"` - - // READ-ONLY; The name of the server the elastic pool is in. - ServerName *string `json:"serverName,omitempty" azure:"ro"` - - // READ-ONLY; The time the operation started (ISO8601 format). - StartTime *time.Time `json:"startTime,omitempty" azure:"ro"` - - // READ-ONLY; The current state of the operation. - State *string `json:"state,omitempty" azure:"ro"` -} - -// ElasticPoolDatabaseActivitiesClientListByElasticPoolOptions contains the optional parameters for the ElasticPoolDatabaseActivitiesClient.NewListByElasticPoolPager -// method. -type ElasticPoolDatabaseActivitiesClientListByElasticPoolOptions struct { - // placeholder for future optional parameters -} - -// ElasticPoolDatabaseActivity - Represents the activity on an elastic pool. -type ElasticPoolDatabaseActivity struct { - // The geo-location where the resource lives - Location *string `json:"location,omitempty"` - - // The properties representing the resource. - Properties *ElasticPoolDatabaseActivityProperties `json:"properties,omitempty"` - - // READ-ONLY; Resource ID. - ID *string `json:"id,omitempty" azure:"ro"` - - // READ-ONLY; Resource name. - Name *string `json:"name,omitempty" azure:"ro"` - - // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` -} - -// ElasticPoolDatabaseActivityListResult - Represents the response to a list elastic pool database activity request. -type ElasticPoolDatabaseActivityListResult struct { - // REQUIRED; The list of elastic pool database activities. - Value []*ElasticPoolDatabaseActivity `json:"value,omitempty"` -} - -// ElasticPoolDatabaseActivityProperties - Represents the properties of an elastic pool database activity. -type ElasticPoolDatabaseActivityProperties struct { - // READ-ONLY; The name of the current elastic pool the database is in if available. - CurrentElasticPoolName *string `json:"currentElasticPoolName,omitempty" azure:"ro"` - - // READ-ONLY; The name of the current service objective if available. - CurrentServiceObjective *string `json:"currentServiceObjective,omitempty" azure:"ro"` - - // READ-ONLY; The database name. - DatabaseName *string `json:"databaseName,omitempty" azure:"ro"` - - // READ-ONLY; The time the operation finished (ISO8601 format). - EndTime *time.Time `json:"endTime,omitempty" azure:"ro"` - - // READ-ONLY; The error code if available. - ErrorCode *int32 `json:"errorCode,omitempty" azure:"ro"` - - // READ-ONLY; The error message if available. - ErrorMessage *string `json:"errorMessage,omitempty" azure:"ro"` - - // READ-ONLY; The error severity if available. - ErrorSeverity *int32 `json:"errorSeverity,omitempty" azure:"ro"` - - // READ-ONLY; The operation name. - Operation *string `json:"operation,omitempty" azure:"ro"` - - // READ-ONLY; The unique operation ID. - OperationID *string `json:"operationId,omitempty" azure:"ro"` - - // READ-ONLY; The percentage complete if available. - PercentComplete *int32 `json:"percentComplete,omitempty" azure:"ro"` - - // READ-ONLY; The name for the elastic pool the database is moving into if available. - RequestedElasticPoolName *string `json:"requestedElasticPoolName,omitempty" azure:"ro"` - - // READ-ONLY; The name of the requested service objective if available. - RequestedServiceObjective *string `json:"requestedServiceObjective,omitempty" azure:"ro"` - - // READ-ONLY; The name of the server the elastic pool is in. - ServerName *string `json:"serverName,omitempty" azure:"ro"` - - // READ-ONLY; The time the operation started (ISO8601 format). - StartTime *time.Time `json:"startTime,omitempty" azure:"ro"` - - // READ-ONLY; The current state of the operation. - State *string `json:"state,omitempty" azure:"ro"` + Type *string } // ElasticPoolEditionCapability - The elastic pool edition capability. type ElasticPoolEditionCapability struct { // The reason for the capability not being available. - Reason *string `json:"reason,omitempty"` + Reason *string // READ-ONLY; The elastic pool edition name. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; The status of the capability. - Status *CapabilityStatus `json:"status,omitempty" azure:"ro"` + Status *CapabilityStatus // READ-ONLY; The list of supported elastic pool DTU levels for the edition. - SupportedElasticPoolPerformanceLevels []*ElasticPoolPerformanceLevelCapability `json:"supportedElasticPoolPerformanceLevels,omitempty" azure:"ro"` + SupportedElasticPoolPerformanceLevels []*ElasticPoolPerformanceLevelCapability + + // READ-ONLY; Whether or not zone pinning is supported for the edition. + ZonePinning *bool // READ-ONLY; Whether or not zone redundancy is supported for the edition. - ZoneRedundant *bool `json:"zoneRedundant,omitempty" azure:"ro"` + ZoneRedundant *bool } // ElasticPoolListResult - The result of an elastic pool list request. type ElasticPoolListResult struct { // READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` + NextLink *string // READ-ONLY; Array of results. - Value []*ElasticPool `json:"value,omitempty" azure:"ro"` + Value []*ElasticPool } // ElasticPoolOperation - A elastic pool operation. type ElasticPoolOperation struct { // Resource properties. - Properties *ElasticPoolOperationProperties `json:"properties,omitempty"` + Properties *ElasticPoolOperationProperties // READ-ONLY; Resource ID. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; Resource name. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // ElasticPoolOperationListResult - The response to a list elastic pool operations request type ElasticPoolOperationListResult struct { // READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` + NextLink *string // READ-ONLY; Array of results. - Value []*ElasticPoolOperation `json:"value,omitempty" azure:"ro"` + Value []*ElasticPoolOperation } // ElasticPoolOperationProperties - The properties of a elastic pool operation. type ElasticPoolOperationProperties struct { // READ-ONLY; The operation description. - Description *string `json:"description,omitempty" azure:"ro"` + Description *string // READ-ONLY; The name of the elastic pool the operation is being performed on. - ElasticPoolName *string `json:"elasticPoolName,omitempty" azure:"ro"` + ElasticPoolName *string // READ-ONLY; The operation error code. - ErrorCode *int32 `json:"errorCode,omitempty" azure:"ro"` + ErrorCode *int32 // READ-ONLY; The operation error description. - ErrorDescription *string `json:"errorDescription,omitempty" azure:"ro"` + ErrorDescription *string // READ-ONLY; The operation error severity. - ErrorSeverity *int32 `json:"errorSeverity,omitempty" azure:"ro"` + ErrorSeverity *int32 // READ-ONLY; The estimated completion time of the operation. - EstimatedCompletionTime *time.Time `json:"estimatedCompletionTime,omitempty" azure:"ro"` + EstimatedCompletionTime *time.Time // READ-ONLY; Whether the operation can be cancelled. - IsCancellable *bool `json:"isCancellable,omitempty" azure:"ro"` + IsCancellable *bool // READ-ONLY; Whether or not the error is a user error. - IsUserError *bool `json:"isUserError,omitempty" azure:"ro"` + IsUserError *bool // READ-ONLY; The name of operation. - Operation *string `json:"operation,omitempty" azure:"ro"` + Operation *string // READ-ONLY; The friendly name of operation. - OperationFriendlyName *string `json:"operationFriendlyName,omitempty" azure:"ro"` + OperationFriendlyName *string // READ-ONLY; The percentage of the operation completed. - PercentComplete *int32 `json:"percentComplete,omitempty" azure:"ro"` + PercentComplete *int32 // READ-ONLY; The name of the server. - ServerName *string `json:"serverName,omitempty" azure:"ro"` + ServerName *string // READ-ONLY; The operation start time. - StartTime *time.Time `json:"startTime,omitempty" azure:"ro"` + StartTime *time.Time // READ-ONLY; The operation state. - State *string `json:"state,omitempty" azure:"ro"` -} - -// ElasticPoolOperationsClientCancelOptions contains the optional parameters for the ElasticPoolOperationsClient.Cancel method. -type ElasticPoolOperationsClientCancelOptions struct { - // placeholder for future optional parameters -} - -// ElasticPoolOperationsClientListByElasticPoolOptions contains the optional parameters for the ElasticPoolOperationsClient.NewListByElasticPoolPager -// method. -type ElasticPoolOperationsClientListByElasticPoolOptions struct { - // placeholder for future optional parameters + State *string } // ElasticPoolPerDatabaseMaxPerformanceLevelCapability - The max per-database performance level capability. type ElasticPoolPerDatabaseMaxPerformanceLevelCapability struct { // The reason for the capability not being available. - Reason *string `json:"reason,omitempty"` + Reason *string // READ-ONLY; The maximum performance level per database. - Limit *float64 `json:"limit,omitempty" azure:"ro"` + Limit *float64 // READ-ONLY; The status of the capability. - Status *CapabilityStatus `json:"status,omitempty" azure:"ro"` + Status *CapabilityStatus // READ-ONLY; The list of supported min database performance levels. - SupportedPerDatabaseMinPerformanceLevels []*ElasticPoolPerDatabaseMinPerformanceLevelCapability `json:"supportedPerDatabaseMinPerformanceLevels,omitempty" azure:"ro"` + SupportedPerDatabaseMinPerformanceLevels []*ElasticPoolPerDatabaseMinPerformanceLevelCapability // READ-ONLY; Unit type used to measure performance level. - Unit *PerformanceLevelUnit `json:"unit,omitempty" azure:"ro"` + Unit *PerformanceLevelUnit } // ElasticPoolPerDatabaseMinPerformanceLevelCapability - The minimum per-database performance level capability. type ElasticPoolPerDatabaseMinPerformanceLevelCapability struct { // The reason for the capability not being available. - Reason *string `json:"reason,omitempty"` + Reason *string // READ-ONLY; The minimum performance level per database. - Limit *float64 `json:"limit,omitempty" azure:"ro"` + Limit *float64 // READ-ONLY; The status of the capability. - Status *CapabilityStatus `json:"status,omitempty" azure:"ro"` + Status *CapabilityStatus // READ-ONLY; Unit type used to measure performance level. - Unit *PerformanceLevelUnit `json:"unit,omitempty" azure:"ro"` + Unit *PerformanceLevelUnit } // ElasticPoolPerDatabaseSettings - Per database settings of an elastic pool. type ElasticPoolPerDatabaseSettings struct { // The maximum capacity any one database can consume. - MaxCapacity *float64 `json:"maxCapacity,omitempty"` + MaxCapacity *float64 // The minimum capacity all databases are guaranteed. - MinCapacity *float64 `json:"minCapacity,omitempty"` + MinCapacity *float64 } // ElasticPoolPerformanceLevelCapability - The Elastic Pool performance level capability. type ElasticPoolPerformanceLevelCapability struct { // The reason for the capability not being available. - Reason *string `json:"reason,omitempty"` + Reason *string // READ-ONLY; The included (free) max size for this performance level. - IncludedMaxSize *MaxSizeCapability `json:"includedMaxSize,omitempty" azure:"ro"` + IncludedMaxSize *MaxSizeCapability // READ-ONLY; The maximum number of databases supported. - MaxDatabaseCount *int32 `json:"maxDatabaseCount,omitempty" azure:"ro"` + MaxDatabaseCount *int32 // READ-ONLY; The performance level for the pool. - PerformanceLevel *PerformanceLevelCapability `json:"performanceLevel,omitempty" azure:"ro"` + PerformanceLevel *PerformanceLevelCapability // READ-ONLY; The sku. - SKU *SKU `json:"sku,omitempty" azure:"ro"` + SKU *SKU // READ-ONLY; The status of the capability. - Status *CapabilityStatus `json:"status,omitempty" azure:"ro"` + Status *CapabilityStatus // READ-ONLY; List of supported license types. - SupportedLicenseTypes []*LicenseTypeCapability `json:"supportedLicenseTypes,omitempty" azure:"ro"` + SupportedLicenseTypes []*LicenseTypeCapability // READ-ONLY; List of supported maintenance configurations - SupportedMaintenanceConfigurations []*MaintenanceConfigurationCapability `json:"supportedMaintenanceConfigurations,omitempty" azure:"ro"` + SupportedMaintenanceConfigurations []*MaintenanceConfigurationCapability // READ-ONLY; The list of supported max sizes. - SupportedMaxSizes []*MaxSizeRangeCapability `json:"supportedMaxSizes,omitempty" azure:"ro"` + SupportedMaxSizes []*MaxSizeRangeCapability // READ-ONLY; The list of supported per database max performance levels. - SupportedPerDatabaseMaxPerformanceLevels []*ElasticPoolPerDatabaseMaxPerformanceLevelCapability `json:"supportedPerDatabaseMaxPerformanceLevels,omitempty" azure:"ro"` + SupportedPerDatabaseMaxPerformanceLevels []*ElasticPoolPerDatabaseMaxPerformanceLevelCapability // READ-ONLY; The list of supported per database max sizes. - SupportedPerDatabaseMaxSizes []*MaxSizeRangeCapability `json:"supportedPerDatabaseMaxSizes,omitempty" azure:"ro"` + SupportedPerDatabaseMaxSizes []*MaxSizeRangeCapability // READ-ONLY; Whether or not zone redundancy is supported for the performance level. - ZoneRedundant *bool `json:"zoneRedundant,omitempty" azure:"ro"` + ZoneRedundant *bool } // ElasticPoolProperties - Properties of an elastic pool type ElasticPoolProperties struct { - // The number of secondary replicas associated with the elastic pool that are used to provide high availability. - HighAvailabilityReplicaCount *int32 `json:"highAvailabilityReplicaCount,omitempty"` + // Specifies the availability zone the pool's primary replica is pinned to. + AvailabilityZone *AvailabilityZoneType + + // The number of secondary replicas associated with the elastic pool that are used to provide high availability. Applicable + // only to Hyperscale elastic pools. + HighAvailabilityReplicaCount *int32 // The license type to apply for this elastic pool. - LicenseType *ElasticPoolLicenseType `json:"licenseType,omitempty"` + LicenseType *ElasticPoolLicenseType // Maintenance configuration id assigned to the elastic pool. This configuration defines the period when the maintenance updates // will will occur. - MaintenanceConfigurationID *string `json:"maintenanceConfigurationId,omitempty"` + MaintenanceConfigurationID *string // The storage limit for the database elastic pool in bytes. - MaxSizeBytes *int64 `json:"maxSizeBytes,omitempty"` + MaxSizeBytes *int64 + + // Minimal capacity that serverless pool will not shrink below, if not paused + MinCapacity *float64 // The per database settings for the elastic pool. - PerDatabaseSettings *ElasticPoolPerDatabaseSettings `json:"perDatabaseSettings,omitempty"` + PerDatabaseSettings *ElasticPoolPerDatabaseSettings + + // Type of enclave requested on the elastic pool. + PreferredEnclaveType *AlwaysEncryptedEnclaveType // Whether or not this elastic pool is zone redundant, which means the replicas of this elastic pool will be spread across // multiple availability zones. - ZoneRedundant *bool `json:"zoneRedundant,omitempty"` + ZoneRedundant *bool // READ-ONLY; The creation date of the elastic pool (ISO8601 format). - CreationDate *time.Time `json:"creationDate,omitempty" azure:"ro"` + CreationDate *time.Time // READ-ONLY; The state of the elastic pool. - State *ElasticPoolState `json:"state,omitempty" azure:"ro"` + State *ElasticPoolState } // ElasticPoolUpdate - An elastic pool update. type ElasticPoolUpdate struct { // Resource properties. - Properties *ElasticPoolUpdateProperties `json:"properties,omitempty"` + Properties *ElasticPoolUpdateProperties // An ARM Resource SKU. - SKU *SKU `json:"sku,omitempty"` + SKU *SKU // Resource tags. - Tags map[string]*string `json:"tags,omitempty"` + Tags map[string]*string } // ElasticPoolUpdateProperties - Properties of an elastic pool type ElasticPoolUpdateProperties struct { + // Specifies the availability zone the pool's primary replica is pinned to. + AvailabilityZone *AvailabilityZoneType + // The number of secondary replicas associated with the elastic pool that are used to provide high availability. Applicable // only to Hyperscale elastic pools. - HighAvailabilityReplicaCount *int32 `json:"highAvailabilityReplicaCount,omitempty"` + HighAvailabilityReplicaCount *int32 // The license type to apply for this elastic pool. - LicenseType *ElasticPoolLicenseType `json:"licenseType,omitempty"` + LicenseType *ElasticPoolLicenseType // Maintenance configuration id assigned to the elastic pool. This configuration defines the period when the maintenance updates // will will occur. - MaintenanceConfigurationID *string `json:"maintenanceConfigurationId,omitempty"` + MaintenanceConfigurationID *string // The storage limit for the database elastic pool in bytes. - MaxSizeBytes *int64 `json:"maxSizeBytes,omitempty"` + MaxSizeBytes *int64 + + // Minimal capacity that serverless pool will not shrink below, if not paused + MinCapacity *float64 // The per database settings for the elastic pool. - PerDatabaseSettings *ElasticPoolPerDatabaseSettings `json:"perDatabaseSettings,omitempty"` + PerDatabaseSettings *ElasticPoolPerDatabaseSettings + + // Type of enclave requested on the elastic pool. + PreferredEnclaveType *AlwaysEncryptedEnclaveType // Whether or not this elastic pool is zone redundant, which means the replicas of this elastic pool will be spread across // multiple availability zones. - ZoneRedundant *bool `json:"zoneRedundant,omitempty"` -} - -// ElasticPoolsClientBeginCreateOrUpdateOptions contains the optional parameters for the ElasticPoolsClient.BeginCreateOrUpdate -// method. -type ElasticPoolsClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ElasticPoolsClientBeginDeleteOptions contains the optional parameters for the ElasticPoolsClient.BeginDelete method. -type ElasticPoolsClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ElasticPoolsClientBeginFailoverOptions contains the optional parameters for the ElasticPoolsClient.BeginFailover method. -type ElasticPoolsClientBeginFailoverOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ElasticPoolsClientBeginUpdateOptions contains the optional parameters for the ElasticPoolsClient.BeginUpdate method. -type ElasticPoolsClientBeginUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ElasticPoolsClientGetOptions contains the optional parameters for the ElasticPoolsClient.Get method. -type ElasticPoolsClientGetOptions struct { - // placeholder for future optional parameters -} - -// ElasticPoolsClientListByServerOptions contains the optional parameters for the ElasticPoolsClient.NewListByServerPager -// method. -type ElasticPoolsClientListByServerOptions struct { - // The number of elements in the collection to skip. - Skip *int64 -} - -// ElasticPoolsClientListMetricDefinitionsOptions contains the optional parameters for the ElasticPoolsClient.NewListMetricDefinitionsPager -// method. -type ElasticPoolsClientListMetricDefinitionsOptions struct { - // placeholder for future optional parameters -} - -// ElasticPoolsClientListMetricsOptions contains the optional parameters for the ElasticPoolsClient.NewListMetricsPager method. -type ElasticPoolsClientListMetricsOptions struct { - // placeholder for future optional parameters + ZoneRedundant *bool } // EncryptionProtector - The server encryption protector. type EncryptionProtector struct { // Resource properties. - Properties *EncryptionProtectorProperties `json:"properties,omitempty"` + Properties *EncryptionProtectorProperties // READ-ONLY; Resource ID. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; Kind of encryption protector. This is metadata used for the Azure portal experience. - Kind *string `json:"kind,omitempty" azure:"ro"` + Kind *string // READ-ONLY; Resource location. - Location *string `json:"location,omitempty" azure:"ro"` + Location *string // READ-ONLY; Resource name. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // EncryptionProtectorListResult - A list of server encryption protectors. type EncryptionProtectorListResult struct { // READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` + NextLink *string // READ-ONLY; Array of results. - Value []*EncryptionProtector `json:"value,omitempty" azure:"ro"` + Value []*EncryptionProtector } // EncryptionProtectorProperties - Properties for an encryption protector execution. type EncryptionProtectorProperties struct { // REQUIRED; The encryption protector type like 'ServiceManaged', 'AzureKeyVault'. - ServerKeyType *ServerKeyType `json:"serverKeyType,omitempty"` + ServerKeyType *ServerKeyType // Key auto rotation opt-in flag. Either true or false. - AutoRotationEnabled *bool `json:"autoRotationEnabled,omitempty"` + AutoRotationEnabled *bool // The name of the server key. - ServerKeyName *string `json:"serverKeyName,omitempty"` + ServerKeyName *string // READ-ONLY; Subregion of the encryption protector. - Subregion *string `json:"subregion,omitempty" azure:"ro"` + Subregion *string // READ-ONLY; Thumbprint of the server key. - Thumbprint *string `json:"thumbprint,omitempty" azure:"ro"` + Thumbprint *string // READ-ONLY; The URI of the server key. - URI *string `json:"uri,omitempty" azure:"ro"` -} - -// EncryptionProtectorsClientBeginCreateOrUpdateOptions contains the optional parameters for the EncryptionProtectorsClient.BeginCreateOrUpdate -// method. -type EncryptionProtectorsClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// EncryptionProtectorsClientBeginRevalidateOptions contains the optional parameters for the EncryptionProtectorsClient.BeginRevalidate -// method. -type EncryptionProtectorsClientBeginRevalidateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// EncryptionProtectorsClientGetOptions contains the optional parameters for the EncryptionProtectorsClient.Get method. -type EncryptionProtectorsClientGetOptions struct { - // placeholder for future optional parameters -} - -// EncryptionProtectorsClientListByServerOptions contains the optional parameters for the EncryptionProtectorsClient.NewListByServerPager -// method. -type EncryptionProtectorsClientListByServerOptions struct { - // placeholder for future optional parameters + URI *string } // EndpointCertificate - Certificate used on an endpoint on the Managed Instance. type EndpointCertificate struct { // Resource properties. - Properties *EndpointCertificateProperties `json:"properties,omitempty"` + Properties *EndpointCertificateProperties // READ-ONLY; Resource ID. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; Resource name. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // EndpointCertificateListResult - A list of endpoint certificates on the target instance. type EndpointCertificateListResult struct { // READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` + NextLink *string // READ-ONLY; Array of results. - Value []*EndpointCertificate `json:"value,omitempty" azure:"ro"` + Value []*EndpointCertificate } // EndpointCertificateProperties - The properties of an endpoint certificate. type EndpointCertificateProperties struct { // The certificate public blob - PublicBlob *string `json:"publicBlob,omitempty"` + PublicBlob *string } -// EndpointCertificatesClientGetOptions contains the optional parameters for the EndpointCertificatesClient.Get method. -type EndpointCertificatesClientGetOptions struct { - // placeholder for future optional parameters +// EndpointDependency - A domain name that the managed instance service needs to communicate with, along with additional details. +type EndpointDependency struct { + // READ-ONLY; The domain name of the dependency. + DomainName *string + + // READ-ONLY; The IP Addresses and Ports used when connecting to DomainName. + EndpointDetails []*EndpointDetail } -// EndpointCertificatesClientListByInstanceOptions contains the optional parameters for the EndpointCertificatesClient.NewListByInstancePager -// method. -type EndpointCertificatesClientListByInstanceOptions struct { - // placeholder for future optional parameters +// EndpointDetail - A domain name that the managed instance service needs to communicate with, along with additional details. +type EndpointDetail struct { + // READ-ONLY; The port an endpoint is connected to. + Port *int32 } // ExportDatabaseDefinition - Contains the information necessary to perform export database operation. type ExportDatabaseDefinition struct { // REQUIRED; Administrator login name. - AdministratorLogin *string `json:"administratorLogin,omitempty"` + AdministratorLogin *string // REQUIRED; Administrator login password. - AdministratorLoginPassword *string `json:"administratorLoginPassword,omitempty"` + AdministratorLoginPassword *string // REQUIRED; Storage key. - StorageKey *string `json:"storageKey,omitempty"` + StorageKey *string // REQUIRED; Storage key type. - StorageKeyType *StorageKeyType `json:"storageKeyType,omitempty"` + StorageKeyType *StorageKeyType // REQUIRED; Storage Uri. - StorageURI *string `json:"storageUri,omitempty"` + StorageURI *string // Authentication type. - AuthenticationType *string `json:"authenticationType,omitempty"` + AuthenticationType *string // Optional resource information to enable network isolation for request. - NetworkIsolation *NetworkIsolationSettings `json:"networkIsolation,omitempty"` -} - -// ExtendedDatabaseBlobAuditingPoliciesClientCreateOrUpdateOptions contains the optional parameters for the ExtendedDatabaseBlobAuditingPoliciesClient.CreateOrUpdate -// method. -type ExtendedDatabaseBlobAuditingPoliciesClientCreateOrUpdateOptions struct { - // placeholder for future optional parameters -} - -// ExtendedDatabaseBlobAuditingPoliciesClientGetOptions contains the optional parameters for the ExtendedDatabaseBlobAuditingPoliciesClient.Get -// method. -type ExtendedDatabaseBlobAuditingPoliciesClientGetOptions struct { - // placeholder for future optional parameters -} - -// ExtendedDatabaseBlobAuditingPoliciesClientListByDatabaseOptions contains the optional parameters for the ExtendedDatabaseBlobAuditingPoliciesClient.NewListByDatabasePager -// method. -type ExtendedDatabaseBlobAuditingPoliciesClientListByDatabaseOptions struct { - // placeholder for future optional parameters + NetworkIsolation *NetworkIsolationSettings } // ExtendedDatabaseBlobAuditingPolicy - An extended database blob auditing policy. type ExtendedDatabaseBlobAuditingPolicy struct { // Resource properties. - Properties *ExtendedDatabaseBlobAuditingPolicyProperties `json:"properties,omitempty"` + Properties *ExtendedDatabaseBlobAuditingPolicyProperties // READ-ONLY; Resource ID. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; Resource name. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // ExtendedDatabaseBlobAuditingPolicyListResult - A list of database extended auditing settings. type ExtendedDatabaseBlobAuditingPolicyListResult struct { // READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` + NextLink *string // READ-ONLY; Array of results. - Value []*ExtendedDatabaseBlobAuditingPolicy `json:"value,omitempty" azure:"ro"` + Value []*ExtendedDatabaseBlobAuditingPolicy } // ExtendedDatabaseBlobAuditingPolicyProperties - Properties of an extended database blob auditing policy. type ExtendedDatabaseBlobAuditingPolicyProperties struct { // REQUIRED; Specifies the state of the audit. If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled are required. - State *BlobAuditingPolicyState `json:"state,omitempty"` + State *BlobAuditingPolicyState // Specifies the Actions-Groups and Actions to audit. // The recommended set of action groups to use is the following combination - this will audit all the queries and stored procedures @@ -2665,7 +2219,7 @@ type ExtendedDatabaseBlobAuditingPolicyProperties struct { // For example: SELECT on dbo.myTable by public SELECT on DATABASE::myDatabase by public SELECT on SCHEMA::mySchema by public // For more information, see Database-Level Audit Actions // [https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-actions] - AuditActionsAndGroups []*string `json:"auditActionsAndGroups,omitempty"` + AuditActionsAndGroups []*string // Specifies whether audit events are sent to Azure Monitor. In order to send the events to Azure Monitor, specify 'State' // as 'Enabled' and 'IsAzureMonitorTargetEnabled' as true. @@ -2676,23 +2230,23 @@ type ExtendedDatabaseBlobAuditingPolicyProperties struct { // https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview // For more information, see Diagnostic Settings REST API [https://go.microsoft.com/fwlink/?linkid=2033207]or Diagnostic Settings // PowerShell [https://go.microsoft.com/fwlink/?linkid=2033043] - IsAzureMonitorTargetEnabled *bool `json:"isAzureMonitorTargetEnabled,omitempty"` + IsAzureMonitorTargetEnabled *bool // Specifies whether Managed Identity is used to access blob storage - IsManagedIdentityInUse *bool `json:"isManagedIdentityInUse,omitempty"` + IsManagedIdentityInUse *bool // Specifies whether storageAccountAccessKey value is the storage's secondary key. - IsStorageSecondaryKeyInUse *bool `json:"isStorageSecondaryKeyInUse,omitempty"` + IsStorageSecondaryKeyInUse *bool // Specifies condition of where clause when creating an audit. - PredicateExpression *string `json:"predicateExpression,omitempty"` + PredicateExpression *string // Specifies the amount of time in milliseconds that can elapse before audit actions are forced to be processed. The default // minimum value is 1000 (1 second). The maximum is 2,147,483,647. - QueueDelayMs *int32 `json:"queueDelayMs,omitempty"` + QueueDelayMs *int32 // Specifies the number of days to keep in the audit logs in the storage account. - RetentionDays *int32 `json:"retentionDays,omitempty"` + RetentionDays *int32 // Specifies the identifier key of the auditing storage account. If state is Enabled and storageEndpoint is specified, not // specifying the storageAccountAccessKey will use SQL server system-assigned @@ -2701,63 +2255,44 @@ type ExtendedDatabaseBlobAuditingPolicyProperties struct { // 2. Grant SQL Server identity access to the storage account by adding 'Storage Blob Data Contributor' RBAC role to the server // identity. For more information, see Auditing to storage using Managed // Identity authentication [https://go.microsoft.com/fwlink/?linkid=2114355] - StorageAccountAccessKey *string `json:"storageAccountAccessKey,omitempty"` + StorageAccountAccessKey *string // Specifies the blob storage subscription Id. - StorageAccountSubscriptionID *string `json:"storageAccountSubscriptionId,omitempty"` + StorageAccountSubscriptionID *string // Specifies the blob storage endpoint (e.g. https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint // or isAzureMonitorTargetEnabled is required. - StorageEndpoint *string `json:"storageEndpoint,omitempty"` -} - -// ExtendedServerBlobAuditingPoliciesClientBeginCreateOrUpdateOptions contains the optional parameters for the ExtendedServerBlobAuditingPoliciesClient.BeginCreateOrUpdate -// method. -type ExtendedServerBlobAuditingPoliciesClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ExtendedServerBlobAuditingPoliciesClientGetOptions contains the optional parameters for the ExtendedServerBlobAuditingPoliciesClient.Get -// method. -type ExtendedServerBlobAuditingPoliciesClientGetOptions struct { - // placeholder for future optional parameters -} - -// ExtendedServerBlobAuditingPoliciesClientListByServerOptions contains the optional parameters for the ExtendedServerBlobAuditingPoliciesClient.NewListByServerPager -// method. -type ExtendedServerBlobAuditingPoliciesClientListByServerOptions struct { - // placeholder for future optional parameters + StorageEndpoint *string } // ExtendedServerBlobAuditingPolicy - An extended server blob auditing policy. type ExtendedServerBlobAuditingPolicy struct { // Resource properties. - Properties *ExtendedServerBlobAuditingPolicyProperties `json:"properties,omitempty"` + Properties *ExtendedServerBlobAuditingPolicyProperties // READ-ONLY; Resource ID. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; Resource name. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // ExtendedServerBlobAuditingPolicyListResult - A list of server extended auditing settings. type ExtendedServerBlobAuditingPolicyListResult struct { // READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` + NextLink *string // READ-ONLY; Array of results. - Value []*ExtendedServerBlobAuditingPolicy `json:"value,omitempty" azure:"ro"` + Value []*ExtendedServerBlobAuditingPolicy } // ExtendedServerBlobAuditingPolicyProperties - Properties of an extended server blob auditing policy. type ExtendedServerBlobAuditingPolicyProperties struct { // REQUIRED; Specifies the state of the audit. If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled are required. - State *BlobAuditingPolicyState `json:"state,omitempty"` + State *BlobAuditingPolicyState // Specifies the Actions-Groups and Actions to audit. // The recommended set of action groups to use is the following combination - this will audit all the queries and stored procedures @@ -2787,7 +2322,7 @@ type ExtendedServerBlobAuditingPolicyProperties struct { // For example: SELECT on dbo.myTable by public SELECT on DATABASE::myDatabase by public SELECT on SCHEMA::mySchema by public // For more information, see Database-Level Audit Actions // [https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-actions] - AuditActionsAndGroups []*string `json:"auditActionsAndGroups,omitempty"` + AuditActionsAndGroups []*string // Specifies whether audit events are sent to Azure Monitor. In order to send the events to Azure Monitor, specify 'State' // as 'Enabled' and 'IsAzureMonitorTargetEnabled' as true. @@ -2798,7 +2333,7 @@ type ExtendedServerBlobAuditingPolicyProperties struct { // https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview // For more information, see Diagnostic Settings REST API [https://go.microsoft.com/fwlink/?linkid=2033207]or Diagnostic Settings // PowerShell [https://go.microsoft.com/fwlink/?linkid=2033043] - IsAzureMonitorTargetEnabled *bool `json:"isAzureMonitorTargetEnabled,omitempty"` + IsAzureMonitorTargetEnabled *bool // Specifies the state of devops audit. If state is Enabled, devops logs will be sent to Azure Monitor. In order to send the // events to Azure Monitor, specify 'State' as 'Enabled', @@ -2809,23 +2344,23 @@ type ExtendedServerBlobAuditingPolicyProperties struct { // https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/master/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview // For more information, see Diagnostic Settings REST API [https://go.microsoft.com/fwlink/?linkid=2033207]or Diagnostic Settings // PowerShell [https://go.microsoft.com/fwlink/?linkid=2033043] - IsDevopsAuditEnabled *bool `json:"isDevopsAuditEnabled,omitempty"` + IsDevopsAuditEnabled *bool // Specifies whether Managed Identity is used to access blob storage - IsManagedIdentityInUse *bool `json:"isManagedIdentityInUse,omitempty"` + IsManagedIdentityInUse *bool // Specifies whether storageAccountAccessKey value is the storage's secondary key. - IsStorageSecondaryKeyInUse *bool `json:"isStorageSecondaryKeyInUse,omitempty"` + IsStorageSecondaryKeyInUse *bool // Specifies condition of where clause when creating an audit. - PredicateExpression *string `json:"predicateExpression,omitempty"` + PredicateExpression *string // Specifies the amount of time in milliseconds that can elapse before audit actions are forced to be processed. The default // minimum value is 1000 (1 second). The maximum is 2,147,483,647. - QueueDelayMs *int32 `json:"queueDelayMs,omitempty"` + QueueDelayMs *int32 // Specifies the number of days to keep in the audit logs in the storage account. - RetentionDays *int32 `json:"retentionDays,omitempty"` + RetentionDays *int32 // Specifies the identifier key of the auditing storage account. If state is Enabled and storageEndpoint is specified, not // specifying the storageAccountAccessKey will use SQL server system-assigned @@ -2834,2038 +2369,1423 @@ type ExtendedServerBlobAuditingPolicyProperties struct { // 2. Grant SQL Server identity access to the storage account by adding 'Storage Blob Data Contributor' RBAC role to the server // identity. For more information, see Auditing to storage using Managed // Identity authentication [https://go.microsoft.com/fwlink/?linkid=2114355] - StorageAccountAccessKey *string `json:"storageAccountAccessKey,omitempty"` + StorageAccountAccessKey *string // Specifies the blob storage subscription Id. - StorageAccountSubscriptionID *string `json:"storageAccountSubscriptionId,omitempty"` + StorageAccountSubscriptionID *string // Specifies the blob storage endpoint (e.g. https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint // or isAzureMonitorTargetEnabled is required. - StorageEndpoint *string `json:"storageEndpoint,omitempty"` + StorageEndpoint *string } // FailoverGroup - A failover group. type FailoverGroup struct { // Resource properties. - Properties *FailoverGroupProperties `json:"properties,omitempty"` + Properties *FailoverGroupProperties // Resource tags. - Tags map[string]*string `json:"tags,omitempty"` + Tags map[string]*string // READ-ONLY; Resource ID. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; Resource location. - Location *string `json:"location,omitempty" azure:"ro"` + Location *string // READ-ONLY; Resource name. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // FailoverGroupListResult - A list of failover groups. type FailoverGroupListResult struct { // READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` + NextLink *string // READ-ONLY; Array of results. - Value []*FailoverGroup `json:"value,omitempty" azure:"ro"` + Value []*FailoverGroup } // FailoverGroupProperties - Properties of a failover group. type FailoverGroupProperties struct { // REQUIRED; List of partner server information for the failover group. - PartnerServers []*PartnerInfo `json:"partnerServers,omitempty"` + PartnerServers []*PartnerInfo // REQUIRED; Read-write endpoint of the failover group instance. - ReadWriteEndpoint *FailoverGroupReadWriteEndpoint `json:"readWriteEndpoint,omitempty"` + ReadWriteEndpoint *FailoverGroupReadWriteEndpoint // List of databases in the failover group. - Databases []*string `json:"databases,omitempty"` + Databases []*string // Read-only endpoint of the failover group instance. - ReadOnlyEndpoint *FailoverGroupReadOnlyEndpoint `json:"readOnlyEndpoint,omitempty"` + ReadOnlyEndpoint *FailoverGroupReadOnlyEndpoint // READ-ONLY; Local replication role of the failover group instance. - ReplicationRole *FailoverGroupReplicationRole `json:"replicationRole,omitempty" azure:"ro"` + ReplicationRole *FailoverGroupReplicationRole // READ-ONLY; Replication state of the failover group instance. - ReplicationState *string `json:"replicationState,omitempty" azure:"ro"` + ReplicationState *string } // FailoverGroupReadOnlyEndpoint - Read-only endpoint of the failover group instance. type FailoverGroupReadOnlyEndpoint struct { // Failover policy of the read-only endpoint for the failover group. - FailoverPolicy *ReadOnlyEndpointFailoverPolicy `json:"failoverPolicy,omitempty"` + FailoverPolicy *ReadOnlyEndpointFailoverPolicy } // FailoverGroupReadWriteEndpoint - Read-write endpoint of the failover group instance. type FailoverGroupReadWriteEndpoint struct { // REQUIRED; Failover policy of the read-write endpoint for the failover group. If failoverPolicy is Automatic then failoverWithDataLossGracePeriodMinutes // is required. - FailoverPolicy *ReadWriteEndpointFailoverPolicy `json:"failoverPolicy,omitempty"` + FailoverPolicy *ReadWriteEndpointFailoverPolicy // Grace period before failover with data loss is attempted for the read-write endpoint. If failoverPolicy is Automatic then // failoverWithDataLossGracePeriodMinutes is required. - FailoverWithDataLossGracePeriodMinutes *int32 `json:"failoverWithDataLossGracePeriodMinutes,omitempty"` + FailoverWithDataLossGracePeriodMinutes *int32 } // FailoverGroupUpdate - A failover group update request. type FailoverGroupUpdate struct { // Resource properties. - Properties *FailoverGroupUpdateProperties `json:"properties,omitempty"` + Properties *FailoverGroupUpdateProperties // Resource tags. - Tags map[string]*string `json:"tags,omitempty"` + Tags map[string]*string } // FailoverGroupUpdateProperties - Properties of a failover group update. type FailoverGroupUpdateProperties struct { // List of databases in the failover group. - Databases []*string `json:"databases,omitempty"` + Databases []*string // Read-only endpoint of the failover group instance. - ReadOnlyEndpoint *FailoverGroupReadOnlyEndpoint `json:"readOnlyEndpoint,omitempty"` + ReadOnlyEndpoint *FailoverGroupReadOnlyEndpoint // Read-write endpoint of the failover group instance. - ReadWriteEndpoint *FailoverGroupReadWriteEndpoint `json:"readWriteEndpoint,omitempty"` -} - -// FailoverGroupsClientBeginCreateOrUpdateOptions contains the optional parameters for the FailoverGroupsClient.BeginCreateOrUpdate -// method. -type FailoverGroupsClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// FailoverGroupsClientBeginDeleteOptions contains the optional parameters for the FailoverGroupsClient.BeginDelete method. -type FailoverGroupsClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// FailoverGroupsClientBeginFailoverOptions contains the optional parameters for the FailoverGroupsClient.BeginFailover method. -type FailoverGroupsClientBeginFailoverOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// FailoverGroupsClientBeginForceFailoverAllowDataLossOptions contains the optional parameters for the FailoverGroupsClient.BeginForceFailoverAllowDataLoss -// method. -type FailoverGroupsClientBeginForceFailoverAllowDataLossOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// FailoverGroupsClientBeginUpdateOptions contains the optional parameters for the FailoverGroupsClient.BeginUpdate method. -type FailoverGroupsClientBeginUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// FailoverGroupsClientGetOptions contains the optional parameters for the FailoverGroupsClient.Get method. -type FailoverGroupsClientGetOptions struct { - // placeholder for future optional parameters -} - -// FailoverGroupsClientListByServerOptions contains the optional parameters for the FailoverGroupsClient.NewListByServerPager -// method. -type FailoverGroupsClientListByServerOptions struct { - // placeholder for future optional parameters + ReadWriteEndpoint *FailoverGroupReadWriteEndpoint } // FirewallRule - A server firewall rule. type FirewallRule struct { // Resource name. - Name *string `json:"name,omitempty"` + Name *string // Resource properties. - Properties *ServerFirewallRuleProperties `json:"properties,omitempty"` + Properties *ServerFirewallRuleProperties // READ-ONLY; Resource ID. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // FirewallRuleList - A list of server firewall rules. type FirewallRuleList struct { - Values []*FirewallRule `json:"values,omitempty"` + Values []*FirewallRule } // FirewallRuleListResult - The response to a list firewall rules request type FirewallRuleListResult struct { // READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` + NextLink *string // READ-ONLY; Array of results. - Value []*FirewallRule `json:"value,omitempty" azure:"ro"` + Value []*FirewallRule } -// FirewallRulesClientCreateOrUpdateOptions contains the optional parameters for the FirewallRulesClient.CreateOrUpdate method. -type FirewallRulesClientCreateOrUpdateOptions struct { - // placeholder for future optional parameters -} - -// FirewallRulesClientDeleteOptions contains the optional parameters for the FirewallRulesClient.Delete method. -type FirewallRulesClientDeleteOptions struct { - // placeholder for future optional parameters -} - -// FirewallRulesClientGetOptions contains the optional parameters for the FirewallRulesClient.Get method. -type FirewallRulesClientGetOptions struct { - // placeholder for future optional parameters -} - -// FirewallRulesClientListByServerOptions contains the optional parameters for the FirewallRulesClient.NewListByServerPager -// method. -type FirewallRulesClientListByServerOptions struct { - // placeholder for future optional parameters -} - -// FirewallRulesClientReplaceOptions contains the optional parameters for the FirewallRulesClient.Replace method. -type FirewallRulesClientReplaceOptions struct { - // placeholder for future optional parameters -} - -// GeoBackupPoliciesClientCreateOrUpdateOptions contains the optional parameters for the GeoBackupPoliciesClient.CreateOrUpdate -// method. -type GeoBackupPoliciesClientCreateOrUpdateOptions struct { - // placeholder for future optional parameters -} - -// GeoBackupPoliciesClientGetOptions contains the optional parameters for the GeoBackupPoliciesClient.Get method. -type GeoBackupPoliciesClientGetOptions struct { - // placeholder for future optional parameters -} - -// GeoBackupPoliciesClientListByDatabaseOptions contains the optional parameters for the GeoBackupPoliciesClient.NewListByDatabasePager -// method. -type GeoBackupPoliciesClientListByDatabaseOptions struct { - // placeholder for future optional parameters -} - -// GeoBackupPolicy - A database geo backup policy. +// GeoBackupPolicy - A Geo backup policy. type GeoBackupPolicy struct { - // REQUIRED; The properties of the geo backup policy. - Properties *GeoBackupPolicyProperties `json:"properties,omitempty"` + // Resource properties. + Properties *GeoBackupPolicyProperties // READ-ONLY; Resource ID. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; Kind of geo backup policy. This is metadata used for the Azure portal experience. - Kind *string `json:"kind,omitempty" azure:"ro"` + Kind *string // READ-ONLY; Backup policy location. - Location *string `json:"location,omitempty" azure:"ro"` + Location *string // READ-ONLY; Resource name. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } -// GeoBackupPolicyListResult - The response to a list geo backup policies request. +// GeoBackupPolicyListResult - The list of geo backup policies. type GeoBackupPolicyListResult struct { - // The list of geo backup policies. - Value []*GeoBackupPolicy `json:"value,omitempty"` + // READ-ONLY; Link to retrieve next page of results. + NextLink *string + + // READ-ONLY; Array of results. + Value []*GeoBackupPolicy } // GeoBackupPolicyProperties - The properties of the geo backup policy. type GeoBackupPolicyProperties struct { // REQUIRED; The state of the geo backup policy. - State *GeoBackupPolicyState `json:"state,omitempty"` + State *GeoBackupPolicyState // READ-ONLY; The storage type of the geo backup policy. - StorageType *string `json:"storageType,omitempty" azure:"ro"` + StorageType *string } // IPv6FirewallRule - An IPv6 server firewall rule. type IPv6FirewallRule struct { // Resource name. - Name *string `json:"name,omitempty"` + Name *string // Resource properties. - Properties *IPv6ServerFirewallRuleProperties `json:"properties,omitempty"` + Properties *IPv6ServerFirewallRuleProperties // READ-ONLY; Resource ID. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // IPv6FirewallRuleListResult - The response to a list IPv6 firewall rules request type IPv6FirewallRuleListResult struct { // READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` + NextLink *string // READ-ONLY; Array of results. - Value []*IPv6FirewallRule `json:"value,omitempty" azure:"ro"` -} - -// IPv6FirewallRulesClientCreateOrUpdateOptions contains the optional parameters for the IPv6FirewallRulesClient.CreateOrUpdate -// method. -type IPv6FirewallRulesClientCreateOrUpdateOptions struct { - // placeholder for future optional parameters -} - -// IPv6FirewallRulesClientDeleteOptions contains the optional parameters for the IPv6FirewallRulesClient.Delete method. -type IPv6FirewallRulesClientDeleteOptions struct { - // placeholder for future optional parameters -} - -// IPv6FirewallRulesClientGetOptions contains the optional parameters for the IPv6FirewallRulesClient.Get method. -type IPv6FirewallRulesClientGetOptions struct { - // placeholder for future optional parameters -} - -// IPv6FirewallRulesClientListByServerOptions contains the optional parameters for the IPv6FirewallRulesClient.NewListByServerPager -// method. -type IPv6FirewallRulesClientListByServerOptions struct { - // placeholder for future optional parameters + Value []*IPv6FirewallRule } // IPv6ServerFirewallRuleProperties - The properties of an IPv6 server firewall rule. type IPv6ServerFirewallRuleProperties struct { - // The end IP address of the firewall rule. Must be IPv6 format. Must be greater than or equal to startIpAddress. - EndIPv6Address *string `json:"endIPv6Address,omitempty"` + // The end IP address of the firewall rule. Must be IPv6 format. Must be greater than or equal to startIpv6Address. + EndIPv6Address *string // The start IP address of the firewall rule. Must be IPv6 format. - StartIPv6Address *string `json:"startIPv6Address,omitempty"` + StartIPv6Address *string } // ImportExistingDatabaseDefinition - Contains the information necessary to perform import operation for existing database. type ImportExistingDatabaseDefinition struct { // REQUIRED; Administrator login name. - AdministratorLogin *string `json:"administratorLogin,omitempty"` + AdministratorLogin *string // REQUIRED; Administrator login password. - AdministratorLoginPassword *string `json:"administratorLoginPassword,omitempty"` + AdministratorLoginPassword *string // REQUIRED; Storage key. - StorageKey *string `json:"storageKey,omitempty"` + StorageKey *string // REQUIRED; Storage key type. - StorageKeyType *StorageKeyType `json:"storageKeyType,omitempty"` + StorageKeyType *StorageKeyType // REQUIRED; Storage Uri. - StorageURI *string `json:"storageUri,omitempty"` + StorageURI *string // Authentication type. - AuthenticationType *string `json:"authenticationType,omitempty"` + AuthenticationType *string // Optional resource information to enable network isolation for request. - NetworkIsolation *NetworkIsolationSettings `json:"networkIsolation,omitempty"` + NetworkIsolation *NetworkIsolationSettings } // ImportExportExtensionsOperationListResult - Import export operation extensions list. type ImportExportExtensionsOperationListResult struct { // READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` + NextLink *string // READ-ONLY; Array of results. - Value []*ImportExportExtensionsOperationResult `json:"value,omitempty" azure:"ro"` + Value []*ImportExportExtensionsOperationResult } // ImportExportExtensionsOperationResult - An Extension operation result resource. type ImportExportExtensionsOperationResult struct { // Resource properties. - Properties *ImportExportExtensionsOperationResultProperties `json:"properties,omitempty"` + Properties *ImportExportExtensionsOperationResultProperties // READ-ONLY; Resource ID. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; Resource name. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // ImportExportExtensionsOperationResultProperties - Contains the operation result properties for import/export operation. type ImportExportExtensionsOperationResultProperties struct { + // READ-ONLY; Blob URI. + BlobURI *string + // READ-ONLY; Database name. - DatabaseName *string `json:"databaseName,omitempty" azure:"ro"` + DatabaseName *string // READ-ONLY; Error message. - ErrorMessage *string `json:"errorMessage,omitempty" azure:"ro"` + ErrorMessage *string // READ-ONLY; Last modified time. - LastModifiedTime *string `json:"lastModifiedTime,omitempty" azure:"ro"` + LastModifiedTime *string + + // READ-ONLY; Gets the status of private endpoints associated with this request. + PrivateEndpointConnections []*PrivateEndpointConnectionRequestStatus + + // READ-ONLY; Queued time. + QueuedTime *string // READ-ONLY; Request Id. - RequestID *string `json:"requestId,omitempty" azure:"ro"` + RequestID *string // READ-ONLY; Request type. - RequestType *string `json:"requestType,omitempty" azure:"ro"` + RequestType *string // READ-ONLY; Server name. - ServerName *string `json:"serverName,omitempty" azure:"ro"` + ServerName *string // READ-ONLY; Operation status. - Status *string `json:"status,omitempty" azure:"ro"` + Status *string } // ImportExportOperationResult - An ImportExport operation result resource. type ImportExportOperationResult struct { // Resource properties. - Properties *ImportExportOperationResultProperties `json:"properties,omitempty"` + Properties *ImportExportOperationResultProperties // READ-ONLY; Resource ID. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; Resource name. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // ImportExportOperationResultProperties - Contains the operation result properties for import/export operation. type ImportExportOperationResultProperties struct { // READ-ONLY; Blob Uri. - BlobURI *string `json:"blobUri,omitempty" azure:"ro"` + BlobURI *string // READ-ONLY; Database name. - DatabaseName *string `json:"databaseName,omitempty" azure:"ro"` + DatabaseName *string // READ-ONLY; Error message. - ErrorMessage *string `json:"errorMessage,omitempty" azure:"ro"` + ErrorMessage *string // READ-ONLY; Last modified time. - LastModifiedTime *string `json:"lastModifiedTime,omitempty" azure:"ro"` + LastModifiedTime *string // READ-ONLY; Gets the status of private endpoints associated with this request. - PrivateEndpointConnections []*PrivateEndpointConnectionRequestStatus `json:"privateEndpointConnections,omitempty" azure:"ro"` + PrivateEndpointConnections []*PrivateEndpointConnectionRequestStatus // READ-ONLY; Queued time. - QueuedTime *string `json:"queuedTime,omitempty" azure:"ro"` + QueuedTime *string // READ-ONLY; Request Id. - RequestID *string `json:"requestId,omitempty" azure:"ro"` + RequestID *string // READ-ONLY; Request type. - RequestType *string `json:"requestType,omitempty" azure:"ro"` + RequestType *string // READ-ONLY; Server name. - ServerName *string `json:"serverName,omitempty" azure:"ro"` + ServerName *string // READ-ONLY; Operation status. - Status *string `json:"status,omitempty" azure:"ro"` + Status *string } // ImportNewDatabaseDefinition - Contains the information necessary to perform import operation for new database. type ImportNewDatabaseDefinition struct { // REQUIRED; Administrator login name. - AdministratorLogin *string `json:"administratorLogin,omitempty"` + AdministratorLogin *string // REQUIRED; Administrator login password. - AdministratorLoginPassword *string `json:"administratorLoginPassword,omitempty"` + AdministratorLoginPassword *string // REQUIRED; Storage key. - StorageKey *string `json:"storageKey,omitempty"` + StorageKey *string // REQUIRED; Storage key type. - StorageKeyType *StorageKeyType `json:"storageKeyType,omitempty"` + StorageKeyType *StorageKeyType // REQUIRED; Storage Uri. - StorageURI *string `json:"storageUri,omitempty"` + StorageURI *string // Authentication type. - AuthenticationType *string `json:"authenticationType,omitempty"` + AuthenticationType *string // Name of the import database. - DatabaseName *string `json:"databaseName,omitempty"` + DatabaseName *string // Edition of the import database. - Edition *string `json:"edition,omitempty"` + Edition *string // Max size in bytes for the import database. - MaxSizeBytes *string `json:"maxSizeBytes,omitempty"` + MaxSizeBytes *string // Optional resource information to enable network isolation for request. - NetworkIsolation *NetworkIsolationSettings `json:"networkIsolation,omitempty"` + NetworkIsolation *NetworkIsolationSettings // Service level objective name of the import database. - ServiceObjectiveName *string `json:"serviceObjectiveName,omitempty"` + ServiceObjectiveName *string } // InstanceFailoverGroup - An instance failover group. type InstanceFailoverGroup struct { // Resource properties. - Properties *InstanceFailoverGroupProperties `json:"properties,omitempty"` + Properties *InstanceFailoverGroupProperties // READ-ONLY; Resource ID. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; Resource name. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // InstanceFailoverGroupListResult - A list of instance failover groups. type InstanceFailoverGroupListResult struct { // READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` + NextLink *string // READ-ONLY; Array of results. - Value []*InstanceFailoverGroup `json:"value,omitempty" azure:"ro"` + Value []*InstanceFailoverGroup } // InstanceFailoverGroupProperties - Properties of a instance failover group. type InstanceFailoverGroupProperties struct { // REQUIRED; List of managed instance pairs in the failover group. - ManagedInstancePairs []*ManagedInstancePairInfo `json:"managedInstancePairs,omitempty"` + ManagedInstancePairs []*ManagedInstancePairInfo // REQUIRED; Partner region information for the failover group. - PartnerRegions []*PartnerRegionInfo `json:"partnerRegions,omitempty"` + PartnerRegions []*PartnerRegionInfo // REQUIRED; Read-write endpoint of the failover group instance. - ReadWriteEndpoint *InstanceFailoverGroupReadWriteEndpoint `json:"readWriteEndpoint,omitempty"` + ReadWriteEndpoint *InstanceFailoverGroupReadWriteEndpoint // Read-only endpoint of the failover group instance. - ReadOnlyEndpoint *InstanceFailoverGroupReadOnlyEndpoint `json:"readOnlyEndpoint,omitempty"` + ReadOnlyEndpoint *InstanceFailoverGroupReadOnlyEndpoint + + // Type of the geo-secondary instance. Set 'Standby' if the instance is used as a DR option only. + SecondaryType *SecondaryInstanceType // READ-ONLY; Local replication role of the failover group instance. - ReplicationRole *InstanceFailoverGroupReplicationRole `json:"replicationRole,omitempty" azure:"ro"` + ReplicationRole *InstanceFailoverGroupReplicationRole // READ-ONLY; Replication state of the failover group instance. - ReplicationState *string `json:"replicationState,omitempty" azure:"ro"` + ReplicationState *string } // InstanceFailoverGroupReadOnlyEndpoint - Read-only endpoint of the failover group instance. type InstanceFailoverGroupReadOnlyEndpoint struct { // Failover policy of the read-only endpoint for the failover group. - FailoverPolicy *ReadOnlyEndpointFailoverPolicy `json:"failoverPolicy,omitempty"` + FailoverPolicy *ReadOnlyEndpointFailoverPolicy } // InstanceFailoverGroupReadWriteEndpoint - Read-write endpoint of the failover group instance. type InstanceFailoverGroupReadWriteEndpoint struct { // REQUIRED; Failover policy of the read-write endpoint for the failover group. If failoverPolicy is Automatic then failoverWithDataLossGracePeriodMinutes // is required. - FailoverPolicy *ReadWriteEndpointFailoverPolicy `json:"failoverPolicy,omitempty"` + FailoverPolicy *ReadWriteEndpointFailoverPolicy // Grace period before failover with data loss is attempted for the read-write endpoint. If failoverPolicy is Automatic then // failoverWithDataLossGracePeriodMinutes is required. - FailoverWithDataLossGracePeriodMinutes *int32 `json:"failoverWithDataLossGracePeriodMinutes,omitempty"` -} - -// InstanceFailoverGroupsClientBeginCreateOrUpdateOptions contains the optional parameters for the InstanceFailoverGroupsClient.BeginCreateOrUpdate -// method. -type InstanceFailoverGroupsClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// InstanceFailoverGroupsClientBeginDeleteOptions contains the optional parameters for the InstanceFailoverGroupsClient.BeginDelete -// method. -type InstanceFailoverGroupsClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// InstanceFailoverGroupsClientBeginFailoverOptions contains the optional parameters for the InstanceFailoverGroupsClient.BeginFailover -// method. -type InstanceFailoverGroupsClientBeginFailoverOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// InstanceFailoverGroupsClientBeginForceFailoverAllowDataLossOptions contains the optional parameters for the InstanceFailoverGroupsClient.BeginForceFailoverAllowDataLoss -// method. -type InstanceFailoverGroupsClientBeginForceFailoverAllowDataLossOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// InstanceFailoverGroupsClientGetOptions contains the optional parameters for the InstanceFailoverGroupsClient.Get method. -type InstanceFailoverGroupsClientGetOptions struct { - // placeholder for future optional parameters -} - -// InstanceFailoverGroupsClientListByLocationOptions contains the optional parameters for the InstanceFailoverGroupsClient.NewListByLocationPager -// method. -type InstanceFailoverGroupsClientListByLocationOptions struct { - // placeholder for future optional parameters + FailoverWithDataLossGracePeriodMinutes *int32 } // InstancePool - An Azure SQL instance pool. type InstancePool struct { // REQUIRED; Resource location. - Location *string `json:"location,omitempty"` + Location *string // Resource properties. - Properties *InstancePoolProperties `json:"properties,omitempty"` + Properties *InstancePoolProperties // The name and tier of the SKU. - SKU *SKU `json:"sku,omitempty"` + SKU *SKU // Resource tags. - Tags map[string]*string `json:"tags,omitempty"` + Tags map[string]*string // READ-ONLY; Resource ID. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; Resource name. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // InstancePoolEditionCapability - The instance pool capability type InstancePoolEditionCapability struct { // The reason for the capability not being available. - Reason *string `json:"reason,omitempty"` + Reason *string // READ-ONLY; The instance pool version name. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; The status of the capability. - Status *CapabilityStatus `json:"status,omitempty" azure:"ro"` + Status *CapabilityStatus // READ-ONLY; The supported families. - SupportedFamilies []*InstancePoolFamilyCapability `json:"supportedFamilies,omitempty" azure:"ro"` + SupportedFamilies []*InstancePoolFamilyCapability } // InstancePoolFamilyCapability - The instance pool family capability. type InstancePoolFamilyCapability struct { // The reason for the capability not being available. - Reason *string `json:"reason,omitempty"` + Reason *string // READ-ONLY; Family name. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; The status of the capability. - Status *CapabilityStatus `json:"status,omitempty" azure:"ro"` + Status *CapabilityStatus // READ-ONLY; List of supported license types. - SupportedLicenseTypes []*LicenseTypeCapability `json:"supportedLicenseTypes,omitempty" azure:"ro"` + SupportedLicenseTypes []*LicenseTypeCapability // READ-ONLY; List of supported virtual cores values. - SupportedVcoresValues []*InstancePoolVcoresCapability `json:"supportedVcoresValues,omitempty" azure:"ro"` + SupportedVcoresValues []*InstancePoolVcoresCapability } // InstancePoolListResult - A list of Azure SQL instance pools. type InstancePoolListResult struct { // READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` + NextLink *string // READ-ONLY; Array of results. - Value []*InstancePool `json:"value,omitempty" azure:"ro"` + Value []*InstancePool } // InstancePoolProperties - Properties of an instance pool. type InstancePoolProperties struct { // REQUIRED; The license type. Possible values are 'LicenseIncluded' (price for SQL license is included) and 'BasePrice' (without // SQL license price). - LicenseType *InstancePoolLicenseType `json:"licenseType,omitempty"` + LicenseType *InstancePoolLicenseType // REQUIRED; Resource ID of the subnet to place this instance pool in. - SubnetID *string `json:"subnetId,omitempty"` + SubnetID *string // REQUIRED; Count of vCores belonging to this instance pool. - VCores *int32 `json:"vCores,omitempty"` + VCores *int32 } // InstancePoolUpdate - An update to an Instance pool. type InstancePoolUpdate struct { // Resource tags. - Tags map[string]*string `json:"tags,omitempty"` + Tags map[string]*string } // InstancePoolVcoresCapability - The managed instance virtual cores capability. type InstancePoolVcoresCapability struct { // The reason for the capability not being available. - Reason *string `json:"reason,omitempty"` + Reason *string // READ-ONLY; The virtual cores identifier. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; The status of the capability. - Status *CapabilityStatus `json:"status,omitempty" azure:"ro"` + Status *CapabilityStatus // READ-ONLY; Storage limit. - StorageLimit *MaxSizeCapability `json:"storageLimit,omitempty" azure:"ro"` + StorageLimit *MaxSizeCapability // READ-ONLY; The virtual cores value. - Value *int32 `json:"value,omitempty" azure:"ro"` -} - -// InstancePoolsClientBeginCreateOrUpdateOptions contains the optional parameters for the InstancePoolsClient.BeginCreateOrUpdate -// method. -type InstancePoolsClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// InstancePoolsClientBeginDeleteOptions contains the optional parameters for the InstancePoolsClient.BeginDelete method. -type InstancePoolsClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// InstancePoolsClientBeginUpdateOptions contains the optional parameters for the InstancePoolsClient.BeginUpdate method. -type InstancePoolsClientBeginUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// InstancePoolsClientGetOptions contains the optional parameters for the InstancePoolsClient.Get method. -type InstancePoolsClientGetOptions struct { - // placeholder for future optional parameters -} - -// InstancePoolsClientListByResourceGroupOptions contains the optional parameters for the InstancePoolsClient.NewListByResourceGroupPager -// method. -type InstancePoolsClientListByResourceGroupOptions struct { - // placeholder for future optional parameters -} - -// InstancePoolsClientListOptions contains the optional parameters for the InstancePoolsClient.NewListPager method. -type InstancePoolsClientListOptions struct { - // placeholder for future optional parameters + Value *int32 } // Job - A job. type Job struct { // Resource properties. - Properties *JobProperties `json:"properties,omitempty"` + Properties *JobProperties // READ-ONLY; Resource ID. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; Resource name. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // JobAgent - An Azure SQL job agent. type JobAgent struct { // REQUIRED; Resource location. - Location *string `json:"location,omitempty"` + Location *string // Resource properties. - Properties *JobAgentProperties `json:"properties,omitempty"` + Properties *JobAgentProperties // The name and tier of the SKU. - SKU *SKU `json:"sku,omitempty"` + SKU *SKU // Resource tags. - Tags map[string]*string `json:"tags,omitempty"` + Tags map[string]*string // READ-ONLY; Resource ID. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; Resource name. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // JobAgentListResult - A list of Azure SQL job agents. type JobAgentListResult struct { // READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` + NextLink *string // READ-ONLY; Array of results. - Value []*JobAgent `json:"value,omitempty" azure:"ro"` + Value []*JobAgent } // JobAgentProperties - Properties of a job agent. type JobAgentProperties struct { // REQUIRED; Resource ID of the database to store job metadata in. - DatabaseID *string `json:"databaseId,omitempty"` + DatabaseID *string // READ-ONLY; The state of the job agent. - State *JobAgentState `json:"state,omitempty" azure:"ro"` + State *JobAgentState } // JobAgentUpdate - An update to an Azure SQL job agent. type JobAgentUpdate struct { // Resource tags. - Tags map[string]*string `json:"tags,omitempty"` -} - -// JobAgentsClientBeginCreateOrUpdateOptions contains the optional parameters for the JobAgentsClient.BeginCreateOrUpdate -// method. -type JobAgentsClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// JobAgentsClientBeginDeleteOptions contains the optional parameters for the JobAgentsClient.BeginDelete method. -type JobAgentsClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// JobAgentsClientBeginUpdateOptions contains the optional parameters for the JobAgentsClient.BeginUpdate method. -type JobAgentsClientBeginUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// JobAgentsClientGetOptions contains the optional parameters for the JobAgentsClient.Get method. -type JobAgentsClientGetOptions struct { - // placeholder for future optional parameters -} - -// JobAgentsClientListByServerOptions contains the optional parameters for the JobAgentsClient.NewListByServerPager method. -type JobAgentsClientListByServerOptions struct { - // placeholder for future optional parameters + Tags map[string]*string } // JobCredential - A stored credential that can be used by a job to connect to target databases. type JobCredential struct { // Resource properties. - Properties *JobCredentialProperties `json:"properties,omitempty"` + Properties *JobCredentialProperties // READ-ONLY; Resource ID. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; Resource name. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // JobCredentialListResult - A list of job credentials. type JobCredentialListResult struct { // READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` + NextLink *string // READ-ONLY; Array of results. - Value []*JobCredential `json:"value,omitempty" azure:"ro"` + Value []*JobCredential } // JobCredentialProperties - Properties of a job credential. type JobCredentialProperties struct { // REQUIRED; The credential password. - Password *string `json:"password,omitempty"` + Password *string // REQUIRED; The credential user name. - Username *string `json:"username,omitempty"` -} - -// JobCredentialsClientCreateOrUpdateOptions contains the optional parameters for the JobCredentialsClient.CreateOrUpdate -// method. -type JobCredentialsClientCreateOrUpdateOptions struct { - // placeholder for future optional parameters -} - -// JobCredentialsClientDeleteOptions contains the optional parameters for the JobCredentialsClient.Delete method. -type JobCredentialsClientDeleteOptions struct { - // placeholder for future optional parameters -} - -// JobCredentialsClientGetOptions contains the optional parameters for the JobCredentialsClient.Get method. -type JobCredentialsClientGetOptions struct { - // placeholder for future optional parameters -} - -// JobCredentialsClientListByAgentOptions contains the optional parameters for the JobCredentialsClient.NewListByAgentPager -// method. -type JobCredentialsClientListByAgentOptions struct { - // placeholder for future optional parameters + Username *string } // JobExecution - An execution of a job type JobExecution struct { // Resource properties. - Properties *JobExecutionProperties `json:"properties,omitempty"` + Properties *JobExecutionProperties // READ-ONLY; Resource ID. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; Resource name. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // JobExecutionListResult - A list of job executions. type JobExecutionListResult struct { // READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` + NextLink *string // READ-ONLY; Array of results. - Value []*JobExecution `json:"value,omitempty" azure:"ro"` + Value []*JobExecution } // JobExecutionProperties - Properties for an Azure SQL Database Elastic job execution. type JobExecutionProperties struct { // Number of times the job execution has been attempted. - CurrentAttempts *int32 `json:"currentAttempts,omitempty"` + CurrentAttempts *int32 // READ-ONLY; The time that the job execution was created. - CreateTime *time.Time `json:"createTime,omitempty" azure:"ro"` + CreateTime *time.Time // READ-ONLY; Start time of the current attempt. - CurrentAttemptStartTime *time.Time `json:"currentAttemptStartTime,omitempty" azure:"ro"` + CurrentAttemptStartTime *time.Time // READ-ONLY; The time that the job execution completed. - EndTime *time.Time `json:"endTime,omitempty" azure:"ro"` + EndTime *time.Time // READ-ONLY; The unique identifier of the job execution. - JobExecutionID *string `json:"jobExecutionId,omitempty" azure:"ro"` + JobExecutionID *string // READ-ONLY; The job version number. - JobVersion *int32 `json:"jobVersion,omitempty" azure:"ro"` + JobVersion *int32 // READ-ONLY; The last status or error message. - LastMessage *string `json:"lastMessage,omitempty" azure:"ro"` + LastMessage *string // READ-ONLY; The detailed state of the job execution. - Lifecycle *JobExecutionLifecycle `json:"lifecycle,omitempty" azure:"ro"` + Lifecycle *JobExecutionLifecycle // READ-ONLY; The ARM provisioning state of the job execution. - ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` + ProvisioningState *ProvisioningState // READ-ONLY; The time that the job execution started. - StartTime *time.Time `json:"startTime,omitempty" azure:"ro"` + StartTime *time.Time // READ-ONLY; The job step id. - StepID *int32 `json:"stepId,omitempty" azure:"ro"` + StepID *int32 // READ-ONLY; The job step name. - StepName *string `json:"stepName,omitempty" azure:"ro"` + StepName *string // READ-ONLY; The target that this execution is executed on. - Target *JobExecutionTarget `json:"target,omitempty" azure:"ro"` + Target *JobExecutionTarget } // JobExecutionTarget - The target that a job execution is executed on. type JobExecutionTarget struct { // READ-ONLY; The database name. - DatabaseName *string `json:"databaseName,omitempty" azure:"ro"` + DatabaseName *string // READ-ONLY; The server name. - ServerName *string `json:"serverName,omitempty" azure:"ro"` + ServerName *string // READ-ONLY; The type of the target. - Type *JobTargetType `json:"type,omitempty" azure:"ro"` -} - -// JobExecutionsClientBeginCreateOptions contains the optional parameters for the JobExecutionsClient.BeginCreate method. -type JobExecutionsClientBeginCreateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// JobExecutionsClientBeginCreateOrUpdateOptions contains the optional parameters for the JobExecutionsClient.BeginCreateOrUpdate -// method. -type JobExecutionsClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// JobExecutionsClientCancelOptions contains the optional parameters for the JobExecutionsClient.Cancel method. -type JobExecutionsClientCancelOptions struct { - // placeholder for future optional parameters -} - -// JobExecutionsClientGetOptions contains the optional parameters for the JobExecutionsClient.Get method. -type JobExecutionsClientGetOptions struct { - // placeholder for future optional parameters -} - -// JobExecutionsClientListByAgentOptions contains the optional parameters for the JobExecutionsClient.NewListByAgentPager -// method. -type JobExecutionsClientListByAgentOptions struct { - // If specified, only job executions created before the specified time are included. - CreateTimeMax *time.Time - // If specified, only job executions created at or after the specified time are included. - CreateTimeMin *time.Time - // If specified, only job executions completed before the specified time are included. - EndTimeMax *time.Time - // If specified, only job executions completed at or after the specified time are included. - EndTimeMin *time.Time - // If specified, only active or only completed job executions are included. - IsActive *bool - // The number of elements in the collection to skip. - Skip *int32 - // The number of elements to return from the collection. - Top *int32 -} - -// JobExecutionsClientListByJobOptions contains the optional parameters for the JobExecutionsClient.NewListByJobPager method. -type JobExecutionsClientListByJobOptions struct { - // If specified, only job executions created before the specified time are included. - CreateTimeMax *time.Time - // If specified, only job executions created at or after the specified time are included. - CreateTimeMin *time.Time - // If specified, only job executions completed before the specified time are included. - EndTimeMax *time.Time - // If specified, only job executions completed at or after the specified time are included. - EndTimeMin *time.Time - // If specified, only active or only completed job executions are included. - IsActive *bool - // The number of elements in the collection to skip. - Skip *int32 - // The number of elements to return from the collection. - Top *int32 + Type *JobTargetType } // JobListResult - A list of jobs. type JobListResult struct { // READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` + NextLink *string // READ-ONLY; Array of results. - Value []*Job `json:"value,omitempty" azure:"ro"` + Value []*Job } // JobProperties - Properties of a job. type JobProperties struct { // User-defined description of the job. - Description *string `json:"description,omitempty"` + Description *string // Schedule properties of the job. - Schedule *JobSchedule `json:"schedule,omitempty"` + Schedule *JobSchedule // READ-ONLY; The job version number. - Version *int32 `json:"version,omitempty" azure:"ro"` + Version *int32 } // JobSchedule - Scheduling properties of a job. type JobSchedule struct { // Whether or not the schedule is enabled. - Enabled *bool `json:"enabled,omitempty"` + Enabled *bool // Schedule end time. - EndTime *time.Time `json:"endTime,omitempty"` + EndTime *time.Time // Value of the schedule's recurring interval, if the ScheduleType is recurring. ISO8601 duration format. - Interval *string `json:"interval,omitempty"` + Interval *string // Schedule start time. - StartTime *time.Time `json:"startTime,omitempty"` + StartTime *time.Time // Schedule interval type - Type *JobScheduleType `json:"type,omitempty"` + Type *JobScheduleType } // JobStep - A job step. type JobStep struct { // Resource properties. - Properties *JobStepProperties `json:"properties,omitempty"` + Properties *JobStepProperties // READ-ONLY; Resource ID. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; Resource name. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // JobStepAction - The action to be executed by a job step. type JobStepAction struct { // REQUIRED; The action value, for example the text of the T-SQL script to execute. - Value *string `json:"value,omitempty"` + Value *string // The source of the action to execute. - Source *JobStepActionSource `json:"source,omitempty"` + Source *JobStepActionSource // Type of action being executed by the job step. - Type *JobStepActionType `json:"type,omitempty"` + Type *JobStepActionType } // JobStepExecutionOptions - The execution options of a job step. type JobStepExecutionOptions struct { // Initial delay between retries for job step execution. - InitialRetryIntervalSeconds *int32 `json:"initialRetryIntervalSeconds,omitempty"` + InitialRetryIntervalSeconds *int32 // The maximum amount of time to wait between retries for job step execution. - MaximumRetryIntervalSeconds *int32 `json:"maximumRetryIntervalSeconds,omitempty"` + MaximumRetryIntervalSeconds *int32 // Maximum number of times the job step will be reattempted if the first attempt fails. - RetryAttempts *int32 `json:"retryAttempts,omitempty"` + RetryAttempts *int32 // The backoff multiplier for the time between retries. - RetryIntervalBackoffMultiplier *float32 `json:"retryIntervalBackoffMultiplier,omitempty"` + RetryIntervalBackoffMultiplier *float32 // Execution timeout for the job step. - TimeoutSeconds *int32 `json:"timeoutSeconds,omitempty"` -} - -// JobStepExecutionsClientGetOptions contains the optional parameters for the JobStepExecutionsClient.Get method. -type JobStepExecutionsClientGetOptions struct { - // placeholder for future optional parameters -} - -// JobStepExecutionsClientListByJobExecutionOptions contains the optional parameters for the JobStepExecutionsClient.NewListByJobExecutionPager -// method. -type JobStepExecutionsClientListByJobExecutionOptions struct { - // If specified, only job executions created before the specified time are included. - CreateTimeMax *time.Time - // If specified, only job executions created at or after the specified time are included. - CreateTimeMin *time.Time - // If specified, only job executions completed before the specified time are included. - EndTimeMax *time.Time - // If specified, only job executions completed at or after the specified time are included. - EndTimeMin *time.Time - // If specified, only active or only completed job executions are included. - IsActive *bool - // The number of elements in the collection to skip. - Skip *int32 - // The number of elements to return from the collection. - Top *int32 + TimeoutSeconds *int32 } // JobStepListResult - A list of job steps. type JobStepListResult struct { // READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` + NextLink *string // READ-ONLY; Array of results. - Value []*JobStep `json:"value,omitempty" azure:"ro"` + Value []*JobStep } // JobStepOutput - The output configuration of a job step. type JobStepOutput struct { // REQUIRED; The resource ID of the credential to use to connect to the output destination. - Credential *string `json:"credential,omitempty"` + Credential *string // REQUIRED; The output destination database. - DatabaseName *string `json:"databaseName,omitempty"` + DatabaseName *string // REQUIRED; The output destination server name. - ServerName *string `json:"serverName,omitempty"` + ServerName *string // REQUIRED; The output destination table. - TableName *string `json:"tableName,omitempty"` + TableName *string // The output destination resource group. - ResourceGroupName *string `json:"resourceGroupName,omitempty"` + ResourceGroupName *string // The output destination schema. - SchemaName *string `json:"schemaName,omitempty"` + SchemaName *string // The output destination subscription id. - SubscriptionID *string `json:"subscriptionId,omitempty"` + SubscriptionID *string // The output destination type. - Type *JobStepOutputType `json:"type,omitempty"` + Type *JobStepOutputType } // JobStepProperties - Properties of a job step. type JobStepProperties struct { // REQUIRED; The action payload of the job step. - Action *JobStepAction `json:"action,omitempty"` + Action *JobStepAction // REQUIRED; The resource ID of the job credential that will be used to connect to the targets. - Credential *string `json:"credential,omitempty"` + Credential *string // REQUIRED; The resource ID of the target group that the job step will be executed on. - TargetGroup *string `json:"targetGroup,omitempty"` + TargetGroup *string // Execution options for the job step. - ExecutionOptions *JobStepExecutionOptions `json:"executionOptions,omitempty"` + ExecutionOptions *JobStepExecutionOptions // Output destination properties of the job step. - Output *JobStepOutput `json:"output,omitempty"` + Output *JobStepOutput // The job step's index within the job. If not specified when creating the job step, it will be created as the last step. // If not specified when updating the job step, the step id is not modified. - StepID *int32 `json:"stepId,omitempty"` -} - -// JobStepsClientCreateOrUpdateOptions contains the optional parameters for the JobStepsClient.CreateOrUpdate method. -type JobStepsClientCreateOrUpdateOptions struct { - // placeholder for future optional parameters -} - -// JobStepsClientDeleteOptions contains the optional parameters for the JobStepsClient.Delete method. -type JobStepsClientDeleteOptions struct { - // placeholder for future optional parameters -} - -// JobStepsClientGetByVersionOptions contains the optional parameters for the JobStepsClient.GetByVersion method. -type JobStepsClientGetByVersionOptions struct { - // placeholder for future optional parameters -} - -// JobStepsClientGetOptions contains the optional parameters for the JobStepsClient.Get method. -type JobStepsClientGetOptions struct { - // placeholder for future optional parameters -} - -// JobStepsClientListByJobOptions contains the optional parameters for the JobStepsClient.NewListByJobPager method. -type JobStepsClientListByJobOptions struct { - // placeholder for future optional parameters -} - -// JobStepsClientListByVersionOptions contains the optional parameters for the JobStepsClient.NewListByVersionPager method. -type JobStepsClientListByVersionOptions struct { - // placeholder for future optional parameters + StepID *int32 } // JobTarget - A job target, for example a specific database or a container of databases that is evaluated during job execution. type JobTarget struct { // REQUIRED; The target type. - Type *JobTargetType `json:"type,omitempty"` + Type *JobTargetType // The target database name. - DatabaseName *string `json:"databaseName,omitempty"` + DatabaseName *string // The target elastic pool name. - ElasticPoolName *string `json:"elasticPoolName,omitempty"` + ElasticPoolName *string // Whether the target is included or excluded from the group. - MembershipType *JobTargetGroupMembershipType `json:"membershipType,omitempty"` + MembershipType *JobTargetGroupMembershipType // The resource ID of the credential that is used during job execution to connect to the target and determine the list of // databases inside the target. - RefreshCredential *string `json:"refreshCredential,omitempty"` + RefreshCredential *string // The target server name. - ServerName *string `json:"serverName,omitempty"` + ServerName *string // The target shard map. - ShardMapName *string `json:"shardMapName,omitempty"` -} - -// JobTargetExecutionsClientGetOptions contains the optional parameters for the JobTargetExecutionsClient.Get method. -type JobTargetExecutionsClientGetOptions struct { - // placeholder for future optional parameters -} - -// JobTargetExecutionsClientListByJobExecutionOptions contains the optional parameters for the JobTargetExecutionsClient.NewListByJobExecutionPager -// method. -type JobTargetExecutionsClientListByJobExecutionOptions struct { - // If specified, only job executions created before the specified time are included. - CreateTimeMax *time.Time - // If specified, only job executions created at or after the specified time are included. - CreateTimeMin *time.Time - // If specified, only job executions completed before the specified time are included. - EndTimeMax *time.Time - // If specified, only job executions completed at or after the specified time are included. - EndTimeMin *time.Time - // If specified, only active or only completed job executions are included. - IsActive *bool - // The number of elements in the collection to skip. - Skip *int32 - // The number of elements to return from the collection. - Top *int32 -} - -// JobTargetExecutionsClientListByStepOptions contains the optional parameters for the JobTargetExecutionsClient.NewListByStepPager -// method. -type JobTargetExecutionsClientListByStepOptions struct { - // If specified, only job executions created before the specified time are included. - CreateTimeMax *time.Time - // If specified, only job executions created at or after the specified time are included. - CreateTimeMin *time.Time - // If specified, only job executions completed before the specified time are included. - EndTimeMax *time.Time - // If specified, only job executions completed at or after the specified time are included. - EndTimeMin *time.Time - // If specified, only active or only completed job executions are included. - IsActive *bool - // The number of elements in the collection to skip. - Skip *int32 - // The number of elements to return from the collection. - Top *int32 + ShardMapName *string } // JobTargetGroup - A group of job targets. type JobTargetGroup struct { // Resource properties. - Properties *JobTargetGroupProperties `json:"properties,omitempty"` + Properties *JobTargetGroupProperties // READ-ONLY; Resource ID. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; Resource name. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // JobTargetGroupListResult - A list of target groups. type JobTargetGroupListResult struct { // READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` + NextLink *string // READ-ONLY; Array of results. - Value []*JobTargetGroup `json:"value,omitempty" azure:"ro"` + Value []*JobTargetGroup } // JobTargetGroupProperties - Properties of job target group. type JobTargetGroupProperties struct { // REQUIRED; Members of the target group. - Members []*JobTarget `json:"members,omitempty"` -} - -// JobTargetGroupsClientCreateOrUpdateOptions contains the optional parameters for the JobTargetGroupsClient.CreateOrUpdate -// method. -type JobTargetGroupsClientCreateOrUpdateOptions struct { - // placeholder for future optional parameters -} - -// JobTargetGroupsClientDeleteOptions contains the optional parameters for the JobTargetGroupsClient.Delete method. -type JobTargetGroupsClientDeleteOptions struct { - // placeholder for future optional parameters -} - -// JobTargetGroupsClientGetOptions contains the optional parameters for the JobTargetGroupsClient.Get method. -type JobTargetGroupsClientGetOptions struct { - // placeholder for future optional parameters -} - -// JobTargetGroupsClientListByAgentOptions contains the optional parameters for the JobTargetGroupsClient.NewListByAgentPager -// method. -type JobTargetGroupsClientListByAgentOptions struct { - // placeholder for future optional parameters + Members []*JobTarget } // JobVersion - A job version. type JobVersion struct { // READ-ONLY; Resource ID. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; Resource name. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // JobVersionListResult - A list of job versions. type JobVersionListResult struct { // READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` + NextLink *string // READ-ONLY; Array of results. - Value []*JobVersion `json:"value,omitempty" azure:"ro"` -} - -// JobVersionsClientGetOptions contains the optional parameters for the JobVersionsClient.Get method. -type JobVersionsClientGetOptions struct { - // placeholder for future optional parameters -} - -// JobVersionsClientListByJobOptions contains the optional parameters for the JobVersionsClient.NewListByJobPager method. -type JobVersionsClientListByJobOptions struct { - // placeholder for future optional parameters -} - -// JobsClientCreateOrUpdateOptions contains the optional parameters for the JobsClient.CreateOrUpdate method. -type JobsClientCreateOrUpdateOptions struct { - // placeholder for future optional parameters -} - -// JobsClientDeleteOptions contains the optional parameters for the JobsClient.Delete method. -type JobsClientDeleteOptions struct { - // placeholder for future optional parameters -} - -// JobsClientGetOptions contains the optional parameters for the JobsClient.Get method. -type JobsClientGetOptions struct { - // placeholder for future optional parameters -} - -// JobsClientListByAgentOptions contains the optional parameters for the JobsClient.NewListByAgentPager method. -type JobsClientListByAgentOptions struct { - // placeholder for future optional parameters + Value []*JobVersion } // LedgerDigestUploads - Azure SQL Database ledger digest upload settings. type LedgerDigestUploads struct { // Resource properties. - Properties *LedgerDigestUploadsProperties `json:"properties,omitempty"` + Properties *LedgerDigestUploadsProperties // READ-ONLY; Resource ID. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; Resource name. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` -} - -// LedgerDigestUploadsClientBeginCreateOrUpdateOptions contains the optional parameters for the LedgerDigestUploadsClient.BeginCreateOrUpdate -// method. -type LedgerDigestUploadsClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// LedgerDigestUploadsClientBeginDisableOptions contains the optional parameters for the LedgerDigestUploadsClient.BeginDisable -// method. -type LedgerDigestUploadsClientBeginDisableOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// LedgerDigestUploadsClientGetOptions contains the optional parameters for the LedgerDigestUploadsClient.Get method. -type LedgerDigestUploadsClientGetOptions struct { - // placeholder for future optional parameters -} - -// LedgerDigestUploadsClientListByDatabaseOptions contains the optional parameters for the LedgerDigestUploadsClient.NewListByDatabasePager -// method. -type LedgerDigestUploadsClientListByDatabaseOptions struct { - // placeholder for future optional parameters + Type *string } // LedgerDigestUploadsListResult - A list of ledger digest upload settings. type LedgerDigestUploadsListResult struct { // READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` + NextLink *string // READ-ONLY; Array of results. - Value []*LedgerDigestUploads `json:"value,omitempty" azure:"ro"` + Value []*LedgerDigestUploads } // LedgerDigestUploadsProperties - The properties of a database ledger digest upload settings. type LedgerDigestUploadsProperties struct { // The digest storage endpoint, which must be either an Azure blob storage endpoint or an URI for Azure Confidential Ledger. - DigestStorageEndpoint *string `json:"digestStorageEndpoint,omitempty"` + DigestStorageEndpoint *string // READ-ONLY; Specifies the state of ledger digest upload. - State *LedgerDigestUploadsState `json:"state,omitempty" azure:"ro"` + State *LedgerDigestUploadsState } // LicenseTypeCapability - The license type capability type LicenseTypeCapability struct { // The reason for the capability not being available. - Reason *string `json:"reason,omitempty"` + Reason *string // READ-ONLY; License type identifier. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; The status of the capability. - Status *CapabilityStatus `json:"status,omitempty" azure:"ro"` + Status *CapabilityStatus } // LocationCapabilities - The location capability. type LocationCapabilities struct { // The reason for the capability not being available. - Reason *string `json:"reason,omitempty"` + Reason *string // READ-ONLY; The location name. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; The status of the capability. - Status *CapabilityStatus `json:"status,omitempty" azure:"ro"` + Status *CapabilityStatus // READ-ONLY; The list of supported managed instance versions. - SupportedManagedInstanceVersions []*ManagedInstanceVersionCapability `json:"supportedManagedInstanceVersions,omitempty" azure:"ro"` + SupportedManagedInstanceVersions []*ManagedInstanceVersionCapability // READ-ONLY; The list of supported server versions. - SupportedServerVersions []*ServerVersionCapability `json:"supportedServerVersions,omitempty" azure:"ro"` + SupportedServerVersions []*ServerVersionCapability } // LogSizeCapability - The log size capability. type LogSizeCapability struct { // READ-ONLY; The log size limit (see 'unit' for the units). - Limit *int32 `json:"limit,omitempty" azure:"ro"` + Limit *int32 // READ-ONLY; The units that the limit is expressed in. - Unit *LogSizeUnit `json:"unit,omitempty" azure:"ro"` + Unit *LogSizeUnit } // LogicalDatabaseTransparentDataEncryption - A logical database transparent data encryption state. type LogicalDatabaseTransparentDataEncryption struct { // Resource properties. - Properties *TransparentDataEncryptionProperties `json:"properties,omitempty"` + Properties *TransparentDataEncryptionProperties // READ-ONLY; Resource ID. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; Resource name. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // LogicalDatabaseTransparentDataEncryptionListResult - A list of transparent data encryptions type LogicalDatabaseTransparentDataEncryptionListResult struct { // READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` + NextLink *string // READ-ONLY; Array of results. - Value []*LogicalDatabaseTransparentDataEncryption `json:"value,omitempty" azure:"ro"` + Value []*LogicalDatabaseTransparentDataEncryption } // LogicalServerAdvancedThreatProtectionListResult - A list of the server's Advanced Threat Protection configurations. type LogicalServerAdvancedThreatProtectionListResult struct { // READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` + NextLink *string // READ-ONLY; Array of results. - Value []*ServerAdvancedThreatProtection `json:"value,omitempty" azure:"ro"` + Value []*ServerAdvancedThreatProtection } // LogicalServerSecurityAlertPolicyListResult - A list of the server's security alert policies. type LogicalServerSecurityAlertPolicyListResult struct { // READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` + NextLink *string // READ-ONLY; Array of results. - Value []*ServerSecurityAlertPolicy `json:"value,omitempty" azure:"ro"` + Value []*ServerSecurityAlertPolicy } // LongTermRetentionBackup - A long term retention backup. type LongTermRetentionBackup struct { // Resource properties. - Properties *LongTermRetentionBackupProperties `json:"properties,omitempty"` + Properties *LongTermRetentionBackupProperties // READ-ONLY; Resource ID. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; Resource name. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // LongTermRetentionBackupListResult - A list of long term retention backups. type LongTermRetentionBackupListResult struct { // READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` + NextLink *string // READ-ONLY; Array of results. - Value []*LongTermRetentionBackup `json:"value,omitempty" azure:"ro"` + Value []*LongTermRetentionBackup } // LongTermRetentionBackupOperationResult - A LongTermRetentionBackup operation result resource. type LongTermRetentionBackupOperationResult struct { // Resource properties. - Properties *LongTermRetentionOperationResultProperties `json:"properties,omitempty"` + Properties *LongTermRetentionOperationResultProperties // READ-ONLY; Resource ID. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; Resource name. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // LongTermRetentionBackupProperties - Properties of a long term retention backup type LongTermRetentionBackupProperties struct { // The storage redundancy type of the backup - RequestedBackupStorageRedundancy *BackupStorageRedundancy `json:"requestedBackupStorageRedundancy,omitempty"` + RequestedBackupStorageRedundancy *BackupStorageRedundancy // READ-ONLY; The time the long term retention backup will expire. - BackupExpirationTime *time.Time `json:"backupExpirationTime,omitempty" azure:"ro"` + BackupExpirationTime *time.Time // READ-ONLY; The storage redundancy type of the backup - BackupStorageRedundancy *BackupStorageRedundancy `json:"backupStorageRedundancy,omitempty" azure:"ro"` + BackupStorageRedundancy *BackupStorageRedundancy // READ-ONLY; The time the backup was taken - BackupTime *time.Time `json:"backupTime,omitempty" azure:"ro"` + BackupTime *time.Time // READ-ONLY; The delete time of the database - DatabaseDeletionTime *time.Time `json:"databaseDeletionTime,omitempty" azure:"ro"` + DatabaseDeletionTime *time.Time // READ-ONLY; The name of the database the backup belong to - DatabaseName *string `json:"databaseName,omitempty" azure:"ro"` + DatabaseName *string // READ-ONLY; The create time of the server. - ServerCreateTime *time.Time `json:"serverCreateTime,omitempty" azure:"ro"` + ServerCreateTime *time.Time // READ-ONLY; The server name that the backup database belong to. - ServerName *string `json:"serverName,omitempty" azure:"ro"` + ServerName *string } -// LongTermRetentionBackupsClientBeginCopyByResourceGroupOptions contains the optional parameters for the LongTermRetentionBackupsClient.BeginCopyByResourceGroup -// method. -type LongTermRetentionBackupsClientBeginCopyByResourceGroupOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} +// LongTermRetentionOperationResultProperties - Contains the operation result properties for long term retention backup operation. +type LongTermRetentionOperationResultProperties struct { + // READ-ONLY; Source backup resource id + FromBackupResourceID *string -// LongTermRetentionBackupsClientBeginCopyOptions contains the optional parameters for the LongTermRetentionBackupsClient.BeginCopy -// method. -type LongTermRetentionBackupsClientBeginCopyOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} + // READ-ONLY; Progress message + Message *string -// LongTermRetentionBackupsClientBeginDeleteByResourceGroupOptions contains the optional parameters for the LongTermRetentionBackupsClient.BeginDeleteByResourceGroup -// method. -type LongTermRetentionBackupsClientBeginDeleteByResourceGroupOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// LongTermRetentionBackupsClientBeginDeleteOptions contains the optional parameters for the LongTermRetentionBackupsClient.BeginDelete -// method. -type LongTermRetentionBackupsClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// LongTermRetentionBackupsClientBeginUpdateByResourceGroupOptions contains the optional parameters for the LongTermRetentionBackupsClient.BeginUpdateByResourceGroup -// method. -type LongTermRetentionBackupsClientBeginUpdateByResourceGroupOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// LongTermRetentionBackupsClientBeginUpdateOptions contains the optional parameters for the LongTermRetentionBackupsClient.BeginUpdate -// method. -type LongTermRetentionBackupsClientBeginUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// LongTermRetentionBackupsClientGetByResourceGroupOptions contains the optional parameters for the LongTermRetentionBackupsClient.GetByResourceGroup -// method. -type LongTermRetentionBackupsClientGetByResourceGroupOptions struct { - // placeholder for future optional parameters -} - -// LongTermRetentionBackupsClientGetOptions contains the optional parameters for the LongTermRetentionBackupsClient.Get method. -type LongTermRetentionBackupsClientGetOptions struct { - // placeholder for future optional parameters -} - -// LongTermRetentionBackupsClientListByDatabaseOptions contains the optional parameters for the LongTermRetentionBackupsClient.NewListByDatabasePager -// method. -type LongTermRetentionBackupsClientListByDatabaseOptions struct { - // Whether to query against just live databases, just deleted databases, or all databases. - DatabaseState *DatabaseState - // Whether or not to only get the latest backup for each database. - OnlyLatestPerDatabase *bool -} - -// LongTermRetentionBackupsClientListByLocationOptions contains the optional parameters for the LongTermRetentionBackupsClient.NewListByLocationPager -// method. -type LongTermRetentionBackupsClientListByLocationOptions struct { - // Whether to query against just live databases, just deleted databases, or all databases. - DatabaseState *DatabaseState - // Whether or not to only get the latest backup for each database. - OnlyLatestPerDatabase *bool -} - -// LongTermRetentionBackupsClientListByResourceGroupDatabaseOptions contains the optional parameters for the LongTermRetentionBackupsClient.NewListByResourceGroupDatabasePager -// method. -type LongTermRetentionBackupsClientListByResourceGroupDatabaseOptions struct { - // Whether to query against just live databases, just deleted databases, or all databases. - DatabaseState *DatabaseState - // Whether or not to only get the latest backup for each database. - OnlyLatestPerDatabase *bool -} - -// LongTermRetentionBackupsClientListByResourceGroupLocationOptions contains the optional parameters for the LongTermRetentionBackupsClient.NewListByResourceGroupLocationPager -// method. -type LongTermRetentionBackupsClientListByResourceGroupLocationOptions struct { - // Whether to query against just live databases, just deleted databases, or all databases. - DatabaseState *DatabaseState - // Whether or not to only get the latest backup for each database. - OnlyLatestPerDatabase *bool -} - -// LongTermRetentionBackupsClientListByResourceGroupServerOptions contains the optional parameters for the LongTermRetentionBackupsClient.NewListByResourceGroupServerPager -// method. -type LongTermRetentionBackupsClientListByResourceGroupServerOptions struct { - // Whether to query against just live databases, just deleted databases, or all databases. - DatabaseState *DatabaseState - // Whether or not to only get the latest backup for each database. - OnlyLatestPerDatabase *bool -} - -// LongTermRetentionBackupsClientListByServerOptions contains the optional parameters for the LongTermRetentionBackupsClient.NewListByServerPager -// method. -type LongTermRetentionBackupsClientListByServerOptions struct { - // Whether to query against just live databases, just deleted databases, or all databases. - DatabaseState *DatabaseState - // Whether or not to only get the latest backup for each database. - OnlyLatestPerDatabase *bool -} - -// LongTermRetentionManagedInstanceBackupsClientBeginDeleteByResourceGroupOptions contains the optional parameters for the -// LongTermRetentionManagedInstanceBackupsClient.BeginDeleteByResourceGroup method. -type LongTermRetentionManagedInstanceBackupsClientBeginDeleteByResourceGroupOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// LongTermRetentionManagedInstanceBackupsClientBeginDeleteOptions contains the optional parameters for the LongTermRetentionManagedInstanceBackupsClient.BeginDelete -// method. -type LongTermRetentionManagedInstanceBackupsClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// LongTermRetentionManagedInstanceBackupsClientGetByResourceGroupOptions contains the optional parameters for the LongTermRetentionManagedInstanceBackupsClient.GetByResourceGroup -// method. -type LongTermRetentionManagedInstanceBackupsClientGetByResourceGroupOptions struct { - // placeholder for future optional parameters -} - -// LongTermRetentionManagedInstanceBackupsClientGetOptions contains the optional parameters for the LongTermRetentionManagedInstanceBackupsClient.Get -// method. -type LongTermRetentionManagedInstanceBackupsClientGetOptions struct { - // placeholder for future optional parameters -} - -// LongTermRetentionManagedInstanceBackupsClientListByDatabaseOptions contains the optional parameters for the LongTermRetentionManagedInstanceBackupsClient.NewListByDatabasePager -// method. -type LongTermRetentionManagedInstanceBackupsClientListByDatabaseOptions struct { - // Whether to query against just live databases, just deleted databases, or all databases. - DatabaseState *DatabaseState - // Whether or not to only get the latest backup for each database. - OnlyLatestPerDatabase *bool -} - -// LongTermRetentionManagedInstanceBackupsClientListByInstanceOptions contains the optional parameters for the LongTermRetentionManagedInstanceBackupsClient.NewListByInstancePager -// method. -type LongTermRetentionManagedInstanceBackupsClientListByInstanceOptions struct { - // Whether to query against just live databases, just deleted databases, or all databases. - DatabaseState *DatabaseState - // Whether or not to only get the latest backup for each database. - OnlyLatestPerDatabase *bool -} - -// LongTermRetentionManagedInstanceBackupsClientListByLocationOptions contains the optional parameters for the LongTermRetentionManagedInstanceBackupsClient.NewListByLocationPager -// method. -type LongTermRetentionManagedInstanceBackupsClientListByLocationOptions struct { - // Whether to query against just live databases, just deleted databases, or all databases. - DatabaseState *DatabaseState - // Whether or not to only get the latest backup for each database. - OnlyLatestPerDatabase *bool -} - -// LongTermRetentionManagedInstanceBackupsClientListByResourceGroupDatabaseOptions contains the optional parameters for the -// LongTermRetentionManagedInstanceBackupsClient.NewListByResourceGroupDatabasePager method. -type LongTermRetentionManagedInstanceBackupsClientListByResourceGroupDatabaseOptions struct { - // Whether to query against just live databases, just deleted databases, or all databases. - DatabaseState *DatabaseState - // Whether or not to only get the latest backup for each database. - OnlyLatestPerDatabase *bool -} - -// LongTermRetentionManagedInstanceBackupsClientListByResourceGroupInstanceOptions contains the optional parameters for the -// LongTermRetentionManagedInstanceBackupsClient.NewListByResourceGroupInstancePager method. -type LongTermRetentionManagedInstanceBackupsClientListByResourceGroupInstanceOptions struct { - // Whether to query against just live databases, just deleted databases, or all databases. - DatabaseState *DatabaseState - // Whether or not to only get the latest backup for each database. - OnlyLatestPerDatabase *bool -} - -// LongTermRetentionManagedInstanceBackupsClientListByResourceGroupLocationOptions contains the optional parameters for the -// LongTermRetentionManagedInstanceBackupsClient.NewListByResourceGroupLocationPager method. -type LongTermRetentionManagedInstanceBackupsClientListByResourceGroupLocationOptions struct { - // Whether to query against just live databases, just deleted databases, or all databases. - DatabaseState *DatabaseState - // Whether or not to only get the latest backup for each database. - OnlyLatestPerDatabase *bool -} - -// LongTermRetentionOperationResultProperties - Contains the operation result properties for long term retention backup operation. -type LongTermRetentionOperationResultProperties struct { - // READ-ONLY; Source backup resource id - FromBackupResourceID *string `json:"fromBackupResourceId,omitempty" azure:"ro"` - - // READ-ONLY; Progress message - Message *string `json:"message,omitempty" azure:"ro"` - - // READ-ONLY; Operation type. - OperationType *string `json:"operationType,omitempty" azure:"ro"` + // READ-ONLY; Operation type. + OperationType *string // READ-ONLY; Request Id. - RequestID *string `json:"requestId,omitempty" azure:"ro"` + RequestID *string // READ-ONLY; Operation status - Status *string `json:"status,omitempty" azure:"ro"` + Status *string // READ-ONLY; The storage redundancy type of the copied backup - TargetBackupStorageRedundancy *BackupStorageRedundancy `json:"targetBackupStorageRedundancy,omitempty" azure:"ro"` + TargetBackupStorageRedundancy *BackupStorageRedundancy // READ-ONLY; Target backup resource id - ToBackupResourceID *string `json:"toBackupResourceId,omitempty" azure:"ro"` -} - -// LongTermRetentionPoliciesClientBeginCreateOrUpdateOptions contains the optional parameters for the LongTermRetentionPoliciesClient.BeginCreateOrUpdate -// method. -type LongTermRetentionPoliciesClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// LongTermRetentionPoliciesClientGetOptions contains the optional parameters for the LongTermRetentionPoliciesClient.Get -// method. -type LongTermRetentionPoliciesClientGetOptions struct { - // placeholder for future optional parameters -} - -// LongTermRetentionPoliciesClientListByDatabaseOptions contains the optional parameters for the LongTermRetentionPoliciesClient.NewListByDatabasePager -// method. -type LongTermRetentionPoliciesClientListByDatabaseOptions struct { - // placeholder for future optional parameters + ToBackupResourceID *string } // LongTermRetentionPolicy - A long term retention policy. type LongTermRetentionPolicy struct { // Resource properties. - Properties *BaseLongTermRetentionPolicyProperties `json:"properties,omitempty"` + Properties *BaseLongTermRetentionPolicyProperties // READ-ONLY; Resource ID. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; Resource name. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // LongTermRetentionPolicyListResult - A list of long term retention policies. type LongTermRetentionPolicyListResult struct { // READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` + NextLink *string // READ-ONLY; Array of results. - Value []*LongTermRetentionPolicy `json:"value,omitempty" azure:"ro"` + Value []*LongTermRetentionPolicy } // MaintenanceConfigurationCapability - The maintenance configuration capability type MaintenanceConfigurationCapability struct { // The reason for the capability not being available. - Reason *string `json:"reason,omitempty"` + Reason *string // READ-ONLY; Maintenance configuration name - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; The status of the capability. - Status *CapabilityStatus `json:"status,omitempty" azure:"ro"` + Status *CapabilityStatus // READ-ONLY; Whether or not zone redundancy is supported for the maintenance configuration. - ZoneRedundant *bool `json:"zoneRedundant,omitempty" azure:"ro"` + ZoneRedundant *bool } // MaintenanceWindowOptions - Maintenance window options. type MaintenanceWindowOptions struct { // Resource properties. - Properties *MaintenanceWindowOptionsProperties `json:"properties,omitempty"` + Properties *MaintenanceWindowOptionsProperties // READ-ONLY; Resource ID. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; Resource name. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` -} - -// MaintenanceWindowOptionsClientGetOptions contains the optional parameters for the MaintenanceWindowOptionsClient.Get method. -type MaintenanceWindowOptionsClientGetOptions struct { - // placeholder for future optional parameters + Type *string } // MaintenanceWindowOptionsProperties - Maintenance window options properties. type MaintenanceWindowOptionsProperties struct { // Whether we allow multiple maintenance windows per cycle. - AllowMultipleMaintenanceWindowsPerCycle *bool `json:"allowMultipleMaintenanceWindowsPerCycle,omitempty"` + AllowMultipleMaintenanceWindowsPerCycle *bool // Default duration for maintenance window. - DefaultDurationInMinutes *int32 `json:"defaultDurationInMinutes,omitempty"` + DefaultDurationInMinutes *int32 // Whether maintenance windows are enabled for the database. - IsEnabled *bool `json:"isEnabled,omitempty"` + IsEnabled *bool // Available maintenance cycles e.g. {Saturday, 0, 4860}, {Wednesday, 0, 2460}. - MaintenanceWindowCycles []*MaintenanceWindowTimeRange `json:"maintenanceWindowCycles,omitempty"` + MaintenanceWindowCycles []*MaintenanceWindowTimeRange // Minimum number of maintenance windows cycles to be set on the database. - MinCycles *int32 `json:"minCycles,omitempty"` + MinCycles *int32 // Minimum duration of maintenance window. - MinDurationInMinutes *int32 `json:"minDurationInMinutes,omitempty"` + MinDurationInMinutes *int32 // Time granularity in minutes for maintenance windows. - TimeGranularityInMinutes *int32 `json:"timeGranularityInMinutes,omitempty"` + TimeGranularityInMinutes *int32 } // MaintenanceWindowTimeRange - Maintenance window time range. type MaintenanceWindowTimeRange struct { // Day of maintenance window. - DayOfWeek *DayOfWeek `json:"dayOfWeek,omitempty"` + DayOfWeek *DayOfWeek // Duration of maintenance window in minutes. - Duration *string `json:"duration,omitempty"` + Duration *string // Start time minutes offset from 12am. - StartTime *string `json:"startTime,omitempty"` + StartTime *string } // MaintenanceWindows - Maintenance windows. type MaintenanceWindows struct { // Resource properties. - Properties *MaintenanceWindowsProperties `json:"properties,omitempty"` + Properties *MaintenanceWindowsProperties // READ-ONLY; Resource ID. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; Resource name. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` -} - -// MaintenanceWindowsClientCreateOrUpdateOptions contains the optional parameters for the MaintenanceWindowsClient.CreateOrUpdate -// method. -type MaintenanceWindowsClientCreateOrUpdateOptions struct { - // placeholder for future optional parameters -} - -// MaintenanceWindowsClientGetOptions contains the optional parameters for the MaintenanceWindowsClient.Get method. -type MaintenanceWindowsClientGetOptions struct { - // placeholder for future optional parameters + Type *string } // MaintenanceWindowsProperties - Maintenance windows resource properties. type MaintenanceWindowsProperties struct { - TimeRanges []*MaintenanceWindowTimeRange `json:"timeRanges,omitempty"` -} - -// ManagedBackupShortTermRetentionPoliciesClientBeginCreateOrUpdateOptions contains the optional parameters for the ManagedBackupShortTermRetentionPoliciesClient.BeginCreateOrUpdate -// method. -type ManagedBackupShortTermRetentionPoliciesClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ManagedBackupShortTermRetentionPoliciesClientBeginUpdateOptions contains the optional parameters for the ManagedBackupShortTermRetentionPoliciesClient.BeginUpdate -// method. -type ManagedBackupShortTermRetentionPoliciesClientBeginUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ManagedBackupShortTermRetentionPoliciesClientGetOptions contains the optional parameters for the ManagedBackupShortTermRetentionPoliciesClient.Get -// method. -type ManagedBackupShortTermRetentionPoliciesClientGetOptions struct { - // placeholder for future optional parameters -} - -// ManagedBackupShortTermRetentionPoliciesClientListByDatabaseOptions contains the optional parameters for the ManagedBackupShortTermRetentionPoliciesClient.NewListByDatabasePager -// method. -type ManagedBackupShortTermRetentionPoliciesClientListByDatabaseOptions struct { - // placeholder for future optional parameters + TimeRanges []*MaintenanceWindowTimeRange } // ManagedBackupShortTermRetentionPolicy - A short term retention policy. type ManagedBackupShortTermRetentionPolicy struct { // Resource properties. - Properties *ManagedBackupShortTermRetentionPolicyProperties `json:"properties,omitempty"` + Properties *ManagedBackupShortTermRetentionPolicyProperties // READ-ONLY; Resource ID. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; Resource name. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // ManagedBackupShortTermRetentionPolicyListResult - A list of short term retention policies. type ManagedBackupShortTermRetentionPolicyListResult struct { // READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` + NextLink *string // READ-ONLY; Array of results. - Value []*ManagedBackupShortTermRetentionPolicy `json:"value,omitempty" azure:"ro"` + Value []*ManagedBackupShortTermRetentionPolicy } // ManagedBackupShortTermRetentionPolicyProperties - Properties of a short term retention policy type ManagedBackupShortTermRetentionPolicyProperties struct { // The backup retention period in days. This is how many days Point-in-Time Restore will be supported. - RetentionDays *int32 `json:"retentionDays,omitempty"` + RetentionDays *int32 } // ManagedDatabase - A managed database resource. type ManagedDatabase struct { // REQUIRED; Resource location. - Location *string `json:"location,omitempty"` + Location *string // Resource properties. - Properties *ManagedDatabaseProperties `json:"properties,omitempty"` + Properties *ManagedDatabaseProperties // Resource tags. - Tags map[string]*string `json:"tags,omitempty"` + Tags map[string]*string // READ-ONLY; Resource ID. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; Resource name. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } -// ManagedDatabaseColumnsClientGetOptions contains the optional parameters for the ManagedDatabaseColumnsClient.Get method. -type ManagedDatabaseColumnsClientGetOptions struct { - // placeholder for future optional parameters -} +// ManagedDatabaseAdvancedThreatProtection - A managed database Advanced Threat Protection. +type ManagedDatabaseAdvancedThreatProtection struct { + // Resource properties. + Properties *AdvancedThreatProtectionProperties -// ManagedDatabaseColumnsClientListByDatabaseOptions contains the optional parameters for the ManagedDatabaseColumnsClient.NewListByDatabasePager -// method. -type ManagedDatabaseColumnsClientListByDatabaseOptions struct { - Column []string - OrderBy []string - Schema []string - // An opaque token that identifies a starting point in the collection. - Skiptoken *string - Table []string + // READ-ONLY; Resource ID. + ID *string + + // READ-ONLY; Resource name. + Name *string + + // READ-ONLY; SystemData of AdvancedThreatProtectionResource. + SystemData *SystemData + + // READ-ONLY; Resource type. + Type *string } -// ManagedDatabaseColumnsClientListByTableOptions contains the optional parameters for the ManagedDatabaseColumnsClient.NewListByTablePager -// method. -type ManagedDatabaseColumnsClientListByTableOptions struct { - // An OData filter expression that filters elements in the collection. - Filter *string +// ManagedDatabaseAdvancedThreatProtectionListResult - A list of the managed database's Advanced Threat Protection settings. +type ManagedDatabaseAdvancedThreatProtectionListResult struct { + // READ-ONLY; Link to retrieve next page of results. + NextLink *string + + // READ-ONLY; Array of results. + Value []*ManagedDatabaseAdvancedThreatProtection } // ManagedDatabaseListResult - A list of managed databases. type ManagedDatabaseListResult struct { // READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` + NextLink *string // READ-ONLY; Array of results. - Value []*ManagedDatabase `json:"value,omitempty" azure:"ro"` + Value []*ManagedDatabase +} + +// ManagedDatabaseMoveDefinition - Contains the information necessary to perform a managed database move. +type ManagedDatabaseMoveDefinition struct { + // REQUIRED; The destination managed database ID + DestinationManagedDatabaseID *string +} + +// ManagedDatabaseMoveOperationListResult - List of managed database move operations. +type ManagedDatabaseMoveOperationListResult struct { + // READ-ONLY; Link to retrieve next page of results. + NextLink *string + + // READ-ONLY; Array of results. + Value []*ManagedDatabaseMoveOperationResult +} + +// ManagedDatabaseMoveOperationResult - A managed database move operation. +type ManagedDatabaseMoveOperationResult struct { + // Resource properties. + Properties *ManagedDatabaseMoveOperationResultProperties + + // READ-ONLY; Resource ID. + ID *string + + // READ-ONLY; Resource name. + Name *string + + // READ-ONLY; Resource type. + Type *string +} + +// ManagedDatabaseMoveOperationResultProperties - Contains the operation result properties for managed database move operation. +type ManagedDatabaseMoveOperationResultProperties struct { + // READ-ONLY; The operation error code. + ErrorCode *int32 + + // READ-ONLY; The operation error description. + ErrorDescription *string + + // READ-ONLY; The operation error severity. + ErrorSeverity *int32 + + // READ-ONLY; Is move operation cancellable. + IsCancellable *bool + + // READ-ONLY; Whether or not the error is a user error. + IsUserError *bool + + // READ-ONLY; The name of operation. + Operation *string + + // READ-ONLY; The friendly name of operation. + OperationFriendlyName *string + + // READ-ONLY; Operation mode. + OperationMode *MoveOperationMode + + // READ-ONLY; Source database name. + SourceDatabaseName *string + + // READ-ONLY; Source Managed Instance resource id. + SourceManagedInstanceID *string + + // READ-ONLY; Source Managed Instance name. + SourceManagedInstanceName *string + + // READ-ONLY; The operation start time. + StartTime *time.Time + + // READ-ONLY; The operation state. + State *ManagementOperationState + + // READ-ONLY; Target database name. + TargetDatabaseName *string + + // READ-ONLY; Target Managed instance resource id. + TargetManagedInstanceID *string + + // READ-ONLY; Target Managed Instance name. + TargetManagedInstanceName *string } // ManagedDatabaseProperties - The managed database's properties. type ManagedDatabaseProperties struct { // Whether to auto complete restore of this managed database. - AutoCompleteRestore *bool `json:"autoCompleteRestore,omitempty"` + AutoCompleteRestore *bool // Collation of the metadata catalog. - CatalogCollation *CatalogCollationType `json:"catalogCollation,omitempty"` + CatalogCollation *CatalogCollationType // Collation of the managed database. - Collation *string `json:"collation,omitempty"` + Collation *string // Managed database create mode. PointInTimeRestore: Create a database by restoring a point in time backup of an existing // database. SourceDatabaseName, SourceManagedInstanceName and PointInTime must be @@ -4874,1182 +3794,934 @@ type ManagedDatabaseProperties struct { // by restoring a geo-replicated backup. RecoverableDatabaseId must be specified as the recoverable database resource ID to // restore. RestoreLongTermRetentionBackup: Create a database by restoring from a // long term retention backup (longTermRetentionBackupResourceId required). - CreateMode *ManagedDatabaseCreateMode `json:"createMode,omitempty"` + CreateMode *ManagedDatabaseCreateMode + + // The restorable cross-subscription dropped database resource id to restore when creating this database. + CrossSubscriptionRestorableDroppedDatabaseID *string + + // The resource identifier of the cross-subscription source database associated with create operation of this database. + CrossSubscriptionSourceDatabaseID *string + + // Target managed instance id used in cross-subscription restore. + CrossSubscriptionTargetManagedInstanceID *string + + // Whether or not this database is a ledger database, which means all tables in the database are ledger tables. Note: the + // value of this property cannot be changed after the database has been created. + IsLedgerOn *bool // Last backup file name for restore of this managed database. - LastBackupName *string `json:"lastBackupName,omitempty"` + LastBackupName *string // The name of the Long Term Retention backup to be used for restore of this managed database. - LongTermRetentionBackupResourceID *string `json:"longTermRetentionBackupResourceId,omitempty"` + LongTermRetentionBackupResourceID *string // The resource identifier of the recoverable database associated with create operation of this database. - RecoverableDatabaseID *string `json:"recoverableDatabaseId,omitempty"` + RecoverableDatabaseID *string // The restorable dropped database resource id to restore when creating this database. - RestorableDroppedDatabaseID *string `json:"restorableDroppedDatabaseId,omitempty"` + RestorableDroppedDatabaseID *string // 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. - RestorePointInTime *time.Time `json:"restorePointInTime,omitempty"` + RestorePointInTime *time.Time // The resource identifier of the source database associated with create operation of this database. - SourceDatabaseID *string `json:"sourceDatabaseId,omitempty"` + SourceDatabaseID *string - // Conditional. If createMode is RestoreExternalBackup, this value is required. Specifies the storage container sas token. - StorageContainerSasToken *string `json:"storageContainerSasToken,omitempty"` + // Conditional. If createMode is RestoreExternalBackup, this value is used. Specifies the identity used for storage container + // authentication. Can be 'SharedAccessSignature' or 'ManagedIdentity'; if not + // specified 'SharedAccessSignature' is assumed. + StorageContainerIdentity *string + + // Conditional. If createMode is RestoreExternalBackup and storageContainerIdentity is not ManagedIdentity, this value is + // required. Specifies the storage container sas token. + StorageContainerSasToken *string // Conditional. If createMode is RestoreExternalBackup, this value is required. Specifies the uri of the storage container // where backups for this restore are stored. - StorageContainerURI *string `json:"storageContainerUri,omitempty"` + StorageContainerURI *string // READ-ONLY; Creation date of the database. - CreationDate *time.Time `json:"creationDate,omitempty" azure:"ro"` + CreationDate *time.Time // READ-ONLY; Geo paired region. - DefaultSecondaryLocation *string `json:"defaultSecondaryLocation,omitempty" azure:"ro"` + DefaultSecondaryLocation *string // READ-ONLY; Earliest restore point in time for point in time restore. - EarliestRestorePoint *time.Time `json:"earliestRestorePoint,omitempty" azure:"ro"` + EarliestRestorePoint *time.Time // READ-ONLY; Instance Failover Group resource identifier that this managed database belongs to. - FailoverGroupID *string `json:"failoverGroupId,omitempty" azure:"ro"` + FailoverGroupID *string // READ-ONLY; Status of the database. - Status *ManagedDatabaseStatus `json:"status,omitempty" azure:"ro"` + Status *ManagedDatabaseStatus } -// ManagedDatabaseQueriesClientGetOptions contains the optional parameters for the ManagedDatabaseQueriesClient.Get method. -type ManagedDatabaseQueriesClientGetOptions struct { - // placeholder for future optional parameters -} +// ManagedDatabaseRestoreDetailsBackupSetProperties - The managed database's restore details backup set properties. +type ManagedDatabaseRestoreDetailsBackupSetProperties struct { + // READ-ONLY; Backup size. + BackupSizeMB *int32 -// ManagedDatabaseQueriesClientListByQueryOptions contains the optional parameters for the ManagedDatabaseQueriesClient.NewListByQueryPager -// method. -type ManagedDatabaseQueriesClientListByQueryOptions struct { - // End time for observed period. - EndTime *string - // The time step to be used to summarize the metric values. - Interval *QueryTimeGrainType - // Start time for observed period. - StartTime *string -} + // READ-ONLY; First stripe name. + FirstStripeName *string -// ManagedDatabaseRecommendedSensitivityLabelsClientUpdateOptions contains the optional parameters for the ManagedDatabaseRecommendedSensitivityLabelsClient.Update -// method. -type ManagedDatabaseRecommendedSensitivityLabelsClientUpdateOptions struct { - // placeholder for future optional parameters -} + // READ-ONLY; Number of stripes. + NumberOfStripes *int32 + + // READ-ONLY; Last restored file time. + RestoreFinishedTimestampUTC *time.Time + + // READ-ONLY; Last restored file time. + RestoreStartedTimestampUTC *time.Time -// ManagedDatabaseRestoreDetailsClientGetOptions contains the optional parameters for the ManagedDatabaseRestoreDetailsClient.Get -// method. -type ManagedDatabaseRestoreDetailsClientGetOptions struct { - // placeholder for future optional parameters + // READ-ONLY; Backup set status. + Status *string } // ManagedDatabaseRestoreDetailsProperties - The managed database's restore details properties. type ManagedDatabaseRestoreDetailsProperties struct { // READ-ONLY; The reason why restore is in Blocked state. - BlockReason *string `json:"blockReason,omitempty" azure:"ro"` + BlockReason *string + + // READ-ONLY; Current backup type. + CurrentBackupType *string + + // READ-ONLY; Current restore plan size MB. + CurrentRestorePlanSizeMB *int32 + + // READ-ONLY; Current restored size MB. + CurrentRestoredSizeMB *int32 // READ-ONLY; Current restoring file name. - CurrentRestoringFileName *string `json:"currentRestoringFileName,omitempty" azure:"ro"` + CurrentRestoringFileName *string + + // READ-ONLY; Diff backup sets. + DiffBackupSets []*ManagedDatabaseRestoreDetailsBackupSetProperties + + // READ-ONLY; Full backup sets. + FullBackupSets []*ManagedDatabaseRestoreDetailsBackupSetProperties // READ-ONLY; Last restored file name. - LastRestoredFileName *string `json:"lastRestoredFileName,omitempty" azure:"ro"` + LastRestoredFileName *string // READ-ONLY; Last restored file time. - LastRestoredFileTime *time.Time `json:"lastRestoredFileTime,omitempty" azure:"ro"` + LastRestoredFileTime *time.Time // READ-ONLY; Last uploaded file name. - LastUploadedFileName *string `json:"lastUploadedFileName,omitempty" azure:"ro"` + LastUploadedFileName *string // READ-ONLY; Last uploaded file time. - LastUploadedFileTime *time.Time `json:"lastUploadedFileTime,omitempty" azure:"ro"` + LastUploadedFileTime *time.Time + + // READ-ONLY; Log backup sets. + LogBackupSets []*ManagedDatabaseRestoreDetailsBackupSetProperties // READ-ONLY; Number of files detected. - NumberOfFilesDetected *int64 `json:"numberOfFilesDetected,omitempty" azure:"ro"` + NumberOfFilesDetected *int32 + + // READ-ONLY; Number of files queued. + NumberOfFilesQueued *int32 + + // READ-ONLY; Number of files restored. + NumberOfFilesRestored *int32 + + // READ-ONLY; Number of files restoring. + NumberOfFilesRestoring *int32 + + // READ-ONLY; Number of files skipped. + NumberOfFilesSkipped *int32 + + // READ-ONLY; Number of files unrestorable. + NumberOfFilesUnrestorable *int32 // READ-ONLY; Percent completed. - PercentCompleted *float64 `json:"percentCompleted,omitempty" azure:"ro"` + PercentCompleted *int32 // READ-ONLY; Restore status. - Status *string `json:"status,omitempty" azure:"ro"` + Status *string + + // READ-ONLY; Restore type. + Type *string - // READ-ONLY; List of unrestorable files. - UnrestorableFiles []*string `json:"unrestorableFiles,omitempty" azure:"ro"` + // READ-ONLY; Unrestorable files. + UnrestorableFiles []*ManagedDatabaseRestoreDetailsUnrestorableFileProperties } // ManagedDatabaseRestoreDetailsResult - A managed database restore details. type ManagedDatabaseRestoreDetailsResult struct { // Resource properties. - Properties *ManagedDatabaseRestoreDetailsProperties `json:"properties,omitempty"` + Properties *ManagedDatabaseRestoreDetailsProperties // READ-ONLY; Resource ID. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; Resource name. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } -// ManagedDatabaseSchemasClientGetOptions contains the optional parameters for the ManagedDatabaseSchemasClient.Get method. -type ManagedDatabaseSchemasClientGetOptions struct { - // placeholder for future optional parameters -} - -// ManagedDatabaseSchemasClientListByDatabaseOptions contains the optional parameters for the ManagedDatabaseSchemasClient.NewListByDatabasePager -// method. -type ManagedDatabaseSchemasClientListByDatabaseOptions struct { - // An OData filter expression that filters elements in the collection. - Filter *string -} - -// ManagedDatabaseSecurityAlertPoliciesClientCreateOrUpdateOptions contains the optional parameters for the ManagedDatabaseSecurityAlertPoliciesClient.CreateOrUpdate -// method. -type ManagedDatabaseSecurityAlertPoliciesClientCreateOrUpdateOptions struct { - // placeholder for future optional parameters -} - -// ManagedDatabaseSecurityAlertPoliciesClientGetOptions contains the optional parameters for the ManagedDatabaseSecurityAlertPoliciesClient.Get -// method. -type ManagedDatabaseSecurityAlertPoliciesClientGetOptions struct { - // placeholder for future optional parameters -} - -// ManagedDatabaseSecurityAlertPoliciesClientListByDatabaseOptions contains the optional parameters for the ManagedDatabaseSecurityAlertPoliciesClient.NewListByDatabasePager -// method. -type ManagedDatabaseSecurityAlertPoliciesClientListByDatabaseOptions struct { - // placeholder for future optional parameters +// ManagedDatabaseRestoreDetailsUnrestorableFileProperties - The managed database's restore details unrestorable file properties. +type ManagedDatabaseRestoreDetailsUnrestorableFileProperties struct { + // READ-ONLY; File name. + Name *string } // ManagedDatabaseSecurityAlertPolicy - A managed database security alert policy. type ManagedDatabaseSecurityAlertPolicy struct { // Resource properties. - Properties *SecurityAlertPolicyProperties `json:"properties,omitempty"` + Properties *SecurityAlertPolicyProperties // READ-ONLY; Resource ID. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; Resource name. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // ManagedDatabaseSecurityAlertPolicyListResult - A list of the managed database's security alert policies. type ManagedDatabaseSecurityAlertPolicyListResult struct { // READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` + NextLink *string // READ-ONLY; Array of results. - Value []*ManagedDatabaseSecurityAlertPolicy `json:"value,omitempty" azure:"ro"` -} - -// ManagedDatabaseSecurityEventsClientListByDatabaseOptions contains the optional parameters for the ManagedDatabaseSecurityEventsClient.NewListByDatabasePager -// method. -type ManagedDatabaseSecurityEventsClientListByDatabaseOptions struct { - // An OData filter expression that filters elements in the collection. - Filter *string - // The number of elements in the collection to skip. - Skip *int32 - // An opaque token that identifies a starting point in the collection. - Skiptoken *string - // The number of elements to return from the collection. - Top *int32 -} - -// ManagedDatabaseSensitivityLabelsClientCreateOrUpdateOptions contains the optional parameters for the ManagedDatabaseSensitivityLabelsClient.CreateOrUpdate -// method. -type ManagedDatabaseSensitivityLabelsClientCreateOrUpdateOptions struct { - // placeholder for future optional parameters -} - -// ManagedDatabaseSensitivityLabelsClientDeleteOptions contains the optional parameters for the ManagedDatabaseSensitivityLabelsClient.Delete -// method. -type ManagedDatabaseSensitivityLabelsClientDeleteOptions struct { - // placeholder for future optional parameters -} - -// ManagedDatabaseSensitivityLabelsClientDisableRecommendationOptions contains the optional parameters for the ManagedDatabaseSensitivityLabelsClient.DisableRecommendation -// method. -type ManagedDatabaseSensitivityLabelsClientDisableRecommendationOptions struct { - // placeholder for future optional parameters -} - -// ManagedDatabaseSensitivityLabelsClientEnableRecommendationOptions contains the optional parameters for the ManagedDatabaseSensitivityLabelsClient.EnableRecommendation -// method. -type ManagedDatabaseSensitivityLabelsClientEnableRecommendationOptions struct { - // placeholder for future optional parameters -} - -// ManagedDatabaseSensitivityLabelsClientGetOptions contains the optional parameters for the ManagedDatabaseSensitivityLabelsClient.Get -// method. -type ManagedDatabaseSensitivityLabelsClientGetOptions struct { - // placeholder for future optional parameters + Value []*ManagedDatabaseSecurityAlertPolicy } -// ManagedDatabaseSensitivityLabelsClientListCurrentByDatabaseOptions contains the optional parameters for the ManagedDatabaseSensitivityLabelsClient.NewListCurrentByDatabasePager -// method. -type ManagedDatabaseSensitivityLabelsClientListCurrentByDatabaseOptions struct { - Count *bool - // An OData filter expression that filters elements in the collection. - Filter *string - SkipToken *string -} - -// ManagedDatabaseSensitivityLabelsClientListRecommendedByDatabaseOptions contains the optional parameters for the ManagedDatabaseSensitivityLabelsClient.NewListRecommendedByDatabasePager -// method. -type ManagedDatabaseSensitivityLabelsClientListRecommendedByDatabaseOptions struct { - // An OData filter expression that filters elements in the collection. - Filter *string - // Specifies whether to include disabled recommendations or not. - IncludeDisabledRecommendations *bool - SkipToken *string -} - -// ManagedDatabaseSensitivityLabelsClientUpdateOptions contains the optional parameters for the ManagedDatabaseSensitivityLabelsClient.Update -// method. -type ManagedDatabaseSensitivityLabelsClientUpdateOptions struct { - // placeholder for future optional parameters -} - -// ManagedDatabaseTablesClientGetOptions contains the optional parameters for the ManagedDatabaseTablesClient.Get method. -type ManagedDatabaseTablesClientGetOptions struct { - // placeholder for future optional parameters -} - -// ManagedDatabaseTablesClientListBySchemaOptions contains the optional parameters for the ManagedDatabaseTablesClient.NewListBySchemaPager -// method. -type ManagedDatabaseTablesClientListBySchemaOptions struct { - // An OData filter expression that filters elements in the collection. - Filter *string -} - -// ManagedDatabaseTransparentDataEncryptionClientCreateOrUpdateOptions contains the optional parameters for the ManagedDatabaseTransparentDataEncryptionClient.CreateOrUpdate -// method. -type ManagedDatabaseTransparentDataEncryptionClientCreateOrUpdateOptions struct { - // placeholder for future optional parameters -} - -// ManagedDatabaseTransparentDataEncryptionClientGetOptions contains the optional parameters for the ManagedDatabaseTransparentDataEncryptionClient.Get -// method. -type ManagedDatabaseTransparentDataEncryptionClientGetOptions struct { - // placeholder for future optional parameters -} +// ManagedDatabaseStartMoveDefinition - Contains the information necessary to start a managed database move. +type ManagedDatabaseStartMoveDefinition struct { + // REQUIRED; The destination managed database ID + DestinationManagedDatabaseID *string -// ManagedDatabaseTransparentDataEncryptionClientListByDatabaseOptions contains the optional parameters for the ManagedDatabaseTransparentDataEncryptionClient.NewListByDatabasePager -// method. -type ManagedDatabaseTransparentDataEncryptionClientListByDatabaseOptions struct { - // placeholder for future optional parameters + // The move operation mode. + OperationMode *MoveOperationMode } // ManagedDatabaseUpdate - An managed database update. type ManagedDatabaseUpdate struct { // Resource properties. - Properties *ManagedDatabaseProperties `json:"properties,omitempty"` + Properties *ManagedDatabaseProperties // Resource tags. - Tags map[string]*string `json:"tags,omitempty"` -} - -// ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClientCreateOrUpdateOptions contains the optional parameters for the -// ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient.CreateOrUpdate method. -type ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClientCreateOrUpdateOptions struct { - // placeholder for future optional parameters -} - -// ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClientDeleteOptions contains the optional parameters for the ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient.Delete -// method. -type ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClientDeleteOptions struct { - // placeholder for future optional parameters -} - -// ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClientGetOptions contains the optional parameters for the ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient.Get -// method. -type ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClientGetOptions struct { - // placeholder for future optional parameters -} - -// ManagedDatabaseVulnerabilityAssessmentScansClientBeginInitiateScanOptions contains the optional parameters for the ManagedDatabaseVulnerabilityAssessmentScansClient.BeginInitiateScan -// method. -type ManagedDatabaseVulnerabilityAssessmentScansClientBeginInitiateScanOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ManagedDatabaseVulnerabilityAssessmentScansClientExportOptions contains the optional parameters for the ManagedDatabaseVulnerabilityAssessmentScansClient.Export -// method. -type ManagedDatabaseVulnerabilityAssessmentScansClientExportOptions struct { - // placeholder for future optional parameters -} - -// ManagedDatabaseVulnerabilityAssessmentScansClientGetOptions contains the optional parameters for the ManagedDatabaseVulnerabilityAssessmentScansClient.Get -// method. -type ManagedDatabaseVulnerabilityAssessmentScansClientGetOptions struct { - // placeholder for future optional parameters -} - -// ManagedDatabaseVulnerabilityAssessmentScansClientListByDatabaseOptions contains the optional parameters for the ManagedDatabaseVulnerabilityAssessmentScansClient.NewListByDatabasePager -// method. -type ManagedDatabaseVulnerabilityAssessmentScansClientListByDatabaseOptions struct { - // placeholder for future optional parameters -} - -// ManagedDatabaseVulnerabilityAssessmentsClientCreateOrUpdateOptions contains the optional parameters for the ManagedDatabaseVulnerabilityAssessmentsClient.CreateOrUpdate -// method. -type ManagedDatabaseVulnerabilityAssessmentsClientCreateOrUpdateOptions struct { - // placeholder for future optional parameters -} - -// ManagedDatabaseVulnerabilityAssessmentsClientDeleteOptions contains the optional parameters for the ManagedDatabaseVulnerabilityAssessmentsClient.Delete -// method. -type ManagedDatabaseVulnerabilityAssessmentsClientDeleteOptions struct { - // placeholder for future optional parameters -} - -// ManagedDatabaseVulnerabilityAssessmentsClientGetOptions contains the optional parameters for the ManagedDatabaseVulnerabilityAssessmentsClient.Get -// method. -type ManagedDatabaseVulnerabilityAssessmentsClientGetOptions struct { - // placeholder for future optional parameters -} - -// ManagedDatabaseVulnerabilityAssessmentsClientListByDatabaseOptions contains the optional parameters for the ManagedDatabaseVulnerabilityAssessmentsClient.NewListByDatabasePager -// method. -type ManagedDatabaseVulnerabilityAssessmentsClientListByDatabaseOptions struct { - // placeholder for future optional parameters -} - -// ManagedDatabasesClientBeginCompleteRestoreOptions contains the optional parameters for the ManagedDatabasesClient.BeginCompleteRestore -// method. -type ManagedDatabasesClientBeginCompleteRestoreOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ManagedDatabasesClientBeginCreateOrUpdateOptions contains the optional parameters for the ManagedDatabasesClient.BeginCreateOrUpdate -// method. -type ManagedDatabasesClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ManagedDatabasesClientBeginDeleteOptions contains the optional parameters for the ManagedDatabasesClient.BeginDelete method. -type ManagedDatabasesClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ManagedDatabasesClientBeginUpdateOptions contains the optional parameters for the ManagedDatabasesClient.BeginUpdate method. -type ManagedDatabasesClientBeginUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ManagedDatabasesClientGetOptions contains the optional parameters for the ManagedDatabasesClient.Get method. -type ManagedDatabasesClientGetOptions struct { - // placeholder for future optional parameters -} - -// ManagedDatabasesClientListByInstanceOptions contains the optional parameters for the ManagedDatabasesClient.NewListByInstancePager -// method. -type ManagedDatabasesClientListByInstanceOptions struct { - // placeholder for future optional parameters -} - -// ManagedDatabasesClientListInaccessibleByInstanceOptions contains the optional parameters for the ManagedDatabasesClient.NewListInaccessibleByInstancePager -// method. -type ManagedDatabasesClientListInaccessibleByInstanceOptions struct { - // placeholder for future optional parameters + Tags map[string]*string } // ManagedInstance - An Azure SQL managed instance. type ManagedInstance struct { // REQUIRED; Resource location. - Location *string `json:"location,omitempty"` + Location *string // The Azure Active Directory identity of the managed instance. - Identity *ResourceIdentity `json:"identity,omitempty"` + Identity *ResourceIdentity // Resource properties. - Properties *ManagedInstanceProperties `json:"properties,omitempty"` + Properties *ManagedInstanceProperties - // Managed instance SKU. Allowed values for sku.name: GPGen4, GPGen5, BCGen4, BCGen5 - SKU *SKU `json:"sku,omitempty"` + // Managed instance SKU. Allowed values for sku.name: GPGen5, GPG8IM, GPG8IH, BCGen5, BCG8IM, BCG8IH + SKU *SKU // Resource tags. - Tags map[string]*string `json:"tags,omitempty"` + Tags map[string]*string // READ-ONLY; Resource ID. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; Resource name. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // ManagedInstanceAdministrator - An Azure SQL managed instance administrator. type ManagedInstanceAdministrator struct { // Resource properties. - Properties *ManagedInstanceAdministratorProperties `json:"properties,omitempty"` + Properties *ManagedInstanceAdministratorProperties // READ-ONLY; Resource ID. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; Resource name. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // ManagedInstanceAdministratorListResult - A list of managed instance administrators. type ManagedInstanceAdministratorListResult struct { // READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` + NextLink *string // READ-ONLY; Array of results. - Value []*ManagedInstanceAdministrator `json:"value,omitempty" azure:"ro"` + Value []*ManagedInstanceAdministrator } // ManagedInstanceAdministratorProperties - The properties of a managed instance administrator. type ManagedInstanceAdministratorProperties struct { // REQUIRED; Type of the managed instance administrator. - AdministratorType *ManagedInstanceAdministratorType `json:"administratorType,omitempty"` + AdministratorType *ManagedInstanceAdministratorType // REQUIRED; Login name of the managed instance administrator. - Login *string `json:"login,omitempty"` + Login *string // REQUIRED; SID (object ID) of the managed instance administrator. - Sid *string `json:"sid,omitempty"` + Sid *string // Tenant ID of the managed instance administrator. - TenantID *string `json:"tenantId,omitempty"` + TenantID *string } -// ManagedInstanceAdministratorsClientBeginCreateOrUpdateOptions contains the optional parameters for the ManagedInstanceAdministratorsClient.BeginCreateOrUpdate -// method. -type ManagedInstanceAdministratorsClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} +// ManagedInstanceAdvancedThreatProtection - A managed instance Advanced Threat Protection. +type ManagedInstanceAdvancedThreatProtection struct { + // Resource properties. + Properties *AdvancedThreatProtectionProperties -// ManagedInstanceAdministratorsClientBeginDeleteOptions contains the optional parameters for the ManagedInstanceAdministratorsClient.BeginDelete -// method. -type ManagedInstanceAdministratorsClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} + // READ-ONLY; Resource ID. + ID *string -// ManagedInstanceAdministratorsClientGetOptions contains the optional parameters for the ManagedInstanceAdministratorsClient.Get -// method. -type ManagedInstanceAdministratorsClientGetOptions struct { - // placeholder for future optional parameters + // READ-ONLY; Resource name. + Name *string + + // READ-ONLY; SystemData of AdvancedThreatProtectionResource. + SystemData *SystemData + + // READ-ONLY; Resource type. + Type *string } -// ManagedInstanceAdministratorsClientListByInstanceOptions contains the optional parameters for the ManagedInstanceAdministratorsClient.NewListByInstancePager -// method. -type ManagedInstanceAdministratorsClientListByInstanceOptions struct { - // placeholder for future optional parameters +// ManagedInstanceAdvancedThreatProtectionListResult - A list of the managed instance's Advanced Threat Protection settings. +type ManagedInstanceAdvancedThreatProtectionListResult struct { + // READ-ONLY; Link to retrieve next page of results. + NextLink *string + + // READ-ONLY; Array of results. + Value []*ManagedInstanceAdvancedThreatProtection } // ManagedInstanceAzureADOnlyAuthListResult - A list of active directory only authentications. type ManagedInstanceAzureADOnlyAuthListResult struct { // READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` + NextLink *string // READ-ONLY; Array of results. - Value []*ManagedInstanceAzureADOnlyAuthentication `json:"value,omitempty" azure:"ro"` + Value []*ManagedInstanceAzureADOnlyAuthentication } // ManagedInstanceAzureADOnlyAuthProperties - Properties of a active directory only authentication for Managed Instance. type ManagedInstanceAzureADOnlyAuthProperties struct { // REQUIRED; Azure Active Directory only Authentication enabled. - AzureADOnlyAuthentication *bool `json:"azureADOnlyAuthentication,omitempty"` + AzureADOnlyAuthentication *bool } // ManagedInstanceAzureADOnlyAuthentication - Azure Active Directory only authentication. type ManagedInstanceAzureADOnlyAuthentication struct { // Resource properties. - Properties *ManagedInstanceAzureADOnlyAuthProperties `json:"properties,omitempty"` + Properties *ManagedInstanceAzureADOnlyAuthProperties // READ-ONLY; Resource ID. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; Resource name. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } -// ManagedInstanceAzureADOnlyAuthenticationsClientBeginCreateOrUpdateOptions contains the optional parameters for the ManagedInstanceAzureADOnlyAuthenticationsClient.BeginCreateOrUpdate -// method. -type ManagedInstanceAzureADOnlyAuthenticationsClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string +// ManagedInstanceDtc - SQL Managed Instance DTC +type ManagedInstanceDtc struct { + // Resource properties. + Properties *ManagedInstanceDtcProperties + + // READ-ONLY; Resource ID. + ID *string + + // READ-ONLY; Resource name. + Name *string + + // READ-ONLY; Resource type. + Type *string } -// ManagedInstanceAzureADOnlyAuthenticationsClientBeginDeleteOptions contains the optional parameters for the ManagedInstanceAzureADOnlyAuthenticationsClient.BeginDelete -// method. -type ManagedInstanceAzureADOnlyAuthenticationsClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string +// ManagedInstanceDtcListResult - A list of managed instance's DTCs. +type ManagedInstanceDtcListResult struct { + // READ-ONLY; Link to retrieve next page of results. + NextLink *string + + // READ-ONLY; Array of results. + Value []*ManagedInstanceDtc } -// ManagedInstanceAzureADOnlyAuthenticationsClientGetOptions contains the optional parameters for the ManagedInstanceAzureADOnlyAuthenticationsClient.Get -// method. -type ManagedInstanceAzureADOnlyAuthenticationsClientGetOptions struct { - // placeholder for future optional parameters +// ManagedInstanceDtcProperties - The properties of managed instance DTC. +type ManagedInstanceDtcProperties struct { + // Active status of managed instance DTC. + DtcEnabled *bool + + // External dns suffix search list of managed instance DTC. + ExternalDNSSuffixSearchList []*string + + // Security settings of managed instance DTC. + SecuritySettings *ManagedInstanceDtcSecuritySettings + + // READ-ONLY; Host name dns suffix of managed instance DTC. + DtcHostNameDNSSuffix *string + + // READ-ONLY; Provisioning state of managed instance DTC. + ProvisioningState *ProvisioningState +} + +// ManagedInstanceDtcSecuritySettings - The Security Settings of managed instance DTC. +type ManagedInstanceDtcSecuritySettings struct { + // Allow SNA LU 6.2 Transactions to managed instance DTC. + SnaLu6Point2TransactionsEnabled *bool + + // Transaction Manager communication settings of managed instance DTC. + TransactionManagerCommunicationSettings *ManagedInstanceDtcTransactionManagerCommunicationSettings + + // Default timeout for XA Transactions (in seconds). + XaTransactionsDefaultTimeout *int32 + + // Allow XA Transactions to managed instance DTC. + XaTransactionsEnabled *bool + + // Maximum timeout for XA Transactions (in seconds). + XaTransactionsMaximumTimeout *int32 } -// ManagedInstanceAzureADOnlyAuthenticationsClientListByInstanceOptions contains the optional parameters for the ManagedInstanceAzureADOnlyAuthenticationsClient.NewListByInstancePager -// method. -type ManagedInstanceAzureADOnlyAuthenticationsClientListByInstanceOptions struct { - // placeholder for future optional parameters +// ManagedInstanceDtcTransactionManagerCommunicationSettings - The Transaction Manager Communication Settings of managed instance +// DTC. +type ManagedInstanceDtcTransactionManagerCommunicationSettings struct { + // Allow Inbound traffic to managed instance DTC. + AllowInboundEnabled *bool + + // Allow Outbound traffic of managed instance DTC. + AllowOutboundEnabled *bool + + // Authentication type of managed instance DTC. + Authentication *string } // ManagedInstanceEditionCapability - The managed server capability type ManagedInstanceEditionCapability struct { // The reason for the capability not being available. - Reason *string `json:"reason,omitempty"` + Reason *string // READ-ONLY; The managed server version name. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; The status of the capability. - Status *CapabilityStatus `json:"status,omitempty" azure:"ro"` + Status *CapabilityStatus // READ-ONLY; The supported families. - SupportedFamilies []*ManagedInstanceFamilyCapability `json:"supportedFamilies,omitempty" azure:"ro"` + SupportedFamilies []*ManagedInstanceFamilyCapability // READ-ONLY; The list of supported storage capabilities for this edition - SupportedStorageCapabilities []*StorageCapability `json:"supportedStorageCapabilities,omitempty" azure:"ro"` + SupportedStorageCapabilities []*StorageCapability // READ-ONLY; Whether or not zone redundancy is supported for the edition. - ZoneRedundant *bool `json:"zoneRedundant,omitempty" azure:"ro"` + ZoneRedundant *bool } // ManagedInstanceEncryptionProtector - The managed instance encryption protector. type ManagedInstanceEncryptionProtector struct { // Resource properties. - Properties *ManagedInstanceEncryptionProtectorProperties `json:"properties,omitempty"` + Properties *ManagedInstanceEncryptionProtectorProperties // READ-ONLY; Resource ID. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; Kind of encryption protector. This is metadata used for the Azure portal experience. - Kind *string `json:"kind,omitempty" azure:"ro"` + Kind *string // READ-ONLY; Resource name. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // ManagedInstanceEncryptionProtectorListResult - A list of managed instance encryption protectors. type ManagedInstanceEncryptionProtectorListResult struct { // READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` + NextLink *string // READ-ONLY; Array of results. - Value []*ManagedInstanceEncryptionProtector `json:"value,omitempty" azure:"ro"` + Value []*ManagedInstanceEncryptionProtector } // ManagedInstanceEncryptionProtectorProperties - Properties for an encryption protector execution. type ManagedInstanceEncryptionProtectorProperties struct { // REQUIRED; The encryption protector type like 'ServiceManaged', 'AzureKeyVault'. - ServerKeyType *ServerKeyType `json:"serverKeyType,omitempty"` + ServerKeyType *ServerKeyType // Key auto rotation opt-in flag. Either true or false. - AutoRotationEnabled *bool `json:"autoRotationEnabled,omitempty"` + AutoRotationEnabled *bool // The name of the managed instance key. - ServerKeyName *string `json:"serverKeyName,omitempty"` + ServerKeyName *string // READ-ONLY; Thumbprint of the server key. - Thumbprint *string `json:"thumbprint,omitempty" azure:"ro"` + Thumbprint *string // READ-ONLY; The URI of the server key. - URI *string `json:"uri,omitempty" azure:"ro"` -} - -// ManagedInstanceEncryptionProtectorsClientBeginCreateOrUpdateOptions contains the optional parameters for the ManagedInstanceEncryptionProtectorsClient.BeginCreateOrUpdate -// method. -type ManagedInstanceEncryptionProtectorsClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ManagedInstanceEncryptionProtectorsClientBeginRevalidateOptions contains the optional parameters for the ManagedInstanceEncryptionProtectorsClient.BeginRevalidate -// method. -type ManagedInstanceEncryptionProtectorsClientBeginRevalidateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ManagedInstanceEncryptionProtectorsClientGetOptions contains the optional parameters for the ManagedInstanceEncryptionProtectorsClient.Get -// method. -type ManagedInstanceEncryptionProtectorsClientGetOptions struct { - // placeholder for future optional parameters -} - -// ManagedInstanceEncryptionProtectorsClientListByInstanceOptions contains the optional parameters for the ManagedInstanceEncryptionProtectorsClient.NewListByInstancePager -// method. -type ManagedInstanceEncryptionProtectorsClientListByInstanceOptions struct { - // placeholder for future optional parameters + URI *string } // ManagedInstanceExternalAdministrator - Properties of a active directory administrator. type ManagedInstanceExternalAdministrator struct { // Type of the sever administrator. - AdministratorType *AdministratorType `json:"administratorType,omitempty"` + AdministratorType *AdministratorType // Azure Active Directory only Authentication enabled. - AzureADOnlyAuthentication *bool `json:"azureADOnlyAuthentication,omitempty"` + AzureADOnlyAuthentication *bool // Login name of the server administrator. - Login *string `json:"login,omitempty"` + Login *string // Principal Type of the sever administrator. - PrincipalType *PrincipalType `json:"principalType,omitempty"` + PrincipalType *PrincipalType // SID (object ID) of the server administrator. - Sid *string `json:"sid,omitempty"` + Sid *string // Tenant ID of the administrator. - TenantID *string `json:"tenantId,omitempty"` + TenantID *string } // ManagedInstanceFamilyCapability - The managed server family capability. type ManagedInstanceFamilyCapability struct { // The reason for the capability not being available. - Reason *string `json:"reason,omitempty"` + Reason *string // READ-ONLY; Family name. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; SKU name. - SKU *string `json:"sku,omitempty" azure:"ro"` + SKU *string // READ-ONLY; The status of the capability. - Status *CapabilityStatus `json:"status,omitempty" azure:"ro"` + Status *CapabilityStatus // READ-ONLY; List of supported license types. - SupportedLicenseTypes []*LicenseTypeCapability `json:"supportedLicenseTypes,omitempty" azure:"ro"` + SupportedLicenseTypes []*LicenseTypeCapability // READ-ONLY; List of supported virtual cores values. - SupportedVcoresValues []*ManagedInstanceVcoresCapability `json:"supportedVcoresValues,omitempty" azure:"ro"` + SupportedVcoresValues []*ManagedInstanceVcoresCapability } // ManagedInstanceKey - A managed instance key. type ManagedInstanceKey struct { // Resource properties. - Properties *ManagedInstanceKeyProperties `json:"properties,omitempty"` + Properties *ManagedInstanceKeyProperties // READ-ONLY; Resource ID. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; Kind of encryption protector. This is metadata used for the Azure portal experience. - Kind *string `json:"kind,omitempty" azure:"ro"` + Kind *string // READ-ONLY; Resource name. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // ManagedInstanceKeyListResult - A list of managed instance keys. type ManagedInstanceKeyListResult struct { // READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` + NextLink *string // READ-ONLY; Array of results. - Value []*ManagedInstanceKey `json:"value,omitempty" azure:"ro"` + Value []*ManagedInstanceKey } // ManagedInstanceKeyProperties - Properties for a key execution. type ManagedInstanceKeyProperties struct { // REQUIRED; The key type like 'ServiceManaged', 'AzureKeyVault'. - ServerKeyType *ServerKeyType `json:"serverKeyType,omitempty"` + ServerKeyType *ServerKeyType // The URI of the key. If the ServerKeyType is AzureKeyVault, then the URI is required. - URI *string `json:"uri,omitempty"` + URI *string // READ-ONLY; Key auto rotation opt-in flag. Either true or false. - AutoRotationEnabled *bool `json:"autoRotationEnabled,omitempty" azure:"ro"` + AutoRotationEnabled *bool // READ-ONLY; The key creation date. - CreationDate *time.Time `json:"creationDate,omitempty" azure:"ro"` + CreationDate *time.Time // READ-ONLY; Thumbprint of the key. - Thumbprint *string `json:"thumbprint,omitempty" azure:"ro"` -} - -// ManagedInstanceKeysClientBeginCreateOrUpdateOptions contains the optional parameters for the ManagedInstanceKeysClient.BeginCreateOrUpdate -// method. -type ManagedInstanceKeysClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ManagedInstanceKeysClientBeginDeleteOptions contains the optional parameters for the ManagedInstanceKeysClient.BeginDelete -// method. -type ManagedInstanceKeysClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ManagedInstanceKeysClientGetOptions contains the optional parameters for the ManagedInstanceKeysClient.Get method. -type ManagedInstanceKeysClientGetOptions struct { - // placeholder for future optional parameters -} - -// ManagedInstanceKeysClientListByInstanceOptions contains the optional parameters for the ManagedInstanceKeysClient.NewListByInstancePager -// method. -type ManagedInstanceKeysClientListByInstanceOptions struct { - // An OData filter expression that filters elements in the collection. - Filter *string + Thumbprint *string } // ManagedInstanceListResult - A list of managed instances. type ManagedInstanceListResult struct { // READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` + NextLink *string // READ-ONLY; Array of results. - Value []*ManagedInstance `json:"value,omitempty" azure:"ro"` + Value []*ManagedInstance } // ManagedInstanceLongTermRetentionBackup - A long term retention backup for a managed database. type ManagedInstanceLongTermRetentionBackup struct { // Resource properties. - Properties *ManagedInstanceLongTermRetentionBackupProperties `json:"properties,omitempty"` + Properties *ManagedInstanceLongTermRetentionBackupProperties // READ-ONLY; Resource ID. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; Resource name. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // ManagedInstanceLongTermRetentionBackupListResult - A list of long term retention backups for managed database(s). type ManagedInstanceLongTermRetentionBackupListResult struct { // READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` + NextLink *string // READ-ONLY; Array of results. - Value []*ManagedInstanceLongTermRetentionBackup `json:"value,omitempty" azure:"ro"` + Value []*ManagedInstanceLongTermRetentionBackup } // ManagedInstanceLongTermRetentionBackupProperties - Properties of a long term retention backup type ManagedInstanceLongTermRetentionBackupProperties struct { // READ-ONLY; The time the long term retention backup will expire. - BackupExpirationTime *time.Time `json:"backupExpirationTime,omitempty" azure:"ro"` + BackupExpirationTime *time.Time // READ-ONLY; The storage redundancy type of the backup - BackupStorageRedundancy *BackupStorageRedundancy `json:"backupStorageRedundancy,omitempty" azure:"ro"` + BackupStorageRedundancy *BackupStorageRedundancy // READ-ONLY; The time the backup was taken - BackupTime *time.Time `json:"backupTime,omitempty" azure:"ro"` + BackupTime *time.Time // READ-ONLY; The delete time of the database - DatabaseDeletionTime *time.Time `json:"databaseDeletionTime,omitempty" azure:"ro"` + DatabaseDeletionTime *time.Time // READ-ONLY; The name of the database the backup belong to - DatabaseName *string `json:"databaseName,omitempty" azure:"ro"` + DatabaseName *string // READ-ONLY; The create time of the instance. - ManagedInstanceCreateTime *time.Time `json:"managedInstanceCreateTime,omitempty" azure:"ro"` + ManagedInstanceCreateTime *time.Time // READ-ONLY; The managed instance that the backup database belongs to. - ManagedInstanceName *string `json:"managedInstanceName,omitempty" azure:"ro"` -} - -// ManagedInstanceLongTermRetentionPoliciesClientBeginCreateOrUpdateOptions contains the optional parameters for the ManagedInstanceLongTermRetentionPoliciesClient.BeginCreateOrUpdate -// method. -type ManagedInstanceLongTermRetentionPoliciesClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ManagedInstanceLongTermRetentionPoliciesClientGetOptions contains the optional parameters for the ManagedInstanceLongTermRetentionPoliciesClient.Get -// method. -type ManagedInstanceLongTermRetentionPoliciesClientGetOptions struct { - // placeholder for future optional parameters -} - -// ManagedInstanceLongTermRetentionPoliciesClientListByDatabaseOptions contains the optional parameters for the ManagedInstanceLongTermRetentionPoliciesClient.NewListByDatabasePager -// method. -type ManagedInstanceLongTermRetentionPoliciesClientListByDatabaseOptions struct { - // placeholder for future optional parameters + ManagedInstanceName *string } // ManagedInstanceLongTermRetentionPolicy - A long term retention policy. type ManagedInstanceLongTermRetentionPolicy struct { // Resource properties. - Properties *BaseLongTermRetentionPolicyProperties `json:"properties,omitempty"` + Properties *BaseLongTermRetentionPolicyProperties // READ-ONLY; Resource ID. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; Resource name. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // ManagedInstanceLongTermRetentionPolicyListResult - A list of long term retention policies. type ManagedInstanceLongTermRetentionPolicyListResult struct { // READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` + NextLink *string // READ-ONLY; Array of results. - Value []*ManagedInstanceLongTermRetentionPolicy `json:"value,omitempty" azure:"ro"` + Value []*ManagedInstanceLongTermRetentionPolicy } // ManagedInstanceMaintenanceConfigurationCapability - The maintenance configuration capability type ManagedInstanceMaintenanceConfigurationCapability struct { // The reason for the capability not being available. - Reason *string `json:"reason,omitempty"` + Reason *string // READ-ONLY; Maintenance configuration name - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; The status of the capability. - Status *CapabilityStatus `json:"status,omitempty" azure:"ro"` + Status *CapabilityStatus } // ManagedInstanceOperation - A managed instance operation. type ManagedInstanceOperation struct { // Resource properties. - Properties *ManagedInstanceOperationProperties `json:"properties,omitempty"` + Properties *ManagedInstanceOperationProperties // READ-ONLY; Resource ID. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; Resource name. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // ManagedInstanceOperationListResult - The response to a list managed instance operations request type ManagedInstanceOperationListResult struct { // READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` + NextLink *string // READ-ONLY; Array of results. - Value []*ManagedInstanceOperation `json:"value,omitempty" azure:"ro"` + Value []*ManagedInstanceOperation } // ManagedInstanceOperationParametersPair - The parameters of a managed instance operation. type ManagedInstanceOperationParametersPair struct { // READ-ONLY; The current parameters. - CurrentParameters *UpsertManagedServerOperationParameters `json:"currentParameters,omitempty" azure:"ro"` + CurrentParameters *UpsertManagedServerOperationParameters // READ-ONLY; The requested parameters. - RequestedParameters *UpsertManagedServerOperationParameters `json:"requestedParameters,omitempty" azure:"ro"` + RequestedParameters *UpsertManagedServerOperationParameters } // ManagedInstanceOperationProperties - The properties of a managed instance operation. type ManagedInstanceOperationProperties struct { // READ-ONLY; The operation description. - Description *string `json:"description,omitempty" azure:"ro"` + Description *string // READ-ONLY; The operation error code. - ErrorCode *int32 `json:"errorCode,omitempty" azure:"ro"` + ErrorCode *int32 // READ-ONLY; The operation error description. - ErrorDescription *string `json:"errorDescription,omitempty" azure:"ro"` + ErrorDescription *string // READ-ONLY; The operation error severity. - ErrorSeverity *int32 `json:"errorSeverity,omitempty" azure:"ro"` + ErrorSeverity *int32 // READ-ONLY; The estimated completion time of the operation. - EstimatedCompletionTime *time.Time `json:"estimatedCompletionTime,omitempty" azure:"ro"` + EstimatedCompletionTime *time.Time // READ-ONLY; Whether the operation can be cancelled. - IsCancellable *bool `json:"isCancellable,omitempty" azure:"ro"` + IsCancellable *bool // READ-ONLY; Whether or not the error is a user error. - IsUserError *bool `json:"isUserError,omitempty" azure:"ro"` + IsUserError *bool // READ-ONLY; The name of the managed instance the operation is being performed on. - ManagedInstanceName *string `json:"managedInstanceName,omitempty" azure:"ro"` + ManagedInstanceName *string // READ-ONLY; The name of operation. - Operation *string `json:"operation,omitempty" azure:"ro"` + Operation *string // READ-ONLY; The friendly name of operation. - OperationFriendlyName *string `json:"operationFriendlyName,omitempty" azure:"ro"` + OperationFriendlyName *string // READ-ONLY; The operation parameters. - OperationParameters *ManagedInstanceOperationParametersPair `json:"operationParameters,omitempty" azure:"ro"` + OperationParameters *ManagedInstanceOperationParametersPair // READ-ONLY; The operation steps. - OperationSteps *ManagedInstanceOperationSteps `json:"operationSteps,omitempty" azure:"ro"` + OperationSteps *ManagedInstanceOperationSteps // READ-ONLY; The percentage of the operation completed. - PercentComplete *int32 `json:"percentComplete,omitempty" azure:"ro"` + PercentComplete *int32 // READ-ONLY; The operation start time. - StartTime *time.Time `json:"startTime,omitempty" azure:"ro"` + StartTime *time.Time // READ-ONLY; The operation state. - State *ManagementOperationState `json:"state,omitempty" azure:"ro"` + State *ManagementOperationState } // ManagedInstanceOperationSteps - The steps of a managed instance operation. type ManagedInstanceOperationSteps struct { // READ-ONLY; The number of current operation steps. - CurrentStep *int32 `json:"currentStep,omitempty" azure:"ro"` + CurrentStep *int32 // READ-ONLY; The operation steps list. - StepsList []*UpsertManagedServerOperationStep `json:"stepsList,omitempty" azure:"ro"` + StepsList []*UpsertManagedServerOperationStepWithEstimatesAndDuration // READ-ONLY; The total number of operation steps. - TotalSteps *string `json:"totalSteps,omitempty" azure:"ro"` -} - -// ManagedInstanceOperationsClientCancelOptions contains the optional parameters for the ManagedInstanceOperationsClient.Cancel -// method. -type ManagedInstanceOperationsClientCancelOptions struct { - // placeholder for future optional parameters -} - -// ManagedInstanceOperationsClientGetOptions contains the optional parameters for the ManagedInstanceOperationsClient.Get -// method. -type ManagedInstanceOperationsClientGetOptions struct { - // placeholder for future optional parameters -} - -// ManagedInstanceOperationsClientListByManagedInstanceOptions contains the optional parameters for the ManagedInstanceOperationsClient.NewListByManagedInstancePager -// method. -type ManagedInstanceOperationsClientListByManagedInstanceOptions struct { - // placeholder for future optional parameters + TotalSteps *string } // ManagedInstancePairInfo - Pairs of Managed Instances in the failover group. type ManagedInstancePairInfo struct { // Id of Partner Managed Instance in pair. - PartnerManagedInstanceID *string `json:"partnerManagedInstanceId,omitempty"` + PartnerManagedInstanceID *string // Id of Primary Managed Instance in pair. - PrimaryManagedInstanceID *string `json:"primaryManagedInstanceId,omitempty"` + PrimaryManagedInstanceID *string } // ManagedInstancePecProperty - A private endpoint connection under a managed instance type ManagedInstancePecProperty struct { // READ-ONLY; Resource ID. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; Private endpoint connection properties - Properties *ManagedInstancePrivateEndpointConnectionProperties `json:"properties,omitempty" azure:"ro"` + Properties *ManagedInstancePrivateEndpointConnectionProperties } // ManagedInstancePrivateEndpointConnection - A private endpoint connection type ManagedInstancePrivateEndpointConnection struct { // Resource properties. - Properties *ManagedInstancePrivateEndpointConnectionProperties `json:"properties,omitempty"` + Properties *ManagedInstancePrivateEndpointConnectionProperties // READ-ONLY; Resource ID. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; Resource name. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // ManagedInstancePrivateEndpointConnectionListResult - A list of private endpoint connections. type ManagedInstancePrivateEndpointConnectionListResult struct { // READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` + NextLink *string // READ-ONLY; Array of results. - Value []*ManagedInstancePrivateEndpointConnection `json:"value,omitempty" azure:"ro"` + Value []*ManagedInstancePrivateEndpointConnection } // ManagedInstancePrivateEndpointConnectionProperties - Properties of a private endpoint connection. type ManagedInstancePrivateEndpointConnectionProperties struct { // Private endpoint which the connection belongs to. - PrivateEndpoint *ManagedInstancePrivateEndpointProperty `json:"privateEndpoint,omitempty"` + PrivateEndpoint *ManagedInstancePrivateEndpointProperty // Connection State of the Private Endpoint Connection. - PrivateLinkServiceConnectionState *ManagedInstancePrivateLinkServiceConnectionStateProperty `json:"privateLinkServiceConnectionState,omitempty"` + PrivateLinkServiceConnectionState *ManagedInstancePrivateLinkServiceConnectionStateProperty // READ-ONLY; State of the Private Endpoint Connection. - ProvisioningState *string `json:"provisioningState,omitempty" azure:"ro"` -} - -// ManagedInstancePrivateEndpointConnectionsClientBeginCreateOrUpdateOptions contains the optional parameters for the ManagedInstancePrivateEndpointConnectionsClient.BeginCreateOrUpdate -// method. -type ManagedInstancePrivateEndpointConnectionsClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ManagedInstancePrivateEndpointConnectionsClientBeginDeleteOptions contains the optional parameters for the ManagedInstancePrivateEndpointConnectionsClient.BeginDelete -// method. -type ManagedInstancePrivateEndpointConnectionsClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ManagedInstancePrivateEndpointConnectionsClientGetOptions contains the optional parameters for the ManagedInstancePrivateEndpointConnectionsClient.Get -// method. -type ManagedInstancePrivateEndpointConnectionsClientGetOptions struct { - // placeholder for future optional parameters -} - -// ManagedInstancePrivateEndpointConnectionsClientListByManagedInstanceOptions contains the optional parameters for the ManagedInstancePrivateEndpointConnectionsClient.NewListByManagedInstancePager -// method. -type ManagedInstancePrivateEndpointConnectionsClientListByManagedInstanceOptions struct { - // placeholder for future optional parameters + ProvisioningState *string } type ManagedInstancePrivateEndpointProperty struct { // Resource id of the private endpoint. - ID *string `json:"id,omitempty"` + ID *string } // ManagedInstancePrivateLink - A private link resource type ManagedInstancePrivateLink struct { // READ-ONLY; Resource ID. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; Resource name. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; The private link resource group id. - Properties *ManagedInstancePrivateLinkProperties `json:"properties,omitempty" azure:"ro"` + Properties *ManagedInstancePrivateLinkProperties // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // ManagedInstancePrivateLinkListResult - A list of private link resources type ManagedInstancePrivateLinkListResult struct { // READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` + NextLink *string // READ-ONLY; Array of results. - Value []*ManagedInstancePrivateLink `json:"value,omitempty" azure:"ro"` + Value []*ManagedInstancePrivateLink } // ManagedInstancePrivateLinkProperties - Properties of a private link resource. type ManagedInstancePrivateLinkProperties struct { // READ-ONLY; The private link resource group id. - GroupID *string `json:"groupId,omitempty" azure:"ro"` + GroupID *string // READ-ONLY; The private link resource required member names. - RequiredMembers []*string `json:"requiredMembers,omitempty" azure:"ro"` -} - -// ManagedInstancePrivateLinkResourcesClientGetOptions contains the optional parameters for the ManagedInstancePrivateLinkResourcesClient.Get -// method. -type ManagedInstancePrivateLinkResourcesClientGetOptions struct { - // placeholder for future optional parameters -} + RequiredMembers []*string -// ManagedInstancePrivateLinkResourcesClientListByManagedInstanceOptions contains the optional parameters for the ManagedInstancePrivateLinkResourcesClient.NewListByManagedInstancePager -// method. -type ManagedInstancePrivateLinkResourcesClientListByManagedInstanceOptions struct { - // placeholder for future optional parameters + // READ-ONLY; The private link resource required zone names. + RequiredZoneNames []*string } type ManagedInstancePrivateLinkServiceConnectionStateProperty struct { // REQUIRED; The private link service connection description. - Description *string `json:"description,omitempty"` + Description *string // REQUIRED; The private link service connection status. - Status *string `json:"status,omitempty"` + Status *string // READ-ONLY; The private link service connection description. - ActionsRequired *string `json:"actionsRequired,omitempty" azure:"ro"` + ActionsRequired *string } // ManagedInstanceProperties - The properties of a managed instance. type ManagedInstanceProperties struct { // Administrator username for the managed instance. Can only be specified when the managed instance is being created (and // is required for creation). - AdministratorLogin *string `json:"administratorLogin,omitempty"` + AdministratorLogin *string // The administrator login password (required for managed instance creation). - AdministratorLoginPassword *string `json:"administratorLoginPassword,omitempty"` + AdministratorLoginPassword *string - // The Azure Active Directory administrator of the server. - Administrators *ManagedInstanceExternalAdministrator `json:"administrators,omitempty"` + // The Azure Active Directory administrator of the instance. This can only be used at instance create time. If used for instance + // update, it will be ignored or it will result in an error. For updates + // individual APIs will need to be used. + Administrators *ManagedInstanceExternalAdministrator // Collation of the managed instance. - Collation *string `json:"collation,omitempty"` + Collation *string // The resource id of another managed instance whose DNS zone this managed instance will share after creation. - DNSZonePartner *string `json:"dnsZonePartner,omitempty"` + DNSZonePartner *string // The Id of the instance pool this managed server belongs to. - InstancePoolID *string `json:"instancePoolId,omitempty"` + InstancePoolID *string // A CMK URI of the key to use for encryption. - KeyID *string `json:"keyId,omitempty"` + KeyID *string // The license type. Possible values are 'LicenseIncluded' (regular price inclusive of a new SQL license) and 'BasePrice' // (discounted AHB price for bringing your own SQL licenses). - LicenseType *ManagedInstanceLicenseType `json:"licenseType,omitempty"` + LicenseType *ManagedInstanceLicenseType // Specifies maintenance configuration id to apply to this managed instance. - MaintenanceConfigurationID *string `json:"maintenanceConfigurationId,omitempty"` + MaintenanceConfigurationID *string // Specifies the mode of database creation. // Default: Regular instance creation. // Restore: Creates an instance by restoring a set of backups to specific point in time. RestorePointInTime and SourceManagedInstanceId // must be specified. - ManagedInstanceCreateMode *ManagedServerCreateMode `json:"managedInstanceCreateMode,omitempty"` + ManagedInstanceCreateMode *ManagedServerCreateMode // Minimal TLS version. Allowed values: 'None', '1.0', '1.1', '1.2' - MinimalTLSVersion *string `json:"minimalTlsVersion,omitempty"` + MinimalTLSVersion *string // The resource id of a user assigned identity to be used by default. - PrimaryUserAssignedIdentityID *string `json:"primaryUserAssignedIdentityId,omitempty"` + PrimaryUserAssignedIdentityID *string // Connection type used for connecting to the instance. - ProxyOverride *ManagedInstanceProxyOverride `json:"proxyOverride,omitempty"` + ProxyOverride *ManagedInstanceProxyOverride // Whether or not the public data endpoint is enabled. - PublicDataEndpointEnabled *bool `json:"publicDataEndpointEnabled,omitempty"` + PublicDataEndpointEnabled *bool // The storage account type to be used to store backups for this instance. The options are Local (LocallyRedundantStorage), // Zone (ZoneRedundantStorage), Geo (GeoRedundantStorage) and // GeoZone(GeoZoneRedundantStorage) - RequestedBackupStorageRedundancy *BackupStorageRedundancy `json:"requestedBackupStorageRedundancy,omitempty"` + RequestedBackupStorageRedundancy *BackupStorageRedundancy // Specifies the point in time (ISO8601 format) of the source database that will be restored to create the new database. - RestorePointInTime *time.Time `json:"restorePointInTime,omitempty"` + RestorePointInTime *time.Time // The managed instance's service principal. - ServicePrincipal *ServicePrincipal `json:"servicePrincipal,omitempty"` + ServicePrincipal *ServicePrincipal // The resource identifier of the source managed instance associated with create operation of this instance. - SourceManagedInstanceID *string `json:"sourceManagedInstanceId,omitempty"` + SourceManagedInstanceID *string - // Storage size in GB. Minimum value: 32. Maximum value: 8192. Increments of 32 GB allowed only. - StorageSizeInGB *int32 `json:"storageSizeInGB,omitempty"` + // Storage size in GB. Minimum value: 32. Maximum value: 16384. Increments of 32 GB allowed only. Maximum value depends on + // the selected hardware family and number of vCores. + StorageSizeInGB *int32 // Subnet resource ID for the managed instance. - SubnetID *string `json:"subnetId,omitempty"` + SubnetID *string // Id of the timezone. Allowed values are timezones supported by Windows. Windows keeps details on supported timezones, including // the id, in registry under KEYLOCALMACHINE\SOFTWARE\Microsoft\Windows @@ -6057,1078 +4729,962 @@ type ManagedInstanceProperties struct { // sys.timezone_info. List of Ids can also be obtained by executing // [System.TimeZoneInfo]::GetSystemTimeZones() in PowerShell. An example of valid timezone id is "Pacific Standard Time" or // "W. Europe Standard Time". - TimezoneID *string `json:"timezoneId,omitempty"` + TimezoneID *string // The number of vCores. Allowed values: 8, 16, 24, 32, 40, 64, 80. - VCores *int32 `json:"vCores,omitempty"` + VCores *int32 // Whether or not the multi-az is enabled. - ZoneRedundant *bool `json:"zoneRedundant,omitempty"` + ZoneRedundant *bool // READ-ONLY; The storage account type used to store backups for this instance. The options are Local (LocallyRedundantStorage), // Zone (ZoneRedundantStorage), Geo (GeoRedundantStorage) and // GeoZone(GeoZoneRedundantStorage) - CurrentBackupStorageRedundancy *BackupStorageRedundancy `json:"currentBackupStorageRedundancy,omitempty" azure:"ro"` + CurrentBackupStorageRedundancy *BackupStorageRedundancy // READ-ONLY; The Dns Zone that the managed instance is in. - DNSZone *string `json:"dnsZone,omitempty" azure:"ro"` + DNSZone *string // READ-ONLY; The fully qualified domain name of the managed instance. - FullyQualifiedDomainName *string `json:"fullyQualifiedDomainName,omitempty" azure:"ro"` + FullyQualifiedDomainName *string // READ-ONLY; List of private endpoint connections on a managed instance. - PrivateEndpointConnections []*ManagedInstancePecProperty `json:"privateEndpointConnections,omitempty" azure:"ro"` + PrivateEndpointConnections []*ManagedInstancePecProperty - // READ-ONLY - ProvisioningState *ManagedInstancePropertiesProvisioningState `json:"provisioningState,omitempty" azure:"ro"` + // READ-ONLY; Provisioning state of managed instance. + ProvisioningState *ProvisioningState // READ-ONLY; The state of the managed instance. - State *string `json:"state,omitempty" azure:"ro"` + State *string + + // READ-ONLY; Virtual cluster resource id for the Managed Instance. + VirtualClusterID *string } // ManagedInstanceQuery - Database query. type ManagedInstanceQuery struct { // Resource properties. - Properties *QueryProperties `json:"properties,omitempty"` + Properties *QueryProperties // READ-ONLY; Resource ID. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; Resource name. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // ManagedInstanceQueryStatistics - Execution statistics for one particular query type ManagedInstanceQueryStatistics struct { // READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` + NextLink *string // READ-ONLY; Array of results. - Value []*QueryStatistics `json:"value,omitempty" azure:"ro"` -} - -// ManagedInstanceTdeCertificatesClientBeginCreateOptions contains the optional parameters for the ManagedInstanceTdeCertificatesClient.BeginCreate -// method. -type ManagedInstanceTdeCertificatesClientBeginCreateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string + Value []*QueryStatistics } // ManagedInstanceUpdate - An update request for an Azure SQL Database managed instance. type ManagedInstanceUpdate struct { // Managed instance identity - Identity *ResourceIdentity `json:"identity,omitempty"` + Identity *ResourceIdentity // Resource properties. - Properties *ManagedInstanceProperties `json:"properties,omitempty"` + Properties *ManagedInstanceProperties // Managed instance sku - SKU *SKU `json:"sku,omitempty"` + SKU *SKU // Resource tags. - Tags map[string]*string `json:"tags,omitempty"` + Tags map[string]*string } // ManagedInstanceVcoresCapability - The managed instance virtual cores capability. type ManagedInstanceVcoresCapability struct { // The reason for the capability not being available. - Reason *string `json:"reason,omitempty"` + Reason *string // READ-ONLY; Included size. - IncludedMaxSize *MaxSizeCapability `json:"includedMaxSize,omitempty" azure:"ro"` + IncludedMaxSize *MaxSizeCapability // READ-ONLY; True if this service objective is supported for managed instances in an instance pool. - InstancePoolSupported *bool `json:"instancePoolSupported,omitempty" azure:"ro"` + InstancePoolSupported *bool // READ-ONLY; The virtual cores identifier. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; True if this service objective is supported for standalone managed instances. - StandaloneSupported *bool `json:"standaloneSupported,omitempty" azure:"ro"` + StandaloneSupported *bool // READ-ONLY; The status of the capability. - Status *CapabilityStatus `json:"status,omitempty" azure:"ro"` + Status *CapabilityStatus // READ-ONLY; List of supported maintenance configurations - SupportedMaintenanceConfigurations []*ManagedInstanceMaintenanceConfigurationCapability `json:"supportedMaintenanceConfigurations,omitempty" azure:"ro"` + SupportedMaintenanceConfigurations []*ManagedInstanceMaintenanceConfigurationCapability // READ-ONLY; Storage size ranges. - SupportedStorageSizes []*MaxSizeRangeCapability `json:"supportedStorageSizes,omitempty" azure:"ro"` + SupportedStorageSizes []*MaxSizeRangeCapability // READ-ONLY; The virtual cores value. - Value *int32 `json:"value,omitempty" azure:"ro"` + Value *int32 } // ManagedInstanceVersionCapability - The managed instance capability type ManagedInstanceVersionCapability struct { // The reason for the capability not being available. - Reason *string `json:"reason,omitempty"` + Reason *string // READ-ONLY; The server version name. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; The status of the capability. - Status *CapabilityStatus `json:"status,omitempty" azure:"ro"` + Status *CapabilityStatus // READ-ONLY; The list of supported managed instance editions. - SupportedEditions []*ManagedInstanceEditionCapability `json:"supportedEditions,omitempty" azure:"ro"` + SupportedEditions []*ManagedInstanceEditionCapability // READ-ONLY; The list of supported instance pool editions. - SupportedInstancePoolEditions []*InstancePoolEditionCapability `json:"supportedInstancePoolEditions,omitempty" azure:"ro"` + SupportedInstancePoolEditions []*InstancePoolEditionCapability } // ManagedInstanceVulnerabilityAssessment - A managed instance vulnerability assessment. type ManagedInstanceVulnerabilityAssessment struct { // Resource properties. - Properties *ManagedInstanceVulnerabilityAssessmentProperties `json:"properties,omitempty"` + Properties *ManagedInstanceVulnerabilityAssessmentProperties // READ-ONLY; Resource ID. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; Resource name. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // ManagedInstanceVulnerabilityAssessmentListResult - A list of the ManagedInstance's vulnerability assessments. type ManagedInstanceVulnerabilityAssessmentListResult struct { // READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` + NextLink *string // READ-ONLY; Array of results. - Value []*ManagedInstanceVulnerabilityAssessment `json:"value,omitempty" azure:"ro"` + Value []*ManagedInstanceVulnerabilityAssessment } // ManagedInstanceVulnerabilityAssessmentProperties - Properties of a managed instance vulnerability assessment. type ManagedInstanceVulnerabilityAssessmentProperties struct { // REQUIRED; A blob storage container path to hold the scan results (e.g. https://myStorage.blob.core.windows.net/VaScans/). - StorageContainerPath *string `json:"storageContainerPath,omitempty"` + StorageContainerPath *string // The recurring scans settings - RecurringScans *VulnerabilityAssessmentRecurringScansProperties `json:"recurringScans,omitempty"` + RecurringScans *VulnerabilityAssessmentRecurringScansProperties // Specifies the identifier key of the storage account for vulnerability assessment scan results. If 'StorageContainerSasKey' // isn't specified, storageAccountAccessKey is required. Applies only if the // storage account is not behind a Vnet or a firewall - StorageAccountAccessKey *string `json:"storageAccountAccessKey,omitempty"` + StorageAccountAccessKey *string // A shared access signature (SAS Key) that has write access to the blob container specified in 'storageContainerPath' parameter. // If 'storageAccountAccessKey' isn't specified, StorageContainerSasKey is // required. Applies only if the storage account is not behind a Vnet or a firewall - StorageContainerSasKey *string `json:"storageContainerSasKey,omitempty"` -} - -// ManagedInstanceVulnerabilityAssessmentsClientCreateOrUpdateOptions contains the optional parameters for the ManagedInstanceVulnerabilityAssessmentsClient.CreateOrUpdate -// method. -type ManagedInstanceVulnerabilityAssessmentsClientCreateOrUpdateOptions struct { - // placeholder for future optional parameters + StorageContainerSasKey *string } -// ManagedInstanceVulnerabilityAssessmentsClientDeleteOptions contains the optional parameters for the ManagedInstanceVulnerabilityAssessmentsClient.Delete -// method. -type ManagedInstanceVulnerabilityAssessmentsClientDeleteOptions struct { - // placeholder for future optional parameters -} - -// ManagedInstanceVulnerabilityAssessmentsClientGetOptions contains the optional parameters for the ManagedInstanceVulnerabilityAssessmentsClient.Get -// method. -type ManagedInstanceVulnerabilityAssessmentsClientGetOptions struct { - // placeholder for future optional parameters -} +// ManagedLedgerDigestUploads - Azure SQL Database ledger digest upload settings. +type ManagedLedgerDigestUploads struct { + // Resource properties. + Properties *ManagedLedgerDigestUploadsProperties -// ManagedInstanceVulnerabilityAssessmentsClientListByInstanceOptions contains the optional parameters for the ManagedInstanceVulnerabilityAssessmentsClient.NewListByInstancePager -// method. -type ManagedInstanceVulnerabilityAssessmentsClientListByInstanceOptions struct { - // placeholder for future optional parameters -} + // READ-ONLY; Resource ID. + ID *string -// ManagedInstancesClientBeginCreateOrUpdateOptions contains the optional parameters for the ManagedInstancesClient.BeginCreateOrUpdate -// method. -type ManagedInstancesClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} + // READ-ONLY; Resource name. + Name *string -// ManagedInstancesClientBeginDeleteOptions contains the optional parameters for the ManagedInstancesClient.BeginDelete method. -type ManagedInstancesClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string + // READ-ONLY; Resource type. + Type *string } -// ManagedInstancesClientBeginFailoverOptions contains the optional parameters for the ManagedInstancesClient.BeginFailover -// method. -type ManagedInstancesClientBeginFailoverOptions struct { - // The type of replica to be failed over. - ReplicaType *ReplicaType - // Resumes the LRO from the provided token. - ResumeToken string -} +// ManagedLedgerDigestUploadsListResult - A list of ledger digest upload settings. +type ManagedLedgerDigestUploadsListResult struct { + // READ-ONLY; Link to retrieve next page of results. + NextLink *string -// ManagedInstancesClientBeginUpdateOptions contains the optional parameters for the ManagedInstancesClient.BeginUpdate method. -type ManagedInstancesClientBeginUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string + // READ-ONLY; Array of results. + Value []*ManagedLedgerDigestUploads } -// ManagedInstancesClientGetOptions contains the optional parameters for the ManagedInstancesClient.Get method. -type ManagedInstancesClientGetOptions struct { - // The child resources to include in the response. - Expand *string -} +// ManagedLedgerDigestUploadsProperties - The properties of a database ledger digest upload settings. +type ManagedLedgerDigestUploadsProperties struct { + // The digest storage endpoint, which must be either an Azure blob storage endpoint or an URI for Azure Confidential Ledger. + DigestStorageEndpoint *string -// ManagedInstancesClientListByInstancePoolOptions contains the optional parameters for the ManagedInstancesClient.NewListByInstancePoolPager -// method. -type ManagedInstancesClientListByInstancePoolOptions struct { - // The child resources to include in the response. - Expand *string + // READ-ONLY; Specifies the state of ledger digest upload. + State *ManagedLedgerDigestUploadsState } -// ManagedInstancesClientListByManagedInstanceOptions contains the optional parameters for the ManagedInstancesClient.NewListByManagedInstancePager -// method. -type ManagedInstancesClientListByManagedInstanceOptions struct { - // Aggregation function to be used, default value is 'sum' - AggregationFunction *AggregationFunctionType - // Comma separated list of databases to be included into search. All DB's are included if this parameter is not specified. - Databases *string - // End time for observed period. - EndTime *string - // The time step to be used to summarize the metric values. Default value is PT1H - Interval *QueryTimeGrainType - // How many 'top queries' to return. Default is 5. - NumberOfQueries *int32 - // Metric to be used for ranking top queries. Default is 'cpu' - ObservationMetric *MetricType - // Start time for observed period. - StartTime *string -} +// ManagedServerDNSAlias - A managed server DNS alias. +type ManagedServerDNSAlias struct { + // Resource properties. + Properties *ManagedServerDNSAliasProperties -// ManagedInstancesClientListByResourceGroupOptions contains the optional parameters for the ManagedInstancesClient.NewListByResourceGroupPager -// method. -type ManagedInstancesClientListByResourceGroupOptions struct { - // The child resources to include in the response. - Expand *string -} + // READ-ONLY; Resource ID. + ID *string -// ManagedInstancesClientListOptions contains the optional parameters for the ManagedInstancesClient.NewListPager method. -type ManagedInstancesClientListOptions struct { - // The child resources to include in the response. - Expand *string -} + // READ-ONLY; Resource name. + Name *string -// ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClientBeginCreateOrUpdateOptions contains the optional -// parameters for the ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClient.BeginCreateOrUpdate method. -type ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string + // READ-ONLY; Resource type. + Type *string } -// ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClientBeginUpdateOptions contains the optional parameters -// for the ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClient.BeginUpdate method. -type ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClientBeginUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string +// ManagedServerDNSAliasAcquisition - A managed server DNS alias acquisition request. +type ManagedServerDNSAliasAcquisition struct { + // REQUIRED; The resource ID of the managed server DNS alias that will be acquired to point to this managed server instead. + OldManagedServerDNSAliasResourceID *string } -// ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClientGetOptions contains the optional parameters for the -// ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClient.Get method. -type ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClientGetOptions struct { - // placeholder for future optional parameters +// ManagedServerDNSAliasCreation - A managed server dns alias creation request. +type ManagedServerDNSAliasCreation struct { + // Whether or not DNS record should be created for this alias. + CreateDNSRecord *bool } -// ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClientListByRestorableDroppedDatabaseOptions contains the -// optional parameters for the ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClient.NewListByRestorableDroppedDatabasePager -// method. -type ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClientListByRestorableDroppedDatabaseOptions struct { - // placeholder for future optional parameters -} +// ManagedServerDNSAliasListResult - A list of managed server DNS aliases. +type ManagedServerDNSAliasListResult struct { + // READ-ONLY; Link to retrieve next page of results. + NextLink *string -// ManagedServerSecurityAlertPoliciesClientBeginCreateOrUpdateOptions contains the optional parameters for the ManagedServerSecurityAlertPoliciesClient.BeginCreateOrUpdate -// method. -type ManagedServerSecurityAlertPoliciesClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string + // READ-ONLY; Array of results. + Value []*ManagedServerDNSAlias } -// ManagedServerSecurityAlertPoliciesClientGetOptions contains the optional parameters for the ManagedServerSecurityAlertPoliciesClient.Get -// method. -type ManagedServerSecurityAlertPoliciesClientGetOptions struct { - // placeholder for future optional parameters -} +// ManagedServerDNSAliasProperties - Properties of a managed server DNS alias. +type ManagedServerDNSAliasProperties struct { + // READ-ONLY; The fully qualified DNS record for managed server alias + AzureDNSRecord *string -// ManagedServerSecurityAlertPoliciesClientListByInstanceOptions contains the optional parameters for the ManagedServerSecurityAlertPoliciesClient.NewListByInstancePager -// method. -type ManagedServerSecurityAlertPoliciesClientListByInstanceOptions struct { - // placeholder for future optional parameters + // READ-ONLY; The fully qualified public DNS record for managed server alias + PublicAzureDNSRecord *string } // ManagedServerSecurityAlertPolicy - A managed server security alert policy. type ManagedServerSecurityAlertPolicy struct { // Resource properties. - Properties *SecurityAlertsPolicyProperties `json:"properties,omitempty"` + Properties *SecurityAlertsPolicyProperties // READ-ONLY; Resource ID. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; Resource name. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; SystemData of SecurityAlertPolicyResource. - SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` + SystemData *SystemData // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // ManagedServerSecurityAlertPolicyListResult - A list of the managed Server's security alert policies. type ManagedServerSecurityAlertPolicyListResult struct { // READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` + NextLink *string // READ-ONLY; Array of results. - Value []*ManagedServerSecurityAlertPolicy `json:"value,omitempty" azure:"ro"` + Value []*ManagedServerSecurityAlertPolicy } // ManagedTransparentDataEncryption - A managed database transparent data encryption state. type ManagedTransparentDataEncryption struct { // Resource properties. - Properties *ManagedTransparentDataEncryptionProperties `json:"properties,omitempty"` + Properties *ManagedTransparentDataEncryptionProperties // READ-ONLY; Resource ID. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; Resource name. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // ManagedTransparentDataEncryptionListResult - A list of managed transparent data encryptions type ManagedTransparentDataEncryptionListResult struct { // READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` + NextLink *string // READ-ONLY; Array of results. - Value []*ManagedTransparentDataEncryption `json:"value,omitempty" azure:"ro"` + Value []*ManagedTransparentDataEncryption } // ManagedTransparentDataEncryptionProperties - Properties of a transparent data encryption. type ManagedTransparentDataEncryptionProperties struct { // REQUIRED; Specifies the state of the transparent data encryption. - State *TransparentDataEncryptionState `json:"state,omitempty"` + State *TransparentDataEncryptionState } // MaxSizeCapability - The maximum size capability. type MaxSizeCapability struct { // READ-ONLY; The maximum size limit (see 'unit' for the units). - Limit *int32 `json:"limit,omitempty" azure:"ro"` + Limit *int32 // READ-ONLY; The units that the limit is expressed in. - Unit *MaxSizeUnit `json:"unit,omitempty" azure:"ro"` + Unit *MaxSizeUnit } // MaxSizeRangeCapability - The maximum size range capability. type MaxSizeRangeCapability struct { // The reason for the capability not being available. - Reason *string `json:"reason,omitempty"` + Reason *string // READ-ONLY; Size of transaction log. - LogSize *LogSizeCapability `json:"logSize,omitempty" azure:"ro"` + LogSize *LogSizeCapability // READ-ONLY; Maximum value. - MaxValue *MaxSizeCapability `json:"maxValue,omitempty" azure:"ro"` + MaxValue *MaxSizeCapability // READ-ONLY; Minimum value. - MinValue *MaxSizeCapability `json:"minValue,omitempty" azure:"ro"` + MinValue *MaxSizeCapability // READ-ONLY; Scale/step size for discrete values between the minimum value and the maximum value. - ScaleSize *MaxSizeCapability `json:"scaleSize,omitempty" azure:"ro"` + ScaleSize *MaxSizeCapability // READ-ONLY; The status of the capability. - Status *CapabilityStatus `json:"status,omitempty" azure:"ro"` + Status *CapabilityStatus } -// Metric - Database metrics. -type Metric struct { - // READ-ONLY; The end time for the metric (ISO-8601 format). - EndTime *time.Time `json:"endTime,omitempty" azure:"ro"` - - // READ-ONLY; The metric values for the specified time window and timestep. - MetricValues []*MetricValue `json:"metricValues,omitempty" azure:"ro"` - - // READ-ONLY; The name information for the metric. - Name *MetricName `json:"name,omitempty" azure:"ro"` - - // READ-ONLY; The start time for the metric (ISO-8601 format). - StartTime *time.Time `json:"startTime,omitempty" azure:"ro"` +// MinCapacityCapability - The min capacity capability +type MinCapacityCapability struct { + // The reason for the capability not being available. + Reason *string - // READ-ONLY; The time step to be used to summarize the metric values. - TimeGrain *string `json:"timeGrain,omitempty" azure:"ro"` + // READ-ONLY; The status of the capability. + Status *CapabilityStatus - // READ-ONLY; The unit of the metric. - Unit *UnitType `json:"unit,omitempty" azure:"ro"` + // READ-ONLY; Min capacity value + Value *float64 } -// MetricAvailability - A metric availability value. -type MetricAvailability struct { - // READ-ONLY; The length of retention for the database metric. - Retention *string `json:"retention,omitempty" azure:"ro"` - - // READ-ONLY; The granularity of the database metric. - TimeGrain *string `json:"timeGrain,omitempty" azure:"ro"` +type NSPConfigAccessRule struct { + Name *string + Properties *NSPConfigAccessRuleProperties } -// MetricDefinition - A database metric definition. -type MetricDefinition struct { - // READ-ONLY; The list of database metric availabilities for the metric. - MetricAvailabilities []*MetricAvailability `json:"metricAvailabilities,omitempty" azure:"ro"` - - // READ-ONLY; The name information for the metric. - Name *MetricName `json:"name,omitempty" azure:"ro"` - - // READ-ONLY; The primary aggregation type defining how metric values are displayed. - PrimaryAggregationType *PrimaryAggregationType `json:"primaryAggregationType,omitempty" azure:"ro"` - - // READ-ONLY; The resource uri of the database. - ResourceURI *string `json:"resourceUri,omitempty" azure:"ro"` - - // READ-ONLY; The unit of the metric. - Unit *UnitDefinitionType `json:"unit,omitempty" azure:"ro"` +type NSPConfigAccessRuleProperties struct { + AddressPrefixes []*string + Direction *string + FullyQualifiedDomainNames []*string + NetworkSecurityPerimeters []*NSPConfigNetworkSecurityPerimeterRule + Subscriptions []*string } -// MetricDefinitionListResult - The response to a list database metric definitions request. -type MetricDefinitionListResult struct { - // REQUIRED; The list of metric definitions for the database. - Value []*MetricDefinition `json:"value,omitempty"` +type NSPConfigAssociation struct { + AccessMode *string + Name *string } -// MetricListResult - The response to a list database metrics request. -type MetricListResult struct { - // REQUIRED; The list of metrics for the database. - Value []*Metric `json:"value,omitempty"` +type NSPConfigNetworkSecurityPerimeterRule struct { + ID *string + Location *string + PerimeterGUID *string } -// MetricName - A database metric name. -type MetricName struct { - // READ-ONLY; The friendly name of the database metric. - LocalizedValue *string `json:"localizedValue,omitempty" azure:"ro"` - - // READ-ONLY; The name of the database metric. - Value *string `json:"value,omitempty" azure:"ro"` +type NSPConfigPerimeter struct { + ID *string + Location *string + PerimeterGUID *string } -// MetricValue - Represents database metrics. -type MetricValue struct { - // READ-ONLY; The average value of the metric. - Average *float64 `json:"average,omitempty" azure:"ro"` - - // READ-ONLY; The number of values for the metric. - Count *int32 `json:"count,omitempty" azure:"ro"` - - // READ-ONLY; The max value of the metric. - Maximum *float64 `json:"maximum,omitempty" azure:"ro"` - - // READ-ONLY; The min value of the metric. - Minimum *float64 `json:"minimum,omitempty" azure:"ro"` - - // READ-ONLY; The metric timestamp (ISO-8601 format). - Timestamp *time.Time `json:"timestamp,omitempty" azure:"ro"` - - // READ-ONLY; The total value of the metric. - Total *float64 `json:"total,omitempty" azure:"ro"` +type NSPConfigProfile struct { + AccessRules []*NSPConfigAccessRule + AccessRulesVersion *string + Name *string } -// MinCapacityCapability - The min capacity capability -type MinCapacityCapability struct { - // The reason for the capability not being available. - Reason *string `json:"reason,omitempty"` - - // READ-ONLY; The status of the capability. - Status *CapabilityStatus `json:"status,omitempty" azure:"ro"` +type NSPProvisioningIssue struct { + Name *string + Properties *NSPProvisioningIssueProperties +} - // READ-ONLY; Min capacity value - Value *float64 `json:"value,omitempty" azure:"ro"` +type NSPProvisioningIssueProperties struct { + Description *string + IssueType *string + Severity *string + SuggestedAccessRules []*string + SuggestedResourceIDs []*string } // Name - ARM Usage Name type Name struct { // Usage name localized value. - LocalizedValue *string `json:"localizedValue,omitempty"` + LocalizedValue *string // Usage name value - Value *string `json:"value,omitempty"` + Value *string } // NetworkIsolationSettings - Contains the ARM resources for which to create private endpoint connection. type NetworkIsolationSettings struct { // The resource id for the SQL server which is the target of this request. If set, private endpoint connection will be created // for the SQL server. Must match server which is target of the operation. - SQLServerResourceID *string `json:"sqlServerResourceId,omitempty"` + SQLServerResourceID *string // The resource id for the storage account used to store BACPAC file. If set, private endpoint connection will be created // for the storage account. Must match storage account used for StorageUri // parameter. - StorageAccountResourceID *string `json:"storageAccountResourceId,omitempty"` + StorageAccountResourceID *string +} + +// NetworkSecurityPerimeterConfiguration - NSP Configuration for a server. +type NetworkSecurityPerimeterConfiguration struct { + // Resource properties. + Properties *NetworkSecurityPerimeterConfigurationProperties + + // READ-ONLY; Resource ID. + ID *string + + // READ-ONLY; Resource name. + Name *string + + // READ-ONLY; Resource type. + Type *string +} + +// NetworkSecurityPerimeterConfigurationListResult - A list of NSP configurations for a server. +type NetworkSecurityPerimeterConfigurationListResult struct { + // READ-ONLY; Link to retrieve next page of results. + NextLink *string + + // READ-ONLY; Array of results. + Value []*NetworkSecurityPerimeterConfiguration +} + +// NetworkSecurityPerimeterConfigurationProperties - The properties of an NSP config. +type NetworkSecurityPerimeterConfigurationProperties struct { + NetworkSecurityPerimeter *NSPConfigPerimeter + Profile *NSPConfigProfile + ProvisioningIssues []*NSPProvisioningIssue + ProvisioningState *string + ResourceAssociation *NSPConfigAssociation } // Operation - SQL REST API operation definition. type Operation struct { // READ-ONLY; The localized display information for this particular operation / action. - Display *OperationDisplay `json:"display,omitempty" azure:"ro"` + Display *OperationDisplay // READ-ONLY; The name of the operation being performed on this particular object. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; The intended executor of the operation. - Origin *OperationOrigin `json:"origin,omitempty" azure:"ro"` + Origin *OperationOrigin // READ-ONLY; Additional descriptions for the operation. - Properties map[string]any `json:"properties,omitempty" azure:"ro"` + Properties map[string]any } // OperationDisplay - Display metadata associated with the operation. type OperationDisplay struct { // READ-ONLY; The localized friendly description for the operation. - Description *string `json:"description,omitempty" azure:"ro"` + Description *string // READ-ONLY; The localized friendly name for the operation. - Operation *string `json:"operation,omitempty" azure:"ro"` + Operation *string // READ-ONLY; The localized friendly form of the resource provider name. - Provider *string `json:"provider,omitempty" azure:"ro"` + Provider *string // READ-ONLY; The localized friendly form of the resource type related to this action/operation. - Resource *string `json:"resource,omitempty" azure:"ro"` + Resource *string } -// OperationImpact - The impact of an operation, both in absolute and relative terms. -type OperationImpact struct { - // READ-ONLY; The absolute impact to dimension. - ChangeValueAbsolute *float64 `json:"changeValueAbsolute,omitempty" azure:"ro"` +// OperationListResult - Result of the request to list SQL operations. +type OperationListResult struct { + // READ-ONLY; Link to retrieve next page of results. + NextLink *string - // READ-ONLY; The relative impact to dimension (null if not applicable) - ChangeValueRelative *float64 `json:"changeValueRelative,omitempty" azure:"ro"` + // READ-ONLY; Array of results. + Value []*Operation +} - // READ-ONLY; The name of the impact dimension. - Name *string `json:"name,omitempty" azure:"ro"` +// OutboundEnvironmentEndpoint - An endpoint that the managed instance service requires outbound network access to. +type OutboundEnvironmentEndpoint struct { + // READ-ONLY; The type of service accessed by the managed instance service, e.g., Azure Storage, Azure Active Directory, etc. + Category *string - // READ-ONLY; The unit in which estimated impact to dimension is measured. - Unit *string `json:"unit,omitempty" azure:"ro"` + // READ-ONLY; The endpoints that the managed instance service communicates with in order to function correctly. + Endpoints []*EndpointDependency } -// OperationListResult - Result of the request to list SQL operations. -type OperationListResult struct { +// OutboundEnvironmentEndpointCollection - A collection of endpoints that the managed instance service requires outbound network +// access to. +type OutboundEnvironmentEndpointCollection struct { // READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` + NextLink *string // READ-ONLY; Array of results. - Value []*Operation `json:"value,omitempty" azure:"ro"` -} - -// OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. -type OperationsClientListOptions struct { - // placeholder for future optional parameters + Value []*OutboundEnvironmentEndpoint } // OutboundFirewallRule - An Azure SQL DB Server Outbound Firewall Rule. type OutboundFirewallRule struct { // Resource properties. - Properties *OutboundFirewallRuleProperties `json:"properties,omitempty"` + Properties *OutboundFirewallRuleProperties // READ-ONLY; Resource ID. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; Resource name. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // OutboundFirewallRuleListResult - A list of outbound rules. type OutboundFirewallRuleListResult struct { // READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` + NextLink *string // READ-ONLY; Array of results. - Value []*OutboundFirewallRule `json:"value,omitempty" azure:"ro"` + Value []*OutboundFirewallRule } // OutboundFirewallRuleProperties - The properties of an outbound firewall rule. type OutboundFirewallRuleProperties struct { // READ-ONLY; The state of the outbound rule. - ProvisioningState *string `json:"provisioningState,omitempty" azure:"ro"` -} - -// OutboundFirewallRulesClientBeginCreateOrUpdateOptions contains the optional parameters for the OutboundFirewallRulesClient.BeginCreateOrUpdate -// method. -type OutboundFirewallRulesClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// OutboundFirewallRulesClientBeginDeleteOptions contains the optional parameters for the OutboundFirewallRulesClient.BeginDelete -// method. -type OutboundFirewallRulesClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// OutboundFirewallRulesClientGetOptions contains the optional parameters for the OutboundFirewallRulesClient.Get method. -type OutboundFirewallRulesClientGetOptions struct { - // placeholder for future optional parameters -} - -// OutboundFirewallRulesClientListByServerOptions contains the optional parameters for the OutboundFirewallRulesClient.NewListByServerPager -// method. -type OutboundFirewallRulesClientListByServerOptions struct { - // placeholder for future optional parameters + ProvisioningState *string } // PartnerInfo - Partner server information for the failover group. type PartnerInfo struct { // REQUIRED; Resource identifier of the partner server. - ID *string `json:"id,omitempty"` + ID *string // READ-ONLY; Geo location of the partner server. - Location *string `json:"location,omitempty" azure:"ro"` + Location *string // READ-ONLY; Replication role of the partner server. - ReplicationRole *FailoverGroupReplicationRole `json:"replicationRole,omitempty" azure:"ro"` + ReplicationRole *FailoverGroupReplicationRole } // PartnerRegionInfo - Partner region information for the failover group. type PartnerRegionInfo struct { // Geo location of the partner managed instances. - Location *string `json:"location,omitempty"` + Location *string // READ-ONLY; Replication role of the partner managed instances. - ReplicationRole *InstanceFailoverGroupReplicationRole `json:"replicationRole,omitempty" azure:"ro"` + ReplicationRole *InstanceFailoverGroupReplicationRole } // PerformanceLevelCapability - The performance level capability. type PerformanceLevelCapability struct { // READ-ONLY; Unit type used to measure performance level. - Unit *PerformanceLevelUnit `json:"unit,omitempty" azure:"ro"` + Unit *PerformanceLevelUnit // READ-ONLY; Performance level value. - Value *float64 `json:"value,omitempty" azure:"ro"` + Value *float64 +} + +// PhaseDetails - The phase details properties of a database operation. +type PhaseDetails struct { + // READ-ONLY; The operation phase. + Phase *Phase + + // READ-ONLY; The operation phase information. + PhaseInformation map[string]*string } // PrivateEndpointConnection - A private endpoint connection type PrivateEndpointConnection struct { // Resource properties. - Properties *PrivateEndpointConnectionProperties `json:"properties,omitempty"` + Properties *PrivateEndpointConnectionProperties // READ-ONLY; Resource ID. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; Resource name. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // PrivateEndpointConnectionListResult - A list of private endpoint connections. type PrivateEndpointConnectionListResult struct { // READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` + NextLink *string // READ-ONLY; Array of results. - Value []*PrivateEndpointConnection `json:"value,omitempty" azure:"ro"` + Value []*PrivateEndpointConnection } // PrivateEndpointConnectionProperties - Properties of a private endpoint connection. type PrivateEndpointConnectionProperties struct { // Private endpoint which the connection belongs to. - PrivateEndpoint *PrivateEndpointProperty `json:"privateEndpoint,omitempty"` + PrivateEndpoint *PrivateEndpointProperty // Connection state of the private endpoint connection. - PrivateLinkServiceConnectionState *PrivateLinkServiceConnectionStateProperty `json:"privateLinkServiceConnectionState,omitempty"` + PrivateLinkServiceConnectionState *PrivateLinkServiceConnectionStateProperty + + // READ-ONLY; Group IDs. + GroupIDs []*string // READ-ONLY; State of the private endpoint connection. - ProvisioningState *PrivateEndpointProvisioningState `json:"provisioningState,omitempty" azure:"ro"` + ProvisioningState *PrivateEndpointProvisioningState } // PrivateEndpointConnectionRequestStatus - Contains the private endpoint connection requests status. type PrivateEndpointConnectionRequestStatus struct { // READ-ONLY; The connection name for the private endpoint. - PrivateEndpointConnectionName *string `json:"privateEndpointConnectionName,omitempty" azure:"ro"` + PrivateEndpointConnectionName *string // READ-ONLY; Resource id for which the private endpoint is created. - PrivateLinkServiceID *string `json:"privateLinkServiceId,omitempty" azure:"ro"` + PrivateLinkServiceID *string // READ-ONLY; Status of this private endpoint connection. - Status *string `json:"status,omitempty" azure:"ro"` -} - -// PrivateEndpointConnectionsClientBeginCreateOrUpdateOptions contains the optional parameters for the PrivateEndpointConnectionsClient.BeginCreateOrUpdate -// method. -type PrivateEndpointConnectionsClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// PrivateEndpointConnectionsClientBeginDeleteOptions contains the optional parameters for the PrivateEndpointConnectionsClient.BeginDelete -// method. -type PrivateEndpointConnectionsClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// PrivateEndpointConnectionsClientGetOptions contains the optional parameters for the PrivateEndpointConnectionsClient.Get -// method. -type PrivateEndpointConnectionsClientGetOptions struct { - // placeholder for future optional parameters -} - -// PrivateEndpointConnectionsClientListByServerOptions contains the optional parameters for the PrivateEndpointConnectionsClient.NewListByServerPager -// method. -type PrivateEndpointConnectionsClientListByServerOptions struct { - // placeholder for future optional parameters + Status *string } type PrivateEndpointProperty struct { // Resource id of the private endpoint. - ID *string `json:"id,omitempty"` + ID *string } // PrivateLinkResource - A private link resource type PrivateLinkResource struct { // READ-ONLY; Resource ID. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; Resource name. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; The private link resource group id. - Properties *PrivateLinkResourceProperties `json:"properties,omitempty" azure:"ro"` + Properties *PrivateLinkResourceProperties // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // PrivateLinkResourceListResult - A list of private link resources type PrivateLinkResourceListResult struct { // READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` + NextLink *string // READ-ONLY; Array of results. - Value []*PrivateLinkResource `json:"value,omitempty" azure:"ro"` + Value []*PrivateLinkResource } // PrivateLinkResourceProperties - Properties of a private link resource. type PrivateLinkResourceProperties struct { // READ-ONLY; The private link resource group id. - GroupID *string `json:"groupId,omitempty" azure:"ro"` + GroupID *string // READ-ONLY; The private link resource required member names. - RequiredMembers []*string `json:"requiredMembers,omitempty" azure:"ro"` + RequiredMembers []*string // READ-ONLY; The private link resource required zone names. - RequiredZoneNames []*string `json:"requiredZoneNames,omitempty" azure:"ro"` -} - -// PrivateLinkResourcesClientGetOptions contains the optional parameters for the PrivateLinkResourcesClient.Get method. -type PrivateLinkResourcesClientGetOptions struct { - // placeholder for future optional parameters -} - -// PrivateLinkResourcesClientListByServerOptions contains the optional parameters for the PrivateLinkResourcesClient.NewListByServerPager -// method. -type PrivateLinkResourcesClientListByServerOptions struct { - // placeholder for future optional parameters + RequiredZoneNames []*string } type PrivateLinkServiceConnectionStateProperty struct { // REQUIRED; The private link service connection description. - Description *string `json:"description,omitempty"` + Description *string // REQUIRED; The private link service connection status. - Status *PrivateLinkServiceConnectionStateStatus `json:"status,omitempty"` + Status *PrivateLinkServiceConnectionStateStatus // READ-ONLY; The actions required for private link service connection. - ActionsRequired *PrivateLinkServiceConnectionStateActionsRequire `json:"actionsRequired,omitempty" azure:"ro"` + ActionsRequired *PrivateLinkServiceConnectionStateActionsRequire } // ProxyResource - ARM proxy resource. type ProxyResource struct { // READ-ONLY; Resource ID. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; Resource name. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // ProxyResourceWithWritableName - ARM proxy resource. type ProxyResourceWithWritableName struct { // Resource name. - Name *string `json:"name,omitempty"` + Name *string // READ-ONLY; Resource ID. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` + Type *string +} + +// QueryCheck - SQL Vulnerability Assessment query check object. +type QueryCheck struct { + // READ-ONLY; SQL Vulnerability Assessment column names of query expected result. + ColumnNames []*string + + // READ-ONLY; SQL Vulnerability Assessment query expected result. + ExpectedResult [][]*string + + // READ-ONLY; SQL Vulnerability Assessment rule query. + Query *string } // QueryMetricInterval - Properties of a query metrics interval. type QueryMetricInterval struct { // List of metric objects for this interval - Metrics []*QueryMetricProperties `json:"metrics,omitempty"` + Metrics []*QueryMetricProperties // READ-ONLY; Execution count of a query in this interval. - ExecutionCount *int64 `json:"executionCount,omitempty" azure:"ro"` + ExecutionCount *int64 // READ-ONLY; The start time for the metric interval (ISO-8601 format). - IntervalStartTime *string `json:"intervalStartTime,omitempty" azure:"ro"` + IntervalStartTime *string // READ-ONLY; Interval type (length). - IntervalType *QueryTimeGrainType `json:"intervalType,omitempty" azure:"ro"` + IntervalType *QueryTimeGrainType } // QueryMetricProperties - Properties of a topquery metric in one interval. type QueryMetricProperties struct { // READ-ONLY; Metric value when avg() aggregate function is used over the interval. - Avg *float64 `json:"avg,omitempty" azure:"ro"` + Avg *float64 // READ-ONLY; The UI appropriate name for the metric. - DisplayName *string `json:"displayName,omitempty" azure:"ro"` + DisplayName *string // READ-ONLY; Metric value when max() aggregate function is used over the interval. - Max *float64 `json:"max,omitempty" azure:"ro"` + Max *float64 // READ-ONLY; Metric value when min() aggregate function is used over the interval. - Min *float64 `json:"min,omitempty" azure:"ro"` + Min *float64 // READ-ONLY; The name information for the metric. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Metric value when stdev aggregate function is used over the interval. - Stdev *float64 `json:"stdev,omitempty" azure:"ro"` + Stdev *float64 // READ-ONLY; Metric value when sum() aggregate function is used over the interval. - Sum *float64 `json:"sum,omitempty" azure:"ro"` + Sum *float64 // READ-ONLY; The unit of the metric. - Unit *QueryMetricUnitType `json:"unit,omitempty" azure:"ro"` + Unit *QueryMetricUnitType // READ-ONLY; The value of the metric. - Value *float64 `json:"value,omitempty" azure:"ro"` + Value *float64 } // QueryProperties - Properties of a database query. type QueryProperties struct { // Query text. - QueryText *string `json:"queryText,omitempty"` + QueryText *string } type QueryStatistics struct { // Resource properties. - Properties *QueryStatisticsProperties `json:"properties,omitempty"` + Properties *QueryStatisticsProperties // READ-ONLY; Resource ID. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; Resource name. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // QueryStatisticsProperties - Properties of a query execution statistics. type QueryStatisticsProperties struct { // List of intervals with appropriate metric data - Intervals []*QueryMetricInterval `json:"intervals,omitempty"` + Intervals []*QueryMetricInterval // READ-ONLY; Database name of the database in which this query was executed. - DatabaseName *string `json:"databaseName,omitempty" azure:"ro"` + DatabaseName *string // READ-ONLY; The end time for the metric (ISO-8601 format). - EndTime *string `json:"endTime,omitempty" azure:"ro"` + EndTime *string // READ-ONLY; Unique query id (unique within one database). - QueryID *string `json:"queryId,omitempty" azure:"ro"` + QueryID *string // READ-ONLY; The start time for the metric (ISO-8601 format). - StartTime *string `json:"startTime,omitempty" azure:"ro"` + StartTime *string } // ReadScaleCapability - The read scale capability. type ReadScaleCapability struct { // The reason for the capability not being available. - Reason *string `json:"reason,omitempty"` + Reason *string // READ-ONLY; The maximum number of read scale replicas. - MaxNumberOfReplicas *int32 `json:"maxNumberOfReplicas,omitempty" azure:"ro"` + MaxNumberOfReplicas *int32 // READ-ONLY; The status of the capability. - Status *CapabilityStatus `json:"status,omitempty" azure:"ro"` + Status *CapabilityStatus } // RecommendedAction - Database, Server or Elastic Pool Recommended Action. type RecommendedAction struct { // Resource properties. - Properties *RecommendedActionProperties `json:"properties,omitempty"` + Properties *RecommendedActionProperties // READ-ONLY; Resource ID. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; Resource kind. - Kind *string `json:"kind,omitempty" azure:"ro"` + Kind *string // READ-ONLY; Resource location. - Location *string `json:"location,omitempty" azure:"ro"` + Location *string // READ-ONLY; Resource name. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // RecommendedActionErrorInfo - Contains error information for an Azure SQL Database, Server or Elastic Pool Recommended Action. type RecommendedActionErrorInfo struct { // READ-ONLY; Gets the reason why the recommended action was put to error state. e.g., DatabaseHasQdsOff, IndexAlreadyExists - ErrorCode *string `json:"errorCode,omitempty" azure:"ro"` + ErrorCode *string // READ-ONLY; Gets whether the error could be ignored and recommended action could be retried. Possible values are: Yes/No - IsRetryable *IsRetryable `json:"isRetryable,omitempty" azure:"ro"` + IsRetryable *IsRetryable } // RecommendedActionImpactRecord - Contains information of estimated or observed impact on various metrics for an Azure SQL // Database, Server or Elastic Pool Recommended Action. type RecommendedActionImpactRecord struct { // READ-ONLY; Gets the absolute value of this dimension if applicable. e.g., Number of Queries affected - AbsoluteValue *float64 `json:"absoluteValue,omitempty" azure:"ro"` + AbsoluteValue *float64 // READ-ONLY; Gets the absolute change in the value of this dimension. e.g., Absolute Disk space change in Megabytes - ChangeValueAbsolute *float64 `json:"changeValueAbsolute,omitempty" azure:"ro"` + ChangeValueAbsolute *float64 // READ-ONLY; Gets the relative change in the value of this dimension. e.g., Relative Disk space change in Percentage - ChangeValueRelative *float64 `json:"changeValueRelative,omitempty" azure:"ro"` + ChangeValueRelative *float64 // READ-ONLY; Gets the name of the impact dimension. e.g., CPUChange, DiskSpaceChange, NumberOfQueriesAffected. - DimensionName *string `json:"dimensionName,omitempty" azure:"ro"` + DimensionName *string // READ-ONLY; Gets the name of the impact dimension. e.g., CPUChange, DiskSpaceChange, NumberOfQueriesAffected. - Unit *string `json:"unit,omitempty" azure:"ro"` + Unit *string } // RecommendedActionImplementationInfo - Contains information for manual implementation for an Azure SQL Database, Server // or Elastic Pool Recommended Action. type RecommendedActionImplementationInfo struct { // READ-ONLY; Gets the method in which this recommended action can be manually implemented. e.g., TSql, AzurePowerShell. - Method *ImplementationMethod `json:"method,omitempty" azure:"ro"` + Method *ImplementationMethod // READ-ONLY; Gets the manual implementation script. e.g., T-SQL script that could be executed on the database. - Script *string `json:"script,omitempty" azure:"ro"` + Script *string } // RecommendedActionMetricInfo - Contains time series of various impacted metrics for an Azure SQL Database, Server or Elastic // Pool Recommended Action. type RecommendedActionMetricInfo struct { // READ-ONLY; Gets the name of the metric. e.g., CPU, Number of Queries. - MetricName *string `json:"metricName,omitempty" azure:"ro"` + MetricName *string // READ-ONLY; Gets the start time of time interval given by this MetricInfo. - StartTime *time.Time `json:"startTime,omitempty" azure:"ro"` + StartTime *time.Time // READ-ONLY; Gets the duration of time interval for the value given by this MetricInfo. e.g., PT1H (1 hour) - TimeGrain *string `json:"timeGrain,omitempty" azure:"ro"` + TimeGrain *string // READ-ONLY; Gets the unit in which metric is measured. e.g., DTU, Frequency - Unit *string `json:"unit,omitempty" azure:"ro"` + Unit *string // READ-ONLY; Gets the value of the metric in the time interval given by this MetricInfo. - Value *float64 `json:"value,omitempty" azure:"ro"` + Value *float64 } // RecommendedActionProperties - Properties for a Database, Server or Elastic Pool Recommended Action. type RecommendedActionProperties struct { // REQUIRED; Gets the info of the current state the recommended action is in. - State *RecommendedActionStateInfo `json:"state,omitempty"` + State *RecommendedActionStateInfo // READ-ONLY; Gets additional details specific to this recommended action. - Details map[string]any `json:"details,omitempty" azure:"ro"` + Details map[string]any // READ-ONLY; Gets the error details if and why this recommended action is put to error state. - ErrorDetails *RecommendedActionErrorInfo `json:"errorDetails,omitempty" azure:"ro"` + ErrorDetails *RecommendedActionErrorInfo // READ-ONLY; Gets the estimated impact info for this recommended action e.g., Estimated CPU gain, Estimated Disk Space change - EstimatedImpact []*RecommendedActionImpactRecord `json:"estimatedImpact,omitempty" azure:"ro"` + EstimatedImpact []*RecommendedActionImpactRecord // READ-ONLY; Gets the time taken for applying this recommended action on user resource. e.g., time taken for index creation - ExecuteActionDuration *string `json:"executeActionDuration,omitempty" azure:"ro"` + ExecuteActionDuration *string // READ-ONLY; Gets if approval for applying this recommended action was given by user/system. - ExecuteActionInitiatedBy *RecommendedActionInitiatedBy `json:"executeActionInitiatedBy,omitempty" azure:"ro"` + ExecuteActionInitiatedBy *RecommendedActionInitiatedBy // READ-ONLY; Gets the time when this recommended action was approved for execution. - ExecuteActionInitiatedTime *time.Time `json:"executeActionInitiatedTime,omitempty" azure:"ro"` + ExecuteActionInitiatedTime *time.Time // READ-ONLY; Gets the time when system started applying this recommended action on the user resource. e.g., index creation // start time - ExecuteActionStartTime *time.Time `json:"executeActionStartTime,omitempty" azure:"ro"` + ExecuteActionStartTime *time.Time // READ-ONLY; Gets the implementation details of this recommended action for user to apply it manually. - ImplementationDetails *RecommendedActionImplementationInfo `json:"implementationDetails,omitempty" azure:"ro"` + ImplementationDetails *RecommendedActionImplementationInfo // READ-ONLY; Gets if this recommended action was suggested some time ago but user chose to ignore this and system added a // new recommended action again. - IsArchivedAction *bool `json:"isArchivedAction,omitempty" azure:"ro"` + IsArchivedAction *bool // READ-ONLY; Gets if this recommended action is actionable by user - IsExecutableAction *bool `json:"isExecutableAction,omitempty" azure:"ro"` + IsExecutableAction *bool // READ-ONLY; Gets if changes applied by this recommended action can be reverted by user - IsRevertableAction *bool `json:"isRevertableAction,omitempty" azure:"ro"` + IsRevertableAction *bool // READ-ONLY; Gets time when this recommended action was last refreshed. - LastRefresh *time.Time `json:"lastRefresh,omitempty" azure:"ro"` + LastRefresh *time.Time // READ-ONLY; Gets the linked objects, if any. - LinkedObjects []*string `json:"linkedObjects,omitempty" azure:"ro"` + LinkedObjects []*string // READ-ONLY; Gets the observed/actual impact info for this recommended action e.g., Actual CPU gain, Actual Disk Space change - ObservedImpact []*RecommendedActionImpactRecord `json:"observedImpact,omitempty" azure:"ro"` + ObservedImpact []*RecommendedActionImpactRecord // READ-ONLY; Gets the reason for recommending this action. e.g., DuplicateIndex - RecommendationReason *string `json:"recommendationReason,omitempty" azure:"ro"` + RecommendationReason *string // READ-ONLY; Gets the time taken for reverting changes of this recommended action on user resource. e.g., time taken for // dropping the created index. - RevertActionDuration *string `json:"revertActionDuration,omitempty" azure:"ro"` + RevertActionDuration *string // READ-ONLY; Gets if approval for reverting this recommended action was given by user/system. - RevertActionInitiatedBy *RecommendedActionInitiatedBy `json:"revertActionInitiatedBy,omitempty" azure:"ro"` + RevertActionInitiatedBy *RecommendedActionInitiatedBy // READ-ONLY; Gets the time when this recommended action was approved for revert. - RevertActionInitiatedTime *time.Time `json:"revertActionInitiatedTime,omitempty" azure:"ro"` + RevertActionInitiatedTime *time.Time // READ-ONLY; Gets the time when system started reverting changes of this recommended action on user resource. e.g., time // when index drop is executed. - RevertActionStartTime *time.Time `json:"revertActionStartTime,omitempty" azure:"ro"` + RevertActionStartTime *time.Time // READ-ONLY; Gets the impact of this recommended action. Possible values are 1 - Low impact, 2 - Medium Impact and 3 - High // Impact - Score *int32 `json:"score,omitempty" azure:"ro"` + Score *int32 // READ-ONLY; Gets the time series info of metrics for this recommended action e.g., CPU consumption time series - TimeSeries []*RecommendedActionMetricInfo `json:"timeSeries,omitempty" azure:"ro"` + TimeSeries []*RecommendedActionMetricInfo // READ-ONLY; Gets the time since when this recommended action is valid. - ValidSince *time.Time `json:"validSince,omitempty" azure:"ro"` + ValidSince *time.Time } // RecommendedActionStateInfo - Contains information of current state for an Azure SQL Database, Server or Elastic Pool Recommended @@ -7143,1021 +5699,821 @@ type RecommendedActionStateInfo struct { // reverted. Reverting -> changes made while applying recommended action are being reverted on the user database. Reverted // -> successfully reverted the changes made by recommended action on user // database. Ignored -> user explicitly ignored/discarded the recommended action. - CurrentValue *RecommendedActionCurrentState `json:"currentValue,omitempty"` + CurrentValue *RecommendedActionCurrentState // READ-ONLY; Gets who initiated the execution of this recommended action. Possible Value are: User -> When user explicity // notified system to apply the recommended action. System -> When auto-execute status of this // advisor was set to 'Enabled', in which case the system applied it. - ActionInitiatedBy *RecommendedActionInitiatedBy `json:"actionInitiatedBy,omitempty" azure:"ro"` + ActionInitiatedBy *RecommendedActionInitiatedBy // READ-ONLY; Gets the time when the state was last modified - LastModified *time.Time `json:"lastModified,omitempty" azure:"ro"` + LastModified *time.Time } // RecommendedSensitivityLabelUpdate - A recommended sensitivity label update operation. type RecommendedSensitivityLabelUpdate struct { // Resource properties. - Properties *RecommendedSensitivityLabelUpdateProperties `json:"properties,omitempty"` + Properties *RecommendedSensitivityLabelUpdateProperties // READ-ONLY; Resource ID. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; Resource name. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // RecommendedSensitivityLabelUpdateList - A list of recommended sensitivity label update operations. type RecommendedSensitivityLabelUpdateList struct { - Operations []*RecommendedSensitivityLabelUpdate `json:"operations,omitempty"` + Operations []*RecommendedSensitivityLabelUpdate } // RecommendedSensitivityLabelUpdateProperties - Properties of an operation executed on a recommended sensitivity label. type RecommendedSensitivityLabelUpdateProperties struct { // REQUIRED; Column name to update. - Column *string `json:"column,omitempty"` + Column *string // REQUIRED - Op *RecommendedSensitivityLabelUpdateKind `json:"op,omitempty"` + Op *RecommendedSensitivityLabelUpdateKind // REQUIRED; Schema name of the column to update. - Schema *string `json:"schema,omitempty"` + Schema *string // REQUIRED; Table name of the column to update. - Table *string `json:"table,omitempty"` -} - -// RecommendedSensitivityLabelsClientUpdateOptions contains the optional parameters for the RecommendedSensitivityLabelsClient.Update -// method. -type RecommendedSensitivityLabelsClientUpdateOptions struct { - // placeholder for future optional parameters + Table *string } -// RecoverableDatabase - A recoverable database +// RecoverableDatabase - A recoverable database resource. type RecoverableDatabase struct { - // The properties of a recoverable database - Properties *RecoverableDatabaseProperties `json:"properties,omitempty"` + // Resource properties. + Properties *RecoverableDatabaseProperties // READ-ONLY; Resource ID. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; Resource name. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } -// RecoverableDatabaseListResult - The response to a list recoverable databases request +// RecoverableDatabaseListResult - A list of recoverable databases. type RecoverableDatabaseListResult struct { - // REQUIRED; A list of recoverable databases - Value []*RecoverableDatabase `json:"value,omitempty"` + // READ-ONLY; Link to retrieve next page of results. + NextLink *string + + // READ-ONLY; Array of results. + Value []*RecoverableDatabase } -// RecoverableDatabaseProperties - The properties of a recoverable database +// RecoverableDatabaseProperties - The recoverable database's properties. type RecoverableDatabaseProperties struct { - // READ-ONLY; The edition of the database - Edition *string `json:"edition,omitempty" azure:"ro"` - - // READ-ONLY; The elastic pool name of the database - ElasticPoolName *string `json:"elasticPoolName,omitempty" azure:"ro"` + // The resource ids of the user assigned identities to use + Keys map[string]*DatabaseKey - // READ-ONLY; The last available backup date of the database (ISO8601 format) - LastAvailableBackupDate *time.Time `json:"lastAvailableBackupDate,omitempty" azure:"ro"` + // READ-ONLY; The edition of the database. + Edition *string - // READ-ONLY; The service level objective name of the database - ServiceLevelObjective *string `json:"serviceLevelObjective,omitempty" azure:"ro"` -} + // READ-ONLY; The elastic pool name of the database + ElasticPoolName *string -// RecoverableDatabasesClientGetOptions contains the optional parameters for the RecoverableDatabasesClient.Get method. -type RecoverableDatabasesClientGetOptions struct { - // placeholder for future optional parameters -} + // READ-ONLY; The last available backup date. + LastAvailableBackupDate *time.Time -// RecoverableDatabasesClientListByServerOptions contains the optional parameters for the RecoverableDatabasesClient.NewListByServerPager -// method. -type RecoverableDatabasesClientListByServerOptions struct { - // placeholder for future optional parameters + // READ-ONLY; The service level objective name of the database. + ServiceLevelObjective *string } // RecoverableManagedDatabase - A recoverable managed database resource. type RecoverableManagedDatabase struct { // Resource properties. - Properties *RecoverableManagedDatabaseProperties `json:"properties,omitempty"` + Properties *RecoverableManagedDatabaseProperties // READ-ONLY; Resource ID. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; Resource name. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // RecoverableManagedDatabaseListResult - A list of recoverable managed databases. type RecoverableManagedDatabaseListResult struct { // READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` + NextLink *string // READ-ONLY; Array of results. - Value []*RecoverableManagedDatabase `json:"value,omitempty" azure:"ro"` + Value []*RecoverableManagedDatabase } // RecoverableManagedDatabaseProperties - The recoverable managed database's properties. type RecoverableManagedDatabaseProperties struct { // READ-ONLY; The last available backup date. - LastAvailableBackupDate *string `json:"lastAvailableBackupDate,omitempty" azure:"ro"` + LastAvailableBackupDate *string +} + +// RefreshExternalGovernanceStatusOperationResult - An RefreshExternalGovernanceStatus operation result resource. +type RefreshExternalGovernanceStatusOperationResult struct { + // Resource properties. + Properties *RefreshExternalGovernanceStatusOperationResultProperties + + // READ-ONLY; Resource ID. + ID *string + + // READ-ONLY; Resource name. + Name *string + + // READ-ONLY; Resource type. + Type *string } -// RecoverableManagedDatabasesClientGetOptions contains the optional parameters for the RecoverableManagedDatabasesClient.Get -// method. -type RecoverableManagedDatabasesClientGetOptions struct { - // placeholder for future optional parameters +// RefreshExternalGovernanceStatusOperationResultProperties - Contains the operation result properties for refresh external +// governance status operation. +type RefreshExternalGovernanceStatusOperationResultProperties struct { + // READ-ONLY; Error message. + ErrorMessage *string + + // READ-ONLY; Queued time. + QueuedTime *string + + // READ-ONLY; Request Id. + RequestID *string + + // READ-ONLY; Request type. + RequestType *string + + // READ-ONLY; Server name. + ServerName *string + + // READ-ONLY; Operation status. + Status *string } -// RecoverableManagedDatabasesClientListByInstanceOptions contains the optional parameters for the RecoverableManagedDatabasesClient.NewListByInstancePager -// method. -type RecoverableManagedDatabasesClientListByInstanceOptions struct { - // placeholder for future optional parameters +// Remediation - SQL Vulnerability Assessment remediation Details. +type Remediation struct { + // READ-ONLY; SQL Vulnerability Assessment is remediation automated. + Automated *bool + + // READ-ONLY; SQL Vulnerability Assessment remediation description. + Description *string + + // READ-ONLY; SQL Vulnerability Assessment optional link to remediate in Azure Portal. + PortalLink *string + + // READ-ONLY; SQL Vulnerability Assessment remediation script. + Scripts []*string } // ReplicationLink - A replication link. type ReplicationLink struct { // Resource properties. - Properties *ReplicationLinkProperties `json:"properties,omitempty"` + Properties *ReplicationLinkProperties // READ-ONLY; Resource ID. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; Resource name. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // ReplicationLinkListResult - A list of replication links. type ReplicationLinkListResult struct { // READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` + NextLink *string // READ-ONLY; Array of results. - Value []*ReplicationLink `json:"value,omitempty" azure:"ro"` + Value []*ReplicationLink } // ReplicationLinkProperties - Properties of a replication link. type ReplicationLinkProperties struct { // READ-ONLY; Whether the user is currently allowed to terminate the link. - IsTerminationAllowed *bool `json:"isTerminationAllowed,omitempty" azure:"ro"` + IsTerminationAllowed *bool - // READ-ONLY; Link type (GEO, NAMED). - LinkType *ReplicationLinkType `json:"linkType,omitempty" azure:"ro"` + // READ-ONLY; Link type (GEO, NAMED, STANDBY). + LinkType *ReplicationLinkType // READ-ONLY; Resource partner database. - PartnerDatabase *string `json:"partnerDatabase,omitempty" azure:"ro"` + PartnerDatabase *string + + // READ-ONLY; Resource partner database Id. + PartnerDatabaseID *string // READ-ONLY; Resource partner location. - PartnerLocation *string `json:"partnerLocation,omitempty" azure:"ro"` + PartnerLocation *string // READ-ONLY; Partner replication role. - PartnerRole *ReplicationRole `json:"partnerRole,omitempty" azure:"ro"` + PartnerRole *ReplicationRole // READ-ONLY; Resource partner server. - PartnerServer *string `json:"partnerServer,omitempty" azure:"ro"` + PartnerServer *string // READ-ONLY; Seeding completion percentage for the link. - PercentComplete *int32 `json:"percentComplete,omitempty" azure:"ro"` + PercentComplete *int32 // READ-ONLY; Replication mode. - ReplicationMode *string `json:"replicationMode,omitempty" azure:"ro"` + ReplicationMode *string // READ-ONLY; Replication state (PENDING, SEEDING, CATCHUP, SUSPENDED). - ReplicationState *ReplicationState `json:"replicationState,omitempty" azure:"ro"` + ReplicationState *ReplicationState // READ-ONLY; Local replication role. - Role *ReplicationRole `json:"role,omitempty" azure:"ro"` + Role *ReplicationRole // READ-ONLY; Time at which the link was created. - StartTime *time.Time `json:"startTime,omitempty" azure:"ro"` -} - -// ReplicationLinksClientBeginFailoverAllowDataLossOptions contains the optional parameters for the ReplicationLinksClient.BeginFailoverAllowDataLoss -// method. -type ReplicationLinksClientBeginFailoverAllowDataLossOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ReplicationLinksClientBeginFailoverOptions contains the optional parameters for the ReplicationLinksClient.BeginFailover -// method. -type ReplicationLinksClientBeginFailoverOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ReplicationLinksClientDeleteOptions contains the optional parameters for the ReplicationLinksClient.Delete method. -type ReplicationLinksClientDeleteOptions struct { - // placeholder for future optional parameters -} - -// ReplicationLinksClientGetOptions contains the optional parameters for the ReplicationLinksClient.Get method. -type ReplicationLinksClientGetOptions struct { - // placeholder for future optional parameters -} - -// ReplicationLinksClientListByDatabaseOptions contains the optional parameters for the ReplicationLinksClient.NewListByDatabasePager -// method. -type ReplicationLinksClientListByDatabaseOptions struct { - // placeholder for future optional parameters -} - -// ReplicationLinksClientListByServerOptions contains the optional parameters for the ReplicationLinksClient.NewListByServerPager -// method. -type ReplicationLinksClientListByServerOptions struct { - // placeholder for future optional parameters + StartTime *time.Time } // Resource - ARM resource. type Resource struct { // READ-ONLY; Resource ID. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; Resource name. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // ResourceIdentity - Azure Active Directory identity configuration for a resource. type ResourceIdentity struct { // The identity type. Set this to 'SystemAssigned' in order to automatically create and assign an Azure Active Directory principal // for the resource. - Type *IdentityType `json:"type,omitempty"` + Type *IdentityType // The resource ids of the user assigned identities to use - UserAssignedIdentities map[string]*UserIdentity `json:"userAssignedIdentities,omitempty"` + UserAssignedIdentities map[string]*UserIdentity // READ-ONLY; The Azure Active Directory principal id. - PrincipalID *string `json:"principalId,omitempty" azure:"ro"` + PrincipalID *string // READ-ONLY; The Azure Active Directory tenant id. - TenantID *string `json:"tenantId,omitempty" azure:"ro"` + TenantID *string } // ResourceMoveDefinition - Contains the information necessary to perform a resource move (rename). type ResourceMoveDefinition struct { // REQUIRED; The target ID for the resource - ID *string `json:"id,omitempty"` + ID *string } // ResourceWithWritableName - ARM resource. type ResourceWithWritableName struct { // Resource name. - Name *string `json:"name,omitempty"` + Name *string // READ-ONLY; Resource ID. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // RestorableDroppedDatabase - A restorable dropped database resource. type RestorableDroppedDatabase struct { // Resource location. - Location *string `json:"location,omitempty"` + Location *string // Resource properties. - Properties *RestorableDroppedDatabaseProperties `json:"properties,omitempty"` + Properties *RestorableDroppedDatabaseProperties // The name and tier of the SKU. - SKU *SKU `json:"sku,omitempty"` + SKU *SKU // Resource tags. - Tags map[string]*string `json:"tags,omitempty"` + Tags map[string]*string // READ-ONLY; Resource ID. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; Resource name. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // RestorableDroppedDatabaseListResult - A list of restorable dropped databases. type RestorableDroppedDatabaseListResult struct { // READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` + NextLink *string // READ-ONLY; Array of results. - Value []*RestorableDroppedDatabase `json:"value,omitempty" azure:"ro"` + Value []*RestorableDroppedDatabase } // RestorableDroppedDatabaseProperties - The restorable dropped database's properties. type RestorableDroppedDatabaseProperties struct { + // The resource ids of the user assigned identities to use + Keys map[string]*DatabaseKey + // READ-ONLY; The storage account type used to store backups for this database. - BackupStorageRedundancy *BackupStorageRedundancy `json:"backupStorageRedundancy,omitempty" azure:"ro"` + BackupStorageRedundancy *BackupStorageRedundancy // READ-ONLY; The creation date of the database (ISO8601 format). - CreationDate *time.Time `json:"creationDate,omitempty" azure:"ro"` + CreationDate *time.Time // READ-ONLY; The name of the database. - DatabaseName *string `json:"databaseName,omitempty" azure:"ro"` + DatabaseName *string // READ-ONLY; The deletion date of the database (ISO8601 format). - DeletionDate *time.Time `json:"deletionDate,omitempty" azure:"ro"` + DeletionDate *time.Time // READ-ONLY; The earliest restore date of the database (ISO8601 format). - EarliestRestoreDate *time.Time `json:"earliestRestoreDate,omitempty" azure:"ro"` + EarliestRestoreDate *time.Time // READ-ONLY; The max size of the database expressed in bytes. - MaxSizeBytes *int64 `json:"maxSizeBytes,omitempty" azure:"ro"` -} - -// RestorableDroppedDatabasesClientGetOptions contains the optional parameters for the RestorableDroppedDatabasesClient.Get -// method. -type RestorableDroppedDatabasesClientGetOptions struct { - // placeholder for future optional parameters -} - -// RestorableDroppedDatabasesClientListByServerOptions contains the optional parameters for the RestorableDroppedDatabasesClient.NewListByServerPager -// method. -type RestorableDroppedDatabasesClientListByServerOptions struct { - // placeholder for future optional parameters + MaxSizeBytes *int64 } // RestorableDroppedManagedDatabase - A restorable dropped managed database resource. type RestorableDroppedManagedDatabase struct { // REQUIRED; Resource location. - Location *string `json:"location,omitempty"` + Location *string // Resource properties. - Properties *RestorableDroppedManagedDatabaseProperties `json:"properties,omitempty"` + Properties *RestorableDroppedManagedDatabaseProperties // Resource tags. - Tags map[string]*string `json:"tags,omitempty"` + Tags map[string]*string // READ-ONLY; Resource ID. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; Resource name. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // RestorableDroppedManagedDatabaseListResult - A list of restorable dropped managed databases. type RestorableDroppedManagedDatabaseListResult struct { // READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` + NextLink *string // READ-ONLY; Array of results. - Value []*RestorableDroppedManagedDatabase `json:"value,omitempty" azure:"ro"` + Value []*RestorableDroppedManagedDatabase } // RestorableDroppedManagedDatabaseProperties - The restorable dropped managed database's properties. type RestorableDroppedManagedDatabaseProperties struct { // READ-ONLY; The creation date of the database (ISO8601 format). - CreationDate *time.Time `json:"creationDate,omitempty" azure:"ro"` + CreationDate *time.Time // READ-ONLY; The name of the database. - DatabaseName *string `json:"databaseName,omitempty" azure:"ro"` + DatabaseName *string // READ-ONLY; The deletion date of the database (ISO8601 format). - DeletionDate *time.Time `json:"deletionDate,omitempty" azure:"ro"` + DeletionDate *time.Time // READ-ONLY; The earliest restore date of the database (ISO8601 format). - EarliestRestoreDate *time.Time `json:"earliestRestoreDate,omitempty" azure:"ro"` -} - -// RestorableDroppedManagedDatabasesClientGetOptions contains the optional parameters for the RestorableDroppedManagedDatabasesClient.Get -// method. -type RestorableDroppedManagedDatabasesClientGetOptions struct { - // placeholder for future optional parameters -} - -// RestorableDroppedManagedDatabasesClientListByInstanceOptions contains the optional parameters for the RestorableDroppedManagedDatabasesClient.NewListByInstancePager -// method. -type RestorableDroppedManagedDatabasesClientListByInstanceOptions struct { - // placeholder for future optional parameters + EarliestRestoreDate *time.Time } // RestorePoint - Database restore points. type RestorePoint struct { // Resource properties. - Properties *RestorePointProperties `json:"properties,omitempty"` + Properties *RestorePointProperties // READ-ONLY; Resource ID. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; Resource location. - Location *string `json:"location,omitempty" azure:"ro"` + Location *string // READ-ONLY; Resource name. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // RestorePointListResult - A list of long term retention backups. type RestorePointListResult struct { // READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` + NextLink *string // READ-ONLY; Array of results. - Value []*RestorePoint `json:"value,omitempty" azure:"ro"` + Value []*RestorePoint } // RestorePointProperties - Properties of a database restore point type RestorePointProperties struct { // READ-ONLY; The earliest time to which this database can be restored - EarliestRestoreDate *time.Time `json:"earliestRestoreDate,omitempty" azure:"ro"` + EarliestRestoreDate *time.Time // READ-ONLY; The time the backup was taken - RestorePointCreationDate *time.Time `json:"restorePointCreationDate,omitempty" azure:"ro"` + RestorePointCreationDate *time.Time // READ-ONLY; The label of restore point for backup request by user - RestorePointLabel *string `json:"restorePointLabel,omitempty" azure:"ro"` + RestorePointLabel *string // READ-ONLY; The type of restore point - RestorePointType *RestorePointType `json:"restorePointType,omitempty" azure:"ro"` -} - -// RestorePointsClientBeginCreateOptions contains the optional parameters for the RestorePointsClient.BeginCreate method. -type RestorePointsClientBeginCreateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// RestorePointsClientDeleteOptions contains the optional parameters for the RestorePointsClient.Delete method. -type RestorePointsClientDeleteOptions struct { - // placeholder for future optional parameters -} - -// RestorePointsClientGetOptions contains the optional parameters for the RestorePointsClient.Get method. -type RestorePointsClientGetOptions struct { - // placeholder for future optional parameters -} - -// RestorePointsClientListByDatabaseOptions contains the optional parameters for the RestorePointsClient.NewListByDatabasePager -// method. -type RestorePointsClientListByDatabaseOptions struct { - // placeholder for future optional parameters + RestorePointType *RestorePointType } // SKU - An ARM Resource SKU. type SKU struct { // REQUIRED; The name of the SKU, typically, a letter + Number code, e.g. P3. - Name *string `json:"name,omitempty"` + Name *string // Capacity of the particular SKU. - Capacity *int32 `json:"capacity,omitempty"` + Capacity *int32 // If the service has different generations of hardware, for the same SKU, then that can be captured here. - Family *string `json:"family,omitempty"` + Family *string // Size of the particular SKU - Size *string `json:"size,omitempty"` + Size *string // The tier or edition of the particular SKU, e.g. Basic, Premium. - Tier *string `json:"tier,omitempty"` + Tier *string +} + +// ScheduleItem - Schedule info describing when the server should be started or stopped. +type ScheduleItem struct { + // REQUIRED; Start day. + StartDay *DayOfWeek + + // REQUIRED; Start time. + StartTime *string + + // REQUIRED; Stop day. + StopDay *DayOfWeek + + // REQUIRED; Stop time. + StopTime *string } // SecurityAlertPolicyProperties - Properties of a security alert policy. type SecurityAlertPolicyProperties struct { // REQUIRED; Specifies the state of the policy, whether it is enabled or disabled or a policy has not been applied yet on // the specific database. - State *SecurityAlertPolicyState `json:"state,omitempty"` + State *SecurityAlertPolicyState // Specifies an array of alerts that are disabled. Allowed values are: SqlInjection, SqlInjectionVulnerability, AccessAnomaly, // DataExfiltration, UnsafeAction, Brute_Force - DisabledAlerts []*string `json:"disabledAlerts,omitempty"` + DisabledAlerts []*string // Specifies that the alert is sent to the account administrators. - EmailAccountAdmins *bool `json:"emailAccountAdmins,omitempty"` + EmailAccountAdmins *bool // Specifies an array of e-mail addresses to which the alert is sent. - EmailAddresses []*string `json:"emailAddresses,omitempty"` + EmailAddresses []*string // Specifies the number of days to keep in the Threat Detection audit logs. - RetentionDays *int32 `json:"retentionDays,omitempty"` + RetentionDays *int32 // Specifies the identifier key of the Threat Detection audit storage account. - StorageAccountAccessKey *string `json:"storageAccountAccessKey,omitempty"` + StorageAccountAccessKey *string // Specifies the blob storage endpoint (e.g. https://MyAccount.blob.core.windows.net). This blob storage will hold all Threat // Detection audit logs. - StorageEndpoint *string `json:"storageEndpoint,omitempty"` + StorageEndpoint *string // READ-ONLY; Specifies the UTC creation time of the policy. - CreationTime *time.Time `json:"creationTime,omitempty" azure:"ro"` + CreationTime *time.Time } // SecurityAlertsPolicyProperties - Properties of a security alert policy. type SecurityAlertsPolicyProperties struct { // REQUIRED; Specifies the state of the policy, whether it is enabled or disabled or a policy has not been applied yet on // the specific database. - State *SecurityAlertsPolicyState `json:"state,omitempty"` + State *SecurityAlertsPolicyState // Specifies an array of alerts that are disabled. Allowed values are: SqlInjection, SqlInjectionVulnerability, AccessAnomaly, // DataExfiltration, UnsafeAction, Brute_Force - DisabledAlerts []*string `json:"disabledAlerts,omitempty"` + DisabledAlerts []*string // Specifies that the alert is sent to the account administrators. - EmailAccountAdmins *bool `json:"emailAccountAdmins,omitempty"` + EmailAccountAdmins *bool // Specifies an array of e-mail addresses to which the alert is sent. - EmailAddresses []*string `json:"emailAddresses,omitempty"` + EmailAddresses []*string // Specifies the number of days to keep in the Threat Detection audit logs. - RetentionDays *int32 `json:"retentionDays,omitempty"` + RetentionDays *int32 // Specifies the identifier key of the Threat Detection audit storage account. - StorageAccountAccessKey *string `json:"storageAccountAccessKey,omitempty"` + StorageAccountAccessKey *string // Specifies the blob storage endpoint (e.g. https://MyAccount.blob.core.windows.net). This blob storage will hold all Threat // Detection audit logs. - StorageEndpoint *string `json:"storageEndpoint,omitempty"` + StorageEndpoint *string // READ-ONLY; Specifies the UTC creation time of the policy. - CreationTime *time.Time `json:"creationTime,omitempty" azure:"ro"` + CreationTime *time.Time } // SecurityEvent - A security event. type SecurityEvent struct { // Resource properties. - Properties *SecurityEventProperties `json:"properties,omitempty"` + Properties *SecurityEventProperties // READ-ONLY; Resource ID. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; Resource name. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // SecurityEventCollection - A list of security events. type SecurityEventCollection struct { // READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` + NextLink *string // READ-ONLY; Array of results. - Value []*SecurityEvent `json:"value,omitempty" azure:"ro"` + Value []*SecurityEvent } // SecurityEventProperties - The properties of a security event. type SecurityEventProperties struct { // READ-ONLY; The application used to execute the statement. - ApplicationName *string `json:"applicationName,omitempty" azure:"ro"` + ApplicationName *string // READ-ONLY; The IP address of the client who executed the statement. - ClientIP *string `json:"clientIp,omitempty" azure:"ro"` + ClientIP *string // READ-ONLY; The database name - Database *string `json:"database,omitempty" azure:"ro"` + Database *string // READ-ONLY; The time when the security event occurred. - EventTime *time.Time `json:"eventTime,omitempty" azure:"ro"` + EventTime *time.Time // READ-ONLY; The principal user who executed the statement - PrincipalName *string `json:"principalName,omitempty" azure:"ro"` + PrincipalName *string // READ-ONLY; The sql injection additional properties, populated only if the type of the security event is sql injection. - SecurityEventSQLInjectionAdditionalProperties *SecurityEventSQLInjectionAdditionalProperties `json:"securityEventSqlInjectionAdditionalProperties,omitempty" azure:"ro"` + SecurityEventSQLInjectionAdditionalProperties *SecurityEventSQLInjectionAdditionalProperties // READ-ONLY; The type of the security event. - SecurityEventType *SecurityEventType `json:"securityEventType,omitempty" azure:"ro"` + SecurityEventType *SecurityEventType // READ-ONLY; The server name - Server *string `json:"server,omitempty" azure:"ro"` + Server *string // READ-ONLY; The subscription name - Subscription *string `json:"subscription,omitempty" azure:"ro"` + Subscription *string } // SecurityEventSQLInjectionAdditionalProperties - The properties of a security event sql injection additional properties. type SecurityEventSQLInjectionAdditionalProperties struct { // READ-ONLY; The sql error code - ErrorCode *int32 `json:"errorCode,omitempty" azure:"ro"` + ErrorCode *int32 // READ-ONLY; The sql error message - ErrorMessage *string `json:"errorMessage,omitempty" azure:"ro"` + ErrorMessage *string // READ-ONLY; The sql error severity - ErrorSeverity *int32 `json:"errorSeverity,omitempty" azure:"ro"` + ErrorSeverity *int32 // READ-ONLY; The statement - Statement *string `json:"statement,omitempty" azure:"ro"` + Statement *string // READ-ONLY; The statement highlight length - StatementHighlightLength *int32 `json:"statementHighlightLength,omitempty" azure:"ro"` + StatementHighlightLength *int32 // READ-ONLY; The statement highlight offset - StatementHighlightOffset *int32 `json:"statementHighlightOffset,omitempty" azure:"ro"` + StatementHighlightOffset *int32 // READ-ONLY; The threat ID. - ThreatID *string `json:"threatId,omitempty" azure:"ro"` + ThreatID *string } // SecurityEventsFilterParameters - The properties that are supported in the $filter operation. type SecurityEventsFilterParameters struct { // Filter on the event time. - EventTime *time.Time `json:"eventTime,omitempty"` + EventTime *time.Time // Whether to show server records or not. - ShowServerRecords *bool `json:"showServerRecords,omitempty"` + ShowServerRecords *bool } // SensitivityLabel - A sensitivity label. type SensitivityLabel struct { // Resource properties. - Properties *SensitivityLabelProperties `json:"properties,omitempty"` + Properties *SensitivityLabelProperties // READ-ONLY; Resource ID. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; Resource that manages the sensitivity label. - ManagedBy *string `json:"managedBy,omitempty" azure:"ro"` + ManagedBy *string // READ-ONLY; Resource name. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // SensitivityLabelListResult - A list of sensitivity labels. type SensitivityLabelListResult struct { // READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` + NextLink *string // READ-ONLY; Array of results. - Value []*SensitivityLabel `json:"value,omitempty" azure:"ro"` + Value []*SensitivityLabel } // SensitivityLabelProperties - Properties of a sensitivity label. type SensitivityLabelProperties struct { // The information type. - InformationType *string `json:"informationType,omitempty"` + InformationType *string // The information type ID. - InformationTypeID *string `json:"informationTypeId,omitempty"` + InformationTypeID *string // The label ID. - LabelID *string `json:"labelId,omitempty"` + LabelID *string // The label name. - LabelName *string `json:"labelName,omitempty"` - Rank *SensitivityLabelRank `json:"rank,omitempty"` + LabelName *string + Rank *SensitivityLabelRank // READ-ONLY; The column name. - ColumnName *string `json:"columnName,omitempty" azure:"ro"` + ColumnName *string // READ-ONLY; Is sensitivity recommendation disabled. Applicable for recommended sensitivity label only. Specifies whether // the sensitivity recommendation on this column is disabled (dismissed) or not. - IsDisabled *bool `json:"isDisabled,omitempty" azure:"ro"` + IsDisabled *bool // READ-ONLY; The schema name. - SchemaName *string `json:"schemaName,omitempty" azure:"ro"` + SchemaName *string // READ-ONLY; The table name. - TableName *string `json:"tableName,omitempty" azure:"ro"` + TableName *string } // SensitivityLabelUpdate - A sensitivity label update operation. type SensitivityLabelUpdate struct { // Resource properties. - Properties *SensitivityLabelUpdateProperties `json:"properties,omitempty"` + Properties *SensitivityLabelUpdateProperties // READ-ONLY; Resource ID. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; Resource name. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // SensitivityLabelUpdateList - A list of sensitivity label update operations. type SensitivityLabelUpdateList struct { - Operations []*SensitivityLabelUpdate `json:"operations,omitempty"` + Operations []*SensitivityLabelUpdate } // SensitivityLabelUpdateProperties - Properties of an operation executed on a sensitivity label. type SensitivityLabelUpdateProperties struct { // REQUIRED; Column name to update. - Column *string `json:"column,omitempty"` + Column *string // REQUIRED - Op *SensitivityLabelUpdateKind `json:"op,omitempty"` + Op *SensitivityLabelUpdateKind // REQUIRED; Schema name of the column to update. - Schema *string `json:"schema,omitempty"` + Schema *string // REQUIRED; Table name of the column to update. - Table *string `json:"table,omitempty"` + Table *string // The sensitivity label information to apply on a column. - SensitivityLabel *SensitivityLabel `json:"sensitivityLabel,omitempty"` -} - -// SensitivityLabelsClientCreateOrUpdateOptions contains the optional parameters for the SensitivityLabelsClient.CreateOrUpdate -// method. -type SensitivityLabelsClientCreateOrUpdateOptions struct { - // placeholder for future optional parameters -} - -// SensitivityLabelsClientDeleteOptions contains the optional parameters for the SensitivityLabelsClient.Delete method. -type SensitivityLabelsClientDeleteOptions struct { - // placeholder for future optional parameters -} - -// SensitivityLabelsClientDisableRecommendationOptions contains the optional parameters for the SensitivityLabelsClient.DisableRecommendation -// method. -type SensitivityLabelsClientDisableRecommendationOptions struct { - // placeholder for future optional parameters -} - -// SensitivityLabelsClientEnableRecommendationOptions contains the optional parameters for the SensitivityLabelsClient.EnableRecommendation -// method. -type SensitivityLabelsClientEnableRecommendationOptions struct { - // placeholder for future optional parameters -} - -// SensitivityLabelsClientGetOptions contains the optional parameters for the SensitivityLabelsClient.Get method. -type SensitivityLabelsClientGetOptions struct { - // placeholder for future optional parameters -} - -// SensitivityLabelsClientListCurrentByDatabaseOptions contains the optional parameters for the SensitivityLabelsClient.NewListCurrentByDatabasePager -// method. -type SensitivityLabelsClientListCurrentByDatabaseOptions struct { - Count *bool - // An OData filter expression that filters elements in the collection. - Filter *string - SkipToken *string -} - -// SensitivityLabelsClientListRecommendedByDatabaseOptions contains the optional parameters for the SensitivityLabelsClient.NewListRecommendedByDatabasePager -// method. -type SensitivityLabelsClientListRecommendedByDatabaseOptions struct { - // An OData filter expression that filters elements in the collection. - Filter *string - // Specifies whether to include disabled recommendations or not. - IncludeDisabledRecommendations *bool - SkipToken *string -} - -// SensitivityLabelsClientUpdateOptions contains the optional parameters for the SensitivityLabelsClient.Update method. -type SensitivityLabelsClientUpdateOptions struct { - // placeholder for future optional parameters + SensitivityLabel *SensitivityLabel } // Server - An Azure SQL Database server. type Server struct { // REQUIRED; Resource location. - Location *string `json:"location,omitempty"` + Location *string // The Azure Active Directory identity of the server. - Identity *ResourceIdentity `json:"identity,omitempty"` + Identity *ResourceIdentity // Resource properties. - Properties *ServerProperties `json:"properties,omitempty"` + Properties *ServerProperties // Resource tags. - Tags map[string]*string `json:"tags,omitempty"` + Tags map[string]*string // READ-ONLY; Resource ID. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; Kind of sql server. This is metadata used for the Azure portal experience. - Kind *string `json:"kind,omitempty" azure:"ro"` + Kind *string // READ-ONLY; Resource name. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // ServerAdvancedThreatProtection - A server Advanced Threat Protection. type ServerAdvancedThreatProtection struct { // Resource properties. - Properties *AdvancedThreatProtectionProperties `json:"properties,omitempty"` + Properties *AdvancedThreatProtectionProperties // READ-ONLY; Resource ID. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; Resource name. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; SystemData of AdvancedThreatProtectionResource. - SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` + SystemData *SystemData // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` -} - -// ServerAdvancedThreatProtectionSettingsClientBeginCreateOrUpdateOptions contains the optional parameters for the ServerAdvancedThreatProtectionSettingsClient.BeginCreateOrUpdate -// method. -type ServerAdvancedThreatProtectionSettingsClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ServerAdvancedThreatProtectionSettingsClientGetOptions contains the optional parameters for the ServerAdvancedThreatProtectionSettingsClient.Get -// method. -type ServerAdvancedThreatProtectionSettingsClientGetOptions struct { - // placeholder for future optional parameters -} - -// ServerAdvancedThreatProtectionSettingsClientListByServerOptions contains the optional parameters for the ServerAdvancedThreatProtectionSettingsClient.NewListByServerPager -// method. -type ServerAdvancedThreatProtectionSettingsClientListByServerOptions struct { - // placeholder for future optional parameters -} - -// ServerAdvisorsClientGetOptions contains the optional parameters for the ServerAdvisorsClient.Get method. -type ServerAdvisorsClientGetOptions struct { - // placeholder for future optional parameters -} - -// ServerAdvisorsClientListByServerOptions contains the optional parameters for the ServerAdvisorsClient.ListByServer method. -type ServerAdvisorsClientListByServerOptions struct { - // The child resources to include in the response. - Expand *string -} - -// ServerAdvisorsClientUpdateOptions contains the optional parameters for the ServerAdvisorsClient.Update method. -type ServerAdvisorsClientUpdateOptions struct { - // placeholder for future optional parameters + Type *string } // ServerAutomaticTuning - Server-level Automatic Tuning. type ServerAutomaticTuning struct { // Resource properties. - Properties *AutomaticTuningServerProperties `json:"properties,omitempty"` + Properties *AutomaticTuningServerProperties // READ-ONLY; Resource ID. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; Resource name. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` -} - -// ServerAutomaticTuningClientGetOptions contains the optional parameters for the ServerAutomaticTuningClient.Get method. -type ServerAutomaticTuningClientGetOptions struct { - // placeholder for future optional parameters -} - -// ServerAutomaticTuningClientUpdateOptions contains the optional parameters for the ServerAutomaticTuningClient.Update method. -type ServerAutomaticTuningClientUpdateOptions struct { - // placeholder for future optional parameters + Type *string } // ServerAzureADAdministrator - Azure Active Directory administrator. type ServerAzureADAdministrator struct { // Resource properties. - Properties *AdministratorProperties `json:"properties,omitempty"` + Properties *AdministratorProperties // READ-ONLY; Resource ID. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; Resource name. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` -} - -// ServerAzureADAdministratorsClientBeginCreateOrUpdateOptions contains the optional parameters for the ServerAzureADAdministratorsClient.BeginCreateOrUpdate -// method. -type ServerAzureADAdministratorsClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ServerAzureADAdministratorsClientBeginDeleteOptions contains the optional parameters for the ServerAzureADAdministratorsClient.BeginDelete -// method. -type ServerAzureADAdministratorsClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ServerAzureADAdministratorsClientGetOptions contains the optional parameters for the ServerAzureADAdministratorsClient.Get -// method. -type ServerAzureADAdministratorsClientGetOptions struct { - // placeholder for future optional parameters -} - -// ServerAzureADAdministratorsClientListByServerOptions contains the optional parameters for the ServerAzureADAdministratorsClient.NewListByServerPager -// method. -type ServerAzureADAdministratorsClientListByServerOptions struct { - // placeholder for future optional parameters + Type *string } // ServerAzureADOnlyAuthentication - Azure Active Directory only authentication. type ServerAzureADOnlyAuthentication struct { // Resource properties. - Properties *AzureADOnlyAuthProperties `json:"properties,omitempty"` + Properties *AzureADOnlyAuthProperties // READ-ONLY; Resource ID. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; Resource name. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` -} - -// ServerAzureADOnlyAuthenticationsClientBeginCreateOrUpdateOptions contains the optional parameters for the ServerAzureADOnlyAuthenticationsClient.BeginCreateOrUpdate -// method. -type ServerAzureADOnlyAuthenticationsClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ServerAzureADOnlyAuthenticationsClientBeginDeleteOptions contains the optional parameters for the ServerAzureADOnlyAuthenticationsClient.BeginDelete -// method. -type ServerAzureADOnlyAuthenticationsClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ServerAzureADOnlyAuthenticationsClientGetOptions contains the optional parameters for the ServerAzureADOnlyAuthenticationsClient.Get -// method. -type ServerAzureADOnlyAuthenticationsClientGetOptions struct { - // placeholder for future optional parameters -} - -// ServerAzureADOnlyAuthenticationsClientListByServerOptions contains the optional parameters for the ServerAzureADOnlyAuthenticationsClient.NewListByServerPager -// method. -type ServerAzureADOnlyAuthenticationsClientListByServerOptions struct { - // placeholder for future optional parameters -} - -// ServerBlobAuditingPoliciesClientBeginCreateOrUpdateOptions contains the optional parameters for the ServerBlobAuditingPoliciesClient.BeginCreateOrUpdate -// method. -type ServerBlobAuditingPoliciesClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ServerBlobAuditingPoliciesClientGetOptions contains the optional parameters for the ServerBlobAuditingPoliciesClient.Get -// method. -type ServerBlobAuditingPoliciesClientGetOptions struct { - // placeholder for future optional parameters -} - -// ServerBlobAuditingPoliciesClientListByServerOptions contains the optional parameters for the ServerBlobAuditingPoliciesClient.NewListByServerPager -// method. -type ServerBlobAuditingPoliciesClientListByServerOptions struct { - // placeholder for future optional parameters + Type *string } // ServerBlobAuditingPolicy - A server blob auditing policy. type ServerBlobAuditingPolicy struct { // Resource properties. - Properties *ServerBlobAuditingPolicyProperties `json:"properties,omitempty"` + Properties *ServerBlobAuditingPolicyProperties // READ-ONLY; Resource ID. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; Resource name. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // ServerBlobAuditingPolicyListResult - A list of server auditing settings. type ServerBlobAuditingPolicyListResult struct { // READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` + NextLink *string // READ-ONLY; Array of results. - Value []*ServerBlobAuditingPolicy `json:"value,omitempty" azure:"ro"` + Value []*ServerBlobAuditingPolicy } // ServerBlobAuditingPolicyProperties - Properties of a server blob auditing policy. type ServerBlobAuditingPolicyProperties struct { // REQUIRED; Specifies the state of the audit. If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled are required. - State *BlobAuditingPolicyState `json:"state,omitempty"` + State *BlobAuditingPolicyState // Specifies the Actions-Groups and Actions to audit. // The recommended set of action groups to use is the following combination - this will audit all the queries and stored procedures @@ -8187,7 +6543,7 @@ type ServerBlobAuditingPolicyProperties struct { // For example: SELECT on dbo.myTable by public SELECT on DATABASE::myDatabase by public SELECT on SCHEMA::mySchema by public // For more information, see Database-Level Audit Actions // [https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-actions] - AuditActionsAndGroups []*string `json:"auditActionsAndGroups,omitempty"` + AuditActionsAndGroups []*string // Specifies whether audit events are sent to Azure Monitor. In order to send the events to Azure Monitor, specify 'State' // as 'Enabled' and 'IsAzureMonitorTargetEnabled' as true. @@ -8198,7 +6554,7 @@ type ServerBlobAuditingPolicyProperties struct { // https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview // For more information, see Diagnostic Settings REST API [https://go.microsoft.com/fwlink/?linkid=2033207]or Diagnostic Settings // PowerShell [https://go.microsoft.com/fwlink/?linkid=2033043] - IsAzureMonitorTargetEnabled *bool `json:"isAzureMonitorTargetEnabled,omitempty"` + IsAzureMonitorTargetEnabled *bool // Specifies the state of devops audit. If state is Enabled, devops logs will be sent to Azure Monitor. In order to send the // events to Azure Monitor, specify 'State' as 'Enabled', @@ -8209,20 +6565,20 @@ type ServerBlobAuditingPolicyProperties struct { // https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/master/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview // For more information, see Diagnostic Settings REST API [https://go.microsoft.com/fwlink/?linkid=2033207]or Diagnostic Settings // PowerShell [https://go.microsoft.com/fwlink/?linkid=2033043] - IsDevopsAuditEnabled *bool `json:"isDevopsAuditEnabled,omitempty"` + IsDevopsAuditEnabled *bool // Specifies whether Managed Identity is used to access blob storage - IsManagedIdentityInUse *bool `json:"isManagedIdentityInUse,omitempty"` + IsManagedIdentityInUse *bool // Specifies whether storageAccountAccessKey value is the storage's secondary key. - IsStorageSecondaryKeyInUse *bool `json:"isStorageSecondaryKeyInUse,omitempty"` + IsStorageSecondaryKeyInUse *bool // Specifies the amount of time in milliseconds that can elapse before audit actions are forced to be processed. The default // minimum value is 1000 (1 second). The maximum is 2,147,483,647. - QueueDelayMs *int32 `json:"queueDelayMs,omitempty"` + QueueDelayMs *int32 // Specifies the number of days to keep in the audit logs in the storage account. - RetentionDays *int32 `json:"retentionDays,omitempty"` + RetentionDays *int32 // Specifies the identifier key of the auditing storage account. If state is Enabled and storageEndpoint is specified, not // specifying the storageAccountAccessKey will use SQL server system-assigned @@ -8231,229 +6587,134 @@ type ServerBlobAuditingPolicyProperties struct { // 2. Grant SQL Server identity access to the storage account by adding 'Storage Blob Data Contributor' RBAC role to the server // identity. For more information, see Auditing to storage using Managed // Identity authentication [https://go.microsoft.com/fwlink/?linkid=2114355] - StorageAccountAccessKey *string `json:"storageAccountAccessKey,omitempty"` + StorageAccountAccessKey *string // Specifies the blob storage subscription Id. - StorageAccountSubscriptionID *string `json:"storageAccountSubscriptionId,omitempty"` + StorageAccountSubscriptionID *string // Specifies the blob storage endpoint (e.g. https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint // or isAzureMonitorTargetEnabled is required. - StorageEndpoint *string `json:"storageEndpoint,omitempty"` + StorageEndpoint *string } -// ServerCommunicationLink - Server communication link. -type ServerCommunicationLink struct { - // The properties of resource. - Properties *ServerCommunicationLinkProperties `json:"properties,omitempty"` +// ServerConfigurationOption - A server configuration option +type ServerConfigurationOption struct { + // Resource properties. + Properties *ServerConfigurationOptionProperties // READ-ONLY; Resource ID. - ID *string `json:"id,omitempty" azure:"ro"` - - // READ-ONLY; Communication link kind. This property is used for Azure Portal metadata. - Kind *string `json:"kind,omitempty" azure:"ro"` - - // READ-ONLY; Communication link location. - Location *string `json:"location,omitempty" azure:"ro"` + ID *string // READ-ONLY; Resource name. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` -} - -// ServerCommunicationLinkListResult - A list of server communication links. -type ServerCommunicationLinkListResult struct { - // The list of server communication links. - Value []*ServerCommunicationLink `json:"value,omitempty"` -} - -// ServerCommunicationLinkProperties - The properties of a server communication link. -type ServerCommunicationLinkProperties struct { - // REQUIRED; The name of the partner server. - PartnerServer *string `json:"partnerServer,omitempty"` - - // READ-ONLY; The state. - State *string `json:"state,omitempty" azure:"ro"` -} - -// ServerCommunicationLinksClientBeginCreateOrUpdateOptions contains the optional parameters for the ServerCommunicationLinksClient.BeginCreateOrUpdate -// method. -type ServerCommunicationLinksClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ServerCommunicationLinksClientDeleteOptions contains the optional parameters for the ServerCommunicationLinksClient.Delete -// method. -type ServerCommunicationLinksClientDeleteOptions struct { - // placeholder for future optional parameters -} - -// ServerCommunicationLinksClientGetOptions contains the optional parameters for the ServerCommunicationLinksClient.Get method. -type ServerCommunicationLinksClientGetOptions struct { - // placeholder for future optional parameters + Type *string } -// ServerCommunicationLinksClientListByServerOptions contains the optional parameters for the ServerCommunicationLinksClient.NewListByServerPager -// method. -type ServerCommunicationLinksClientListByServerOptions struct { - // placeholder for future optional parameters -} +// ServerConfigurationOptionListResult - A list of server configuration options. +type ServerConfigurationOptionListResult struct { + // READ-ONLY; Link to retrieve next page of results. + NextLink *string -// ServerConnectionPoliciesClientBeginCreateOrUpdateOptions contains the optional parameters for the ServerConnectionPoliciesClient.BeginCreateOrUpdate -// method. -type ServerConnectionPoliciesClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string + // READ-ONLY; Array of results. + Value []*ServerConfigurationOption } -// ServerConnectionPoliciesClientGetOptions contains the optional parameters for the ServerConnectionPoliciesClient.Get method. -type ServerConnectionPoliciesClientGetOptions struct { - // placeholder for future optional parameters -} +// ServerConfigurationOptionProperties - The properties of server configuration option. +type ServerConfigurationOptionProperties struct { + // REQUIRED; Value of the server configuration option. + ServerConfigurationOptionValue *int32 -// ServerConnectionPoliciesClientListByServerOptions contains the optional parameters for the ServerConnectionPoliciesClient.NewListByServerPager -// method. -type ServerConnectionPoliciesClientListByServerOptions struct { - // placeholder for future optional parameters + // READ-ONLY; Provisioning state of server configuration option. + ProvisioningState *ProvisioningState } // ServerConnectionPolicy - A server connection policy type ServerConnectionPolicy struct { // Resource properties. - Properties *ServerConnectionPolicyProperties `json:"properties,omitempty"` + Properties *ServerConnectionPolicyProperties // READ-ONLY; Resource ID. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; Metadata used for the Azure portal experience. - Kind *string `json:"kind,omitempty" azure:"ro"` + Kind *string // READ-ONLY; Resource location. - Location *string `json:"location,omitempty" azure:"ro"` + Location *string // READ-ONLY; Resource name. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // ServerConnectionPolicyListResult - A list of server connection policy objects. type ServerConnectionPolicyListResult struct { // READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` + NextLink *string // READ-ONLY; Array of results. - Value []*ServerConnectionPolicy `json:"value,omitempty" azure:"ro"` + Value []*ServerConnectionPolicy } // ServerConnectionPolicyProperties - The properties of a server connection policy. type ServerConnectionPolicyProperties struct { // REQUIRED; The server connection type. - ConnectionType *ServerConnectionType `json:"connectionType,omitempty"` + ConnectionType *ServerConnectionType } // ServerDNSAlias - A server DNS alias. type ServerDNSAlias struct { // Resource properties. - Properties *ServerDNSAliasProperties `json:"properties,omitempty"` + Properties *ServerDNSAliasProperties // READ-ONLY; Resource ID. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; Resource name. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // ServerDNSAliasAcquisition - A server dns alias acquisition request. type ServerDNSAliasAcquisition struct { // REQUIRED; The id of the server alias that will be acquired to point to this server instead. - OldServerDNSAliasID *string `json:"oldServerDnsAliasId,omitempty"` + OldServerDNSAliasID *string } // ServerDNSAliasListResult - A list of server DNS aliases. type ServerDNSAliasListResult struct { // READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` + NextLink *string // READ-ONLY; Array of results. - Value []*ServerDNSAlias `json:"value,omitempty" azure:"ro"` + Value []*ServerDNSAlias } // ServerDNSAliasProperties - Properties of a server DNS alias. type ServerDNSAliasProperties struct { // READ-ONLY; The fully qualified DNS record for alias - AzureDNSRecord *string `json:"azureDnsRecord,omitempty" azure:"ro"` -} - -// ServerDNSAliasesClientBeginAcquireOptions contains the optional parameters for the ServerDNSAliasesClient.BeginAcquire -// method. -type ServerDNSAliasesClientBeginAcquireOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ServerDNSAliasesClientBeginCreateOrUpdateOptions contains the optional parameters for the ServerDNSAliasesClient.BeginCreateOrUpdate -// method. -type ServerDNSAliasesClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ServerDNSAliasesClientBeginDeleteOptions contains the optional parameters for the ServerDNSAliasesClient.BeginDelete method. -type ServerDNSAliasesClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ServerDNSAliasesClientGetOptions contains the optional parameters for the ServerDNSAliasesClient.Get method. -type ServerDNSAliasesClientGetOptions struct { - // placeholder for future optional parameters -} - -// ServerDNSAliasesClientListByServerOptions contains the optional parameters for the ServerDNSAliasesClient.NewListByServerPager -// method. -type ServerDNSAliasesClientListByServerOptions struct { - // placeholder for future optional parameters -} - -// ServerDevOpsAuditSettingsClientBeginCreateOrUpdateOptions contains the optional parameters for the ServerDevOpsAuditSettingsClient.BeginCreateOrUpdate -// method. -type ServerDevOpsAuditSettingsClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ServerDevOpsAuditSettingsClientGetOptions contains the optional parameters for the ServerDevOpsAuditSettingsClient.Get -// method. -type ServerDevOpsAuditSettingsClientGetOptions struct { - // placeholder for future optional parameters -} - -// ServerDevOpsAuditSettingsClientListByServerOptions contains the optional parameters for the ServerDevOpsAuditSettingsClient.NewListByServerPager -// method. -type ServerDevOpsAuditSettingsClientListByServerOptions struct { - // placeholder for future optional parameters + AzureDNSRecord *string } // ServerDevOpsAuditSettingsListResult - A list of server DevOps audit settings. type ServerDevOpsAuditSettingsListResult struct { // READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` + NextLink *string // READ-ONLY; Array of results. - Value []*ServerDevOpsAuditingSettings `json:"value,omitempty" azure:"ro"` + Value []*ServerDevOpsAuditingSettings } // ServerDevOpsAuditSettingsProperties - Properties of a server DevOps audit settings. type ServerDevOpsAuditSettingsProperties struct { // REQUIRED; Specifies the state of the audit. If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled are required. - State *BlobAuditingPolicyState `json:"state,omitempty"` + State *BlobAuditingPolicyState // Specifies whether DevOps audit events are sent to Azure Monitor. In order to send the events to Azure Monitor, specify // 'State' as 'Enabled' and 'IsAzureMonitorTargetEnabled' as true. @@ -8463,7 +6724,10 @@ type ServerDevOpsAuditSettingsProperties struct { // https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/master/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview // For more information, see Diagnostic Settings REST API [https://go.microsoft.com/fwlink/?linkid=2033207]or Diagnostic Settings // PowerShell [https://go.microsoft.com/fwlink/?linkid=2033043] - IsAzureMonitorTargetEnabled *bool `json:"isAzureMonitorTargetEnabled,omitempty"` + IsAzureMonitorTargetEnabled *bool + + // Specifies whether Managed Identity is used to access blob storage + IsManagedIdentityInUse *bool // Specifies the identifier key of the auditing storage account. If state is Enabled and storageEndpoint is specified, not // specifying the storageAccountAccessKey will use SQL server system-assigned @@ -8472,1932 +6736,1700 @@ type ServerDevOpsAuditSettingsProperties struct { // 2. Grant SQL Server identity access to the storage account by adding 'Storage Blob Data Contributor' RBAC role to the server // identity. For more information, see Auditing to storage using Managed // Identity authentication [https://go.microsoft.com/fwlink/?linkid=2114355] - StorageAccountAccessKey *string `json:"storageAccountAccessKey,omitempty"` + StorageAccountAccessKey *string // Specifies the blob storage subscription Id. - StorageAccountSubscriptionID *string `json:"storageAccountSubscriptionId,omitempty"` + StorageAccountSubscriptionID *string // Specifies the blob storage endpoint (e.g. https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint // or isAzureMonitorTargetEnabled is required. - StorageEndpoint *string `json:"storageEndpoint,omitempty"` + StorageEndpoint *string } // ServerDevOpsAuditingSettings - A server DevOps auditing settings. type ServerDevOpsAuditingSettings struct { // Resource properties. - Properties *ServerDevOpsAuditSettingsProperties `json:"properties,omitempty"` + Properties *ServerDevOpsAuditSettingsProperties // READ-ONLY; Resource ID. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; Resource name. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; SystemData of ServerDevOpsAuditSettingsResource. - SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` + SystemData *SystemData // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // ServerExternalAdministrator - Properties of a active directory administrator. type ServerExternalAdministrator struct { // Type of the sever administrator. - AdministratorType *AdministratorType `json:"administratorType,omitempty"` + AdministratorType *AdministratorType // Azure Active Directory only Authentication enabled. - AzureADOnlyAuthentication *bool `json:"azureADOnlyAuthentication,omitempty"` + AzureADOnlyAuthentication *bool // Login name of the server administrator. - Login *string `json:"login,omitempty"` + Login *string // Principal Type of the sever administrator. - PrincipalType *PrincipalType `json:"principalType,omitempty"` + PrincipalType *PrincipalType // SID (object ID) of the server administrator. - Sid *string `json:"sid,omitempty"` + Sid *string // Tenant ID of the administrator. - TenantID *string `json:"tenantId,omitempty"` + TenantID *string } // ServerFirewallRuleProperties - The properties of a server firewall rule. type ServerFirewallRuleProperties struct { // The end IP address of the firewall rule. Must be IPv4 format. Must be greater than or equal to startIpAddress. Use value // '0.0.0.0' for all Azure-internal IP addresses. - EndIPAddress *string `json:"endIpAddress,omitempty"` + EndIPAddress *string // The start IP address of the firewall rule. Must be IPv4 format. Use value '0.0.0.0' for all Azure-internal IP addresses. - StartIPAddress *string `json:"startIpAddress,omitempty"` + StartIPAddress *string } // ServerInfo - Server info for the server trust group. type ServerInfo struct { // REQUIRED; Server Id. - ServerID *string `json:"serverId,omitempty"` + ServerID *string } // ServerKey - A server key. type ServerKey struct { // Resource properties. - Properties *ServerKeyProperties `json:"properties,omitempty"` + Properties *ServerKeyProperties // READ-ONLY; Resource ID. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; Kind of encryption protector. This is metadata used for the Azure portal experience. - Kind *string `json:"kind,omitempty" azure:"ro"` + Kind *string // READ-ONLY; Resource location. - Location *string `json:"location,omitempty" azure:"ro"` + Location *string // READ-ONLY; Resource name. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // ServerKeyListResult - A list of server keys. type ServerKeyListResult struct { // READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` + NextLink *string // READ-ONLY; Array of results. - Value []*ServerKey `json:"value,omitempty" azure:"ro"` + Value []*ServerKey } // ServerKeyProperties - Properties for a server key execution. type ServerKeyProperties struct { // REQUIRED; The server key type like 'ServiceManaged', 'AzureKeyVault'. - ServerKeyType *ServerKeyType `json:"serverKeyType,omitempty"` + ServerKeyType *ServerKeyType - // The URI of the server key. If the ServerKeyType is AzureKeyVault, then the URI is required. - URI *string `json:"uri,omitempty"` + // The URI of the server key. If the ServerKeyType is AzureKeyVault, then the URI is required. The AKV URI is required to + // be in this format: + // 'https://YourVaultName.vault.azure.net/keys/YourKeyName/YourKeyVersion' + URI *string // READ-ONLY; Key auto rotation opt-in flag. Either true or false. - AutoRotationEnabled *bool `json:"autoRotationEnabled,omitempty" azure:"ro"` + AutoRotationEnabled *bool // READ-ONLY; The server key creation date. - CreationDate *time.Time `json:"creationDate,omitempty" azure:"ro"` + CreationDate *time.Time // READ-ONLY; Subregion of the server key. - Subregion *string `json:"subregion,omitempty" azure:"ro"` + Subregion *string // READ-ONLY; Thumbprint of the server key. - Thumbprint *string `json:"thumbprint,omitempty" azure:"ro"` -} - -// ServerKeysClientBeginCreateOrUpdateOptions contains the optional parameters for the ServerKeysClient.BeginCreateOrUpdate -// method. -type ServerKeysClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ServerKeysClientBeginDeleteOptions contains the optional parameters for the ServerKeysClient.BeginDelete method. -type ServerKeysClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ServerKeysClientGetOptions contains the optional parameters for the ServerKeysClient.Get method. -type ServerKeysClientGetOptions struct { - // placeholder for future optional parameters -} - -// ServerKeysClientListByServerOptions contains the optional parameters for the ServerKeysClient.NewListByServerPager method. -type ServerKeysClientListByServerOptions struct { - // placeholder for future optional parameters + Thumbprint *string } // ServerListResult - A list of servers. type ServerListResult struct { // READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` + NextLink *string // READ-ONLY; Array of results. - Value []*Server `json:"value,omitempty" azure:"ro"` + Value []*Server } // ServerOperation - A server operation. type ServerOperation struct { // Resource properties. - Properties *ServerOperationProperties `json:"properties,omitempty"` + Properties *ServerOperationProperties // READ-ONLY; Resource ID. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; Resource name. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // ServerOperationListResult - The response to a list server operations request type ServerOperationListResult struct { // READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` + NextLink *string // READ-ONLY; Array of results. - Value []*ServerOperation `json:"value,omitempty" azure:"ro"` + Value []*ServerOperation } // ServerOperationProperties - The properties of a server operation. type ServerOperationProperties struct { // READ-ONLY; The operation description. - Description *string `json:"description,omitempty" azure:"ro"` + Description *string // READ-ONLY; The operation error code. - ErrorCode *int32 `json:"errorCode,omitempty" azure:"ro"` + ErrorCode *int32 // READ-ONLY; The operation error description. - ErrorDescription *string `json:"errorDescription,omitempty" azure:"ro"` + ErrorDescription *string // READ-ONLY; The operation error severity. - ErrorSeverity *int32 `json:"errorSeverity,omitempty" azure:"ro"` + ErrorSeverity *int32 // READ-ONLY; The estimated completion time of the operation. - EstimatedCompletionTime *time.Time `json:"estimatedCompletionTime,omitempty" azure:"ro"` + EstimatedCompletionTime *time.Time // READ-ONLY; Whether the operation can be cancelled. - IsCancellable *bool `json:"isCancellable,omitempty" azure:"ro"` + IsCancellable *bool // READ-ONLY; Whether or not the error is a user error. - IsUserError *bool `json:"isUserError,omitempty" azure:"ro"` + IsUserError *bool // READ-ONLY; The name of operation. - Operation *string `json:"operation,omitempty" azure:"ro"` + Operation *string // READ-ONLY; The friendly name of operation. - OperationFriendlyName *string `json:"operationFriendlyName,omitempty" azure:"ro"` + OperationFriendlyName *string // READ-ONLY; The percentage of the operation completed. - PercentComplete *int32 `json:"percentComplete,omitempty" azure:"ro"` + PercentComplete *int32 // READ-ONLY; The name of the server. - ServerName *string `json:"serverName,omitempty" azure:"ro"` + ServerName *string // READ-ONLY; The operation start time. - StartTime *time.Time `json:"startTime,omitempty" azure:"ro"` + StartTime *time.Time // READ-ONLY; The operation state. - State *ManagementOperationState `json:"state,omitempty" azure:"ro"` -} - -// ServerOperationsClientListByServerOptions contains the optional parameters for the ServerOperationsClient.NewListByServerPager -// method. -type ServerOperationsClientListByServerOptions struct { - // placeholder for future optional parameters + State *ManagementOperationState } // ServerPrivateEndpointConnection - A private endpoint connection under a server type ServerPrivateEndpointConnection struct { // READ-ONLY; Resource ID. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; Private endpoint connection properties - Properties *PrivateEndpointConnectionProperties `json:"properties,omitempty" azure:"ro"` + Properties *PrivateEndpointConnectionProperties } // ServerProperties - The properties of a server. type ServerProperties struct { // Administrator username for the server. Once created it cannot be changed. - AdministratorLogin *string `json:"administratorLogin,omitempty"` + AdministratorLogin *string // The administrator login password (required for server creation). - AdministratorLoginPassword *string `json:"administratorLoginPassword,omitempty"` + AdministratorLoginPassword *string - // The Azure Active Directory identity of the server. - Administrators *ServerExternalAdministrator `json:"administrators,omitempty"` + // The Azure Active Directory administrator of the server. This can only be used at server create time. If used for server + // update, it will be ignored or it will result in an error. For updates individual + // APIs will need to be used. + Administrators *ServerExternalAdministrator // The Client id used for cross tenant CMK scenario - FederatedClientID *string `json:"federatedClientId,omitempty"` + FederatedClientID *string // A CMK URI of the key to use for encryption. - KeyID *string `json:"keyId,omitempty"` + KeyID *string - // Minimal TLS version. Allowed values: '1.0', '1.1', '1.2' - MinimalTLSVersion *string `json:"minimalTlsVersion,omitempty"` + // Minimal TLS version. Allowed values: 'None', '1.0', '1.1', '1.2' + MinimalTLSVersion *string // The resource id of a user assigned identity to be used by default. - PrimaryUserAssignedIdentityID *string `json:"primaryUserAssignedIdentityId,omitempty"` + PrimaryUserAssignedIdentityID *string // Whether or not public endpoint access is allowed for this server. Value is optional but if passed in, must be 'Enabled' - // or 'Disabled' - PublicNetworkAccess *ServerNetworkAccessFlag `json:"publicNetworkAccess,omitempty"` + // or 'Disabled' or 'SecuredByPerimeter' + PublicNetworkAccess *ServerPublicNetworkAccessFlag // Whether or not to restrict outbound network access for this server. Value is optional but if passed in, must be 'Enabled' // or 'Disabled' - RestrictOutboundNetworkAccess *ServerNetworkAccessFlag `json:"restrictOutboundNetworkAccess,omitempty"` + RestrictOutboundNetworkAccess *ServerNetworkAccessFlag // The version of the server. - Version *string `json:"version,omitempty"` + Version *string + + // READ-ONLY; Status of external governance. + ExternalGovernanceStatus *ExternalGovernanceStatus // READ-ONLY; The fully qualified domain name of the server. - FullyQualifiedDomainName *string `json:"fullyQualifiedDomainName,omitempty" azure:"ro"` + FullyQualifiedDomainName *string // READ-ONLY; List of private endpoint connections on a server - PrivateEndpointConnections []*ServerPrivateEndpointConnection `json:"privateEndpointConnections,omitempty" azure:"ro"` + PrivateEndpointConnections []*ServerPrivateEndpointConnection // READ-ONLY; The state of the server. - State *string `json:"state,omitempty" azure:"ro"` + State *string // READ-ONLY; Whether or not existing server has a workspace created and if it allows connection from workspace - WorkspaceFeature *ServerWorkspaceFeature `json:"workspaceFeature,omitempty" azure:"ro"` -} - -// ServerSecurityAlertPoliciesClientBeginCreateOrUpdateOptions contains the optional parameters for the ServerSecurityAlertPoliciesClient.BeginCreateOrUpdate -// method. -type ServerSecurityAlertPoliciesClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ServerSecurityAlertPoliciesClientGetOptions contains the optional parameters for the ServerSecurityAlertPoliciesClient.Get -// method. -type ServerSecurityAlertPoliciesClientGetOptions struct { - // placeholder for future optional parameters -} - -// ServerSecurityAlertPoliciesClientListByServerOptions contains the optional parameters for the ServerSecurityAlertPoliciesClient.NewListByServerPager -// method. -type ServerSecurityAlertPoliciesClientListByServerOptions struct { - // placeholder for future optional parameters + WorkspaceFeature *ServerWorkspaceFeature } // ServerSecurityAlertPolicy - A server security alert policy. type ServerSecurityAlertPolicy struct { // Resource properties. - Properties *SecurityAlertsPolicyProperties `json:"properties,omitempty"` + Properties *SecurityAlertsPolicyProperties // READ-ONLY; Resource ID. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; Resource name. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; SystemData of SecurityAlertPolicyResource. - SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` + SystemData *SystemData // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // ServerTrustCertificate - Server trust certificate imported from box to enable connection between box and Sql Managed Instance. type ServerTrustCertificate struct { // Resource properties. - Properties *ServerTrustCertificateProperties `json:"properties,omitempty"` + Properties *ServerTrustCertificateProperties // READ-ONLY; Resource ID. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; Resource name. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // ServerTrustCertificateProperties - The properties of a server trust certificate. type ServerTrustCertificateProperties struct { // The certificate public blob - PublicBlob *string `json:"publicBlob,omitempty"` + PublicBlob *string // READ-ONLY; The certificate name - CertificateName *string `json:"certificateName,omitempty" azure:"ro"` + CertificateName *string // READ-ONLY; The certificate thumbprint - Thumbprint *string `json:"thumbprint,omitempty" azure:"ro"` -} - -// ServerTrustCertificatesClientBeginCreateOrUpdateOptions contains the optional parameters for the ServerTrustCertificatesClient.BeginCreateOrUpdate -// method. -type ServerTrustCertificatesClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ServerTrustCertificatesClientBeginDeleteOptions contains the optional parameters for the ServerTrustCertificatesClient.BeginDelete -// method. -type ServerTrustCertificatesClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ServerTrustCertificatesClientGetOptions contains the optional parameters for the ServerTrustCertificatesClient.Get method. -type ServerTrustCertificatesClientGetOptions struct { - // placeholder for future optional parameters -} - -// ServerTrustCertificatesClientListByInstanceOptions contains the optional parameters for the ServerTrustCertificatesClient.NewListByInstancePager -// method. -type ServerTrustCertificatesClientListByInstanceOptions struct { - // placeholder for future optional parameters + Thumbprint *string } // ServerTrustCertificatesListResult - A list of server trust certificates in instance. type ServerTrustCertificatesListResult struct { // READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` + NextLink *string // READ-ONLY; Array of results. - Value []*ServerTrustCertificate `json:"value,omitempty" azure:"ro"` + Value []*ServerTrustCertificate } // ServerTrustGroup - A server trust group. type ServerTrustGroup struct { // Resource properties. - Properties *ServerTrustGroupProperties `json:"properties,omitempty"` + Properties *ServerTrustGroupProperties // READ-ONLY; Resource ID. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; Resource name. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // ServerTrustGroupListResult - A list of server trust groups. type ServerTrustGroupListResult struct { // READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` + NextLink *string // READ-ONLY; Array of results. - Value []*ServerTrustGroup `json:"value,omitempty" azure:"ro"` + Value []*ServerTrustGroup } // ServerTrustGroupProperties - Properties of a server trust group. type ServerTrustGroupProperties struct { // REQUIRED; Group members information for the server trust group. - GroupMembers []*ServerInfo `json:"groupMembers,omitempty"` + GroupMembers []*ServerInfo // REQUIRED; Trust scope of the server trust group. - TrustScopes []*ServerTrustGroupPropertiesTrustScopesItem `json:"trustScopes,omitempty"` -} - -// ServerTrustGroupsClientBeginCreateOrUpdateOptions contains the optional parameters for the ServerTrustGroupsClient.BeginCreateOrUpdate -// method. -type ServerTrustGroupsClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ServerTrustGroupsClientBeginDeleteOptions contains the optional parameters for the ServerTrustGroupsClient.BeginDelete -// method. -type ServerTrustGroupsClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ServerTrustGroupsClientGetOptions contains the optional parameters for the ServerTrustGroupsClient.Get method. -type ServerTrustGroupsClientGetOptions struct { - // placeholder for future optional parameters -} - -// ServerTrustGroupsClientListByInstanceOptions contains the optional parameters for the ServerTrustGroupsClient.NewListByInstancePager -// method. -type ServerTrustGroupsClientListByInstanceOptions struct { - // placeholder for future optional parameters -} - -// ServerTrustGroupsClientListByLocationOptions contains the optional parameters for the ServerTrustGroupsClient.NewListByLocationPager -// method. -type ServerTrustGroupsClientListByLocationOptions struct { - // placeholder for future optional parameters + TrustScopes []*ServerTrustGroupPropertiesTrustScopesItem } // ServerUpdate - An update request for an Azure SQL Database server. type ServerUpdate struct { // Server identity - Identity *ResourceIdentity `json:"identity,omitempty"` + Identity *ResourceIdentity // Resource properties. - Properties *ServerProperties `json:"properties,omitempty"` + Properties *ServerProperties // Resource tags. - Tags map[string]*string `json:"tags,omitempty"` + Tags map[string]*string } -// ServerUsage - Represents server metrics. +// ServerUsage - Usage metric of a server. type ServerUsage struct { - // READ-ONLY; The current value of the metric. - CurrentValue *float64 `json:"currentValue,omitempty" azure:"ro"` - - // READ-ONLY; The metric display name. - DisplayName *string `json:"displayName,omitempty" azure:"ro"` - - // READ-ONLY; The current limit of the metric. - Limit *float64 `json:"limit,omitempty" azure:"ro"` - - // READ-ONLY; Name of the server usage metric. - Name *string `json:"name,omitempty" azure:"ro"` + // Resource properties. + Properties *ServerUsageProperties - // READ-ONLY; The next reset time for the metric (ISO8601 format). - NextResetTime *time.Time `json:"nextResetTime,omitempty" azure:"ro"` + // READ-ONLY; Resource ID. + ID *string - // READ-ONLY; The name of the resource. - ResourceName *string `json:"resourceName,omitempty" azure:"ro"` + // READ-ONLY; Resource name. + Name *string - // READ-ONLY; The units of the metric. - Unit *string `json:"unit,omitempty" azure:"ro"` + // READ-ONLY; Resource type. + Type *string } -// ServerUsageListResult - Represents the response to a list server metrics request. +// ServerUsageListResult - A list of server usage metrics. type ServerUsageListResult struct { - // REQUIRED; The list of server metrics for the server. - Value []*ServerUsage `json:"value,omitempty"` + // READ-ONLY; Link to retrieve next page of results. + NextLink *string + + // READ-ONLY; Array of results. + Value []*ServerUsage } -// ServerUsagesClientListByServerOptions contains the optional parameters for the ServerUsagesClient.NewListByServerPager -// method. -type ServerUsagesClientListByServerOptions struct { - // placeholder for future optional parameters +// ServerUsageProperties - Properties of a server usage. +type ServerUsageProperties struct { + // READ-ONLY; Current value of the metric. + CurrentValue *float64 + + // READ-ONLY; User-readable name of the metric. + DisplayName *string + + // READ-ONLY; Boundary value of the metric. + Limit *float64 + + // READ-ONLY; Unit of the metric. + Unit *string } // ServerVersionCapability - The server capability type ServerVersionCapability struct { // The reason for the capability not being available. - Reason *string `json:"reason,omitempty"` + Reason *string // READ-ONLY; The server version name. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; The status of the capability. - Status *CapabilityStatus `json:"status,omitempty" azure:"ro"` + Status *CapabilityStatus // READ-ONLY; The list of supported database editions. - SupportedEditions []*EditionCapability `json:"supportedEditions,omitempty" azure:"ro"` + SupportedEditions []*EditionCapability // READ-ONLY; The list of supported elastic pool editions. - SupportedElasticPoolEditions []*ElasticPoolEditionCapability `json:"supportedElasticPoolEditions,omitempty" azure:"ro"` + SupportedElasticPoolEditions []*ElasticPoolEditionCapability } // ServerVulnerabilityAssessment - A server vulnerability assessment. type ServerVulnerabilityAssessment struct { // Resource properties. - Properties *ServerVulnerabilityAssessmentProperties `json:"properties,omitempty"` - - // READ-ONLY; Resource ID. - ID *string `json:"id,omitempty" azure:"ro"` - - // READ-ONLY; Resource name. - Name *string `json:"name,omitempty" azure:"ro"` - - // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` -} - -// ServerVulnerabilityAssessmentListResult - A list of the server's vulnerability assessments. -type ServerVulnerabilityAssessmentListResult struct { - // READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` - - // READ-ONLY; Array of results. - Value []*ServerVulnerabilityAssessment `json:"value,omitempty" azure:"ro"` -} - -// ServerVulnerabilityAssessmentProperties - Properties of a server Vulnerability Assessment. -type ServerVulnerabilityAssessmentProperties struct { - // REQUIRED; A blob storage container path to hold the scan results (e.g. https://myStorage.blob.core.windows.net/VaScans/). - StorageContainerPath *string `json:"storageContainerPath,omitempty"` - - // The recurring scans settings - RecurringScans *VulnerabilityAssessmentRecurringScansProperties `json:"recurringScans,omitempty"` - - // Specifies the identifier key of the storage account for vulnerability assessment scan results. If 'StorageContainerSasKey' - // isn't specified, storageAccountAccessKey is required. Applies only if the - // storage account is not behind a Vnet or a firewall - StorageAccountAccessKey *string `json:"storageAccountAccessKey,omitempty"` - - // A shared access signature (SAS Key) that has write access to the blob container specified in 'storageContainerPath' parameter. - // If 'storageAccountAccessKey' isn't specified, StorageContainerSasKey is - // required. Applies only if the storage account is not behind a Vnet or a firewall - StorageContainerSasKey *string `json:"storageContainerSasKey,omitempty"` -} - -// ServerVulnerabilityAssessmentsClientCreateOrUpdateOptions contains the optional parameters for the ServerVulnerabilityAssessmentsClient.CreateOrUpdate -// method. -type ServerVulnerabilityAssessmentsClientCreateOrUpdateOptions struct { - // placeholder for future optional parameters -} - -// ServerVulnerabilityAssessmentsClientDeleteOptions contains the optional parameters for the ServerVulnerabilityAssessmentsClient.Delete -// method. -type ServerVulnerabilityAssessmentsClientDeleteOptions struct { - // placeholder for future optional parameters -} - -// ServerVulnerabilityAssessmentsClientGetOptions contains the optional parameters for the ServerVulnerabilityAssessmentsClient.Get -// method. -type ServerVulnerabilityAssessmentsClientGetOptions struct { - // placeholder for future optional parameters -} - -// ServerVulnerabilityAssessmentsClientListByServerOptions contains the optional parameters for the ServerVulnerabilityAssessmentsClient.NewListByServerPager -// method. -type ServerVulnerabilityAssessmentsClientListByServerOptions struct { - // placeholder for future optional parameters -} - -// ServersClientBeginCreateOrUpdateOptions contains the optional parameters for the ServersClient.BeginCreateOrUpdate method. -type ServersClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ServersClientBeginDeleteOptions contains the optional parameters for the ServersClient.BeginDelete method. -type ServersClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ServersClientBeginImportDatabaseOptions contains the optional parameters for the ServersClient.BeginImportDatabase method. -type ServersClientBeginImportDatabaseOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} + Properties *ServerVulnerabilityAssessmentProperties -// ServersClientBeginUpdateOptions contains the optional parameters for the ServersClient.BeginUpdate method. -type ServersClientBeginUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} + // READ-ONLY; Resource ID. + ID *string -// ServersClientCheckNameAvailabilityOptions contains the optional parameters for the ServersClient.CheckNameAvailability -// method. -type ServersClientCheckNameAvailabilityOptions struct { - // placeholder for future optional parameters -} + // READ-ONLY; Resource name. + Name *string -// ServersClientGetOptions contains the optional parameters for the ServersClient.Get method. -type ServersClientGetOptions struct { - // The child resources to include in the response. - Expand *string + // READ-ONLY; Resource type. + Type *string } -// ServersClientListByResourceGroupOptions contains the optional parameters for the ServersClient.NewListByResourceGroupPager -// method. -type ServersClientListByResourceGroupOptions struct { - // The child resources to include in the response. - Expand *string -} +// ServerVulnerabilityAssessmentListResult - A list of the server's vulnerability assessments. +type ServerVulnerabilityAssessmentListResult struct { + // READ-ONLY; Link to retrieve next page of results. + NextLink *string -// ServersClientListOptions contains the optional parameters for the ServersClient.NewListPager method. -type ServersClientListOptions struct { - // The child resources to include in the response. - Expand *string + // READ-ONLY; Array of results. + Value []*ServerVulnerabilityAssessment } -// ServiceObjective - Represents a database service objective. -type ServiceObjective struct { - // Represents the properties of the resource. - Properties *ServiceObjectiveProperties `json:"properties,omitempty"` +// ServerVulnerabilityAssessmentProperties - Properties of a server Vulnerability Assessment. +type ServerVulnerabilityAssessmentProperties struct { + // REQUIRED; A blob storage container path to hold the scan results (e.g. https://myStorage.blob.core.windows.net/VaScans/). + StorageContainerPath *string - // READ-ONLY; Resource ID. - ID *string `json:"id,omitempty" azure:"ro"` + // The recurring scans settings + RecurringScans *VulnerabilityAssessmentRecurringScansProperties - // READ-ONLY; Resource name. - Name *string `json:"name,omitempty" azure:"ro"` + // Specifies the identifier key of the storage account for vulnerability assessment scan results. If 'StorageContainerSasKey' + // isn't specified, storageAccountAccessKey is required. Applies only if the + // storage account is not behind a Vnet or a firewall + StorageAccountAccessKey *string - // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` + // A shared access signature (SAS Key) that has write access to the blob container specified in 'storageContainerPath' parameter. + // If 'storageAccountAccessKey' isn't specified, StorageContainerSasKey is + // required. Applies only if the storage account is not behind a Vnet or a firewall + StorageContainerSasKey *string } // ServiceObjectiveCapability - The service objectives capability. type ServiceObjectiveCapability struct { // The reason for the capability not being available. - Reason *string `json:"reason,omitempty"` + Reason *string // READ-ONLY; The compute model - ComputeModel *string `json:"computeModel,omitempty" azure:"ro"` + ComputeModel *string // READ-ONLY; The unique ID of the service objective. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; The included (free) max size. - IncludedMaxSize *MaxSizeCapability `json:"includedMaxSize,omitempty" azure:"ro"` + IncludedMaxSize *MaxSizeCapability // READ-ONLY; The service objective name. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; The performance level. - PerformanceLevel *PerformanceLevelCapability `json:"performanceLevel,omitempty" azure:"ro"` + PerformanceLevel *PerformanceLevelCapability // READ-ONLY; The sku. - SKU *SKU `json:"sku,omitempty" azure:"ro"` + SKU *SKU // READ-ONLY; The status of the capability. - Status *CapabilityStatus `json:"status,omitempty" azure:"ro"` + Status *CapabilityStatus // READ-ONLY; Supported time range for auto pause delay - SupportedAutoPauseDelay *AutoPauseDelayTimeRange `json:"supportedAutoPauseDelay,omitempty" azure:"ro"` + SupportedAutoPauseDelay *AutoPauseDelayTimeRange // READ-ONLY; List of supported license types. - SupportedLicenseTypes []*LicenseTypeCapability `json:"supportedLicenseTypes,omitempty" azure:"ro"` + SupportedLicenseTypes []*LicenseTypeCapability // READ-ONLY; List of supported maintenance configurations - SupportedMaintenanceConfigurations []*MaintenanceConfigurationCapability `json:"supportedMaintenanceConfigurations,omitempty" azure:"ro"` + SupportedMaintenanceConfigurations []*MaintenanceConfigurationCapability // READ-ONLY; The list of supported maximum database sizes. - SupportedMaxSizes []*MaxSizeRangeCapability `json:"supportedMaxSizes,omitempty" azure:"ro"` + SupportedMaxSizes []*MaxSizeRangeCapability // READ-ONLY; List of supported min capacities - SupportedMinCapacities []*MinCapacityCapability `json:"supportedMinCapacities,omitempty" azure:"ro"` + SupportedMinCapacities []*MinCapacityCapability + + // READ-ONLY; Whether or not zone pinning is supported. + ZonePinning *bool // READ-ONLY; Whether or not zone redundancy is supported for the service objective. - ZoneRedundant *bool `json:"zoneRedundant,omitempty" azure:"ro"` + ZoneRedundant *bool } -// ServiceObjectiveListResult - Represents the response to a get database service objectives request. -type ServiceObjectiveListResult struct { - // REQUIRED; The list of database service objectives. - Value []*ServiceObjective `json:"value,omitempty"` -} +// ServicePrincipal - The managed instance's service principal configuration for a resource. +type ServicePrincipal struct { + // Service principal type. + Type *ServicePrincipalType -// ServiceObjectiveProperties - Represents the properties of a database service objective. -type ServiceObjectiveProperties struct { - // READ-ONLY; The description for the service level objective. - Description *string `json:"description,omitempty" azure:"ro"` + // READ-ONLY; The Azure Active Directory application client id. + ClientID *string + + // READ-ONLY; The Azure Active Directory application object id. + PrincipalID *string - // READ-ONLY; Gets whether the service level objective is enabled. - Enabled *bool `json:"enabled,omitempty" azure:"ro"` + // READ-ONLY; The Azure Active Directory tenant id. + TenantID *string +} - // READ-ONLY; Gets whether the service level objective is the default service objective. - IsDefault *bool `json:"isDefault,omitempty" azure:"ro"` +// StartStopManagedInstanceSchedule - Managed instance's Start/Stop schedule. +type StartStopManagedInstanceSchedule struct { + // Resource properties. + Properties *StartStopManagedInstanceScheduleProperties - // READ-ONLY; Gets whether the service level objective is a system service objective. - IsSystem *bool `json:"isSystem,omitempty" azure:"ro"` + // READ-ONLY; Resource ID. + ID *string - // READ-ONLY; The name for the service objective. - ServiceObjectiveName *string `json:"serviceObjectiveName,omitempty" azure:"ro"` -} + // READ-ONLY; Resource name. + Name *string -// ServiceObjectivesClientGetOptions contains the optional parameters for the ServiceObjectivesClient.Get method. -type ServiceObjectivesClientGetOptions struct { - // placeholder for future optional parameters -} + // READ-ONLY; System data of the scheduled resource. + SystemData *SystemData -// ServiceObjectivesClientListByServerOptions contains the optional parameters for the ServiceObjectivesClient.NewListByServerPager -// method. -type ServiceObjectivesClientListByServerOptions struct { - // placeholder for future optional parameters + // READ-ONLY; Resource type. + Type *string } -// ServicePrincipal - The managed instance's service principal configuration for a resource. -type ServicePrincipal struct { - // Service principal type. - Type *ServicePrincipalType `json:"type,omitempty"` +// StartStopManagedInstanceScheduleListResult - Managed instance's Start/Stop schedule list result. +type StartStopManagedInstanceScheduleListResult struct { + // READ-ONLY; Link to retrieve next page of results. + NextLink *string - // READ-ONLY; The Azure Active Directory application client id. - ClientID *string `json:"clientId,omitempty" azure:"ro"` + // READ-ONLY; Array of results. + Value []*StartStopManagedInstanceSchedule +} - // READ-ONLY; The Azure Active Directory application object id. - PrincipalID *string `json:"principalId,omitempty" azure:"ro"` +// StartStopManagedInstanceScheduleProperties - Properties of managed instance's Start/Stop schedule. +type StartStopManagedInstanceScheduleProperties struct { + // REQUIRED; Schedule list. + ScheduleList []*ScheduleItem - // READ-ONLY; The Azure Active Directory tenant id. - TenantID *string `json:"tenantId,omitempty" azure:"ro"` -} + // The description of the schedule. + Description *string -// SloUsageMetric - A Slo Usage Metric. -type SloUsageMetric struct { - // READ-ONLY; Gets or sets inRangeTimeRatio for SLO usage metric. - InRangeTimeRatio *float64 `json:"inRangeTimeRatio,omitempty" azure:"ro"` + // The time zone of the schedule. + TimeZoneID *string - // READ-ONLY; The serviceLevelObjective for SLO usage metric. - ServiceLevelObjective *ServiceObjectiveName `json:"serviceLevelObjective,omitempty" azure:"ro"` + // READ-ONLY; Timestamp when the next action will be executed in the corresponding schedule time zone. + NextExecutionTime *string - // READ-ONLY; The serviceLevelObjectiveId for SLO usage metric. - ServiceLevelObjectiveID *string `json:"serviceLevelObjectiveId,omitempty" azure:"ro"` + // READ-ONLY; Next action to be executed (Start or Stop) + NextRunAction *string } // StorageCapability - The storage account type capability. type StorageCapability struct { // The reason for the capability not being available. - Reason *string `json:"reason,omitempty"` + Reason *string // READ-ONLY; The status of the capability. - Status *CapabilityStatus `json:"status,omitempty" azure:"ro"` + Status *CapabilityStatus // READ-ONLY; The storage account type for the database's backups. - StorageAccountType *StorageCapabilityStorageAccountType `json:"storageAccountType,omitempty" azure:"ro"` + StorageAccountType *StorageCapabilityStorageAccountType } // SubscriptionUsage - Usage Metric of a Subscription in a Location. type SubscriptionUsage struct { // Resource properties. - Properties *SubscriptionUsageProperties `json:"properties,omitempty"` + Properties *SubscriptionUsageProperties // READ-ONLY; Resource ID. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; Resource name. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // SubscriptionUsageListResult - A list of subscription usage metrics in a location. type SubscriptionUsageListResult struct { // READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` + NextLink *string // READ-ONLY; Array of results. - Value []*SubscriptionUsage `json:"value,omitempty" azure:"ro"` + Value []*SubscriptionUsage } // SubscriptionUsageProperties - Properties of a subscription usage. type SubscriptionUsageProperties struct { // READ-ONLY; Current value of the metric. - CurrentValue *float64 `json:"currentValue,omitempty" azure:"ro"` + CurrentValue *float64 // READ-ONLY; User-readable name of the metric. - DisplayName *string `json:"displayName,omitempty" azure:"ro"` + DisplayName *string // READ-ONLY; Boundary value of the metric. - Limit *float64 `json:"limit,omitempty" azure:"ro"` + Limit *float64 // READ-ONLY; Unit of the metric. - Unit *string `json:"unit,omitempty" azure:"ro"` + Unit *string +} + +// SynapseLinkWorkspace - Synapse link workspace resource +type SynapseLinkWorkspace struct { + // Resource properties. + Properties *SynapseLinkWorkspaceProperties + + // READ-ONLY; Resource ID. + ID *string + + // READ-ONLY; Resource name. + Name *string + + // READ-ONLY; Resource type. + Type *string +} + +// SynapseLinkWorkspaceInfoProperties - Properties of a Synapse link workspaces +type SynapseLinkWorkspaceInfoProperties struct { + // Link connection name. + LinkConnectionName *string + + // Synapse link workspace id. + WorkspaceID *string } -// SubscriptionUsagesClientGetOptions contains the optional parameters for the SubscriptionUsagesClient.Get method. -type SubscriptionUsagesClientGetOptions struct { - // placeholder for future optional parameters +// SynapseLinkWorkspaceListResult - A list of synapselink workspaces +type SynapseLinkWorkspaceListResult struct { + // READ-ONLY; Link to retrieve next page of results. + NextLink *string + + // READ-ONLY; Array of results. + Value []*SynapseLinkWorkspace } -// SubscriptionUsagesClientListByLocationOptions contains the optional parameters for the SubscriptionUsagesClient.NewListByLocationPager -// method. -type SubscriptionUsagesClientListByLocationOptions struct { - // placeholder for future optional parameters +// SynapseLinkWorkspaceProperties - Properties of a Synapse link workspaces +type SynapseLinkWorkspaceProperties struct { + // List of all synapselink workspaces + Workspaces []*SynapseLinkWorkspaceInfoProperties } // SyncAgent - An Azure SQL Database sync agent. type SyncAgent struct { // Resource properties. - Properties *SyncAgentProperties `json:"properties,omitempty"` + Properties *SyncAgentProperties // READ-ONLY; Resource ID. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; Resource name. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // SyncAgentKeyProperties - Properties of an Azure SQL Database sync agent key. type SyncAgentKeyProperties struct { // READ-ONLY; Key of sync agent. - SyncAgentKey *string `json:"syncAgentKey,omitempty" azure:"ro"` + SyncAgentKey *string } // SyncAgentLinkedDatabase - An Azure SQL Database sync agent linked database. type SyncAgentLinkedDatabase struct { // Resource properties. - Properties *SyncAgentLinkedDatabaseProperties `json:"properties,omitempty"` + Properties *SyncAgentLinkedDatabaseProperties // READ-ONLY; Resource ID. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; Resource name. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // SyncAgentLinkedDatabaseListResult - A list of sync agent linked databases. type SyncAgentLinkedDatabaseListResult struct { // READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` + NextLink *string // READ-ONLY; Array of results. - Value []*SyncAgentLinkedDatabase `json:"value,omitempty" azure:"ro"` + Value []*SyncAgentLinkedDatabase } // SyncAgentLinkedDatabaseProperties - Properties of an Azure SQL Database sync agent linked database. type SyncAgentLinkedDatabaseProperties struct { // READ-ONLY; Id of the sync agent linked database. - DatabaseID *string `json:"databaseId,omitempty" azure:"ro"` + DatabaseID *string // READ-ONLY; Database name of the sync agent linked database. - DatabaseName *string `json:"databaseName,omitempty" azure:"ro"` + DatabaseName *string // READ-ONLY; Type of the sync agent linked database. - DatabaseType *SyncMemberDbType `json:"databaseType,omitempty" azure:"ro"` + DatabaseType *SyncMemberDbType // READ-ONLY; Description of the sync agent linked database. - Description *string `json:"description,omitempty" azure:"ro"` + Description *string // READ-ONLY; Server name of the sync agent linked database. - ServerName *string `json:"serverName,omitempty" azure:"ro"` + ServerName *string // READ-ONLY; User name of the sync agent linked database. - UserName *string `json:"userName,omitempty" azure:"ro"` + UserName *string } // SyncAgentListResult - A list of sync agents. type SyncAgentListResult struct { // READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` + NextLink *string // READ-ONLY; Array of results. - Value []*SyncAgent `json:"value,omitempty" azure:"ro"` + Value []*SyncAgent } // SyncAgentProperties - Properties of an Azure SQL Database sync agent. type SyncAgentProperties struct { // ARM resource id of the sync database in the sync agent. - SyncDatabaseID *string `json:"syncDatabaseId,omitempty"` + SyncDatabaseID *string // READ-ONLY; Expiration time of the sync agent version. - ExpiryTime *time.Time `json:"expiryTime,omitempty" azure:"ro"` + ExpiryTime *time.Time // READ-ONLY; If the sync agent version is up to date. - IsUpToDate *bool `json:"isUpToDate,omitempty" azure:"ro"` + IsUpToDate *bool // READ-ONLY; Last alive time of the sync agent. - LastAliveTime *time.Time `json:"lastAliveTime,omitempty" azure:"ro"` + LastAliveTime *time.Time // READ-ONLY; Name of the sync agent. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; State of the sync agent. - State *SyncAgentState `json:"state,omitempty" azure:"ro"` + State *SyncAgentState // READ-ONLY; Version of the sync agent. - Version *string `json:"version,omitempty" azure:"ro"` -} - -// SyncAgentsClientBeginCreateOrUpdateOptions contains the optional parameters for the SyncAgentsClient.BeginCreateOrUpdate -// method. -type SyncAgentsClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// SyncAgentsClientBeginDeleteOptions contains the optional parameters for the SyncAgentsClient.BeginDelete method. -type SyncAgentsClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// SyncAgentsClientGenerateKeyOptions contains the optional parameters for the SyncAgentsClient.GenerateKey method. -type SyncAgentsClientGenerateKeyOptions struct { - // placeholder for future optional parameters -} - -// SyncAgentsClientGetOptions contains the optional parameters for the SyncAgentsClient.Get method. -type SyncAgentsClientGetOptions struct { - // placeholder for future optional parameters -} - -// SyncAgentsClientListByServerOptions contains the optional parameters for the SyncAgentsClient.NewListByServerPager method. -type SyncAgentsClientListByServerOptions struct { - // placeholder for future optional parameters -} - -// SyncAgentsClientListLinkedDatabasesOptions contains the optional parameters for the SyncAgentsClient.NewListLinkedDatabasesPager -// method. -type SyncAgentsClientListLinkedDatabasesOptions struct { - // placeholder for future optional parameters + Version *string } // SyncDatabaseIDListResult - A list of sync database ID properties. type SyncDatabaseIDListResult struct { // READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` + NextLink *string // READ-ONLY; Array of results. - Value []*SyncDatabaseIDProperties `json:"value,omitempty" azure:"ro"` + Value []*SyncDatabaseIDProperties } // SyncDatabaseIDProperties - Properties of the sync database id. type SyncDatabaseIDProperties struct { // READ-ONLY; ARM resource id of sync database. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string } // SyncFullSchemaProperties - Properties of the database full schema. type SyncFullSchemaProperties struct { // READ-ONLY; Last update time of the database schema. - LastUpdateTime *time.Time `json:"lastUpdateTime,omitempty" azure:"ro"` + LastUpdateTime *time.Time // READ-ONLY; List of tables in the database full schema. - Tables []*SyncFullSchemaTable `json:"tables,omitempty" azure:"ro"` + Tables []*SyncFullSchemaTable } // SyncFullSchemaPropertiesListResult - A list of sync schema properties. type SyncFullSchemaPropertiesListResult struct { // READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` + NextLink *string // READ-ONLY; Array of results. - Value []*SyncFullSchemaProperties `json:"value,omitempty" azure:"ro"` + Value []*SyncFullSchemaProperties } // SyncFullSchemaTable - Properties of the table in the database full schema. type SyncFullSchemaTable struct { // READ-ONLY; List of columns in the table of database full schema. - Columns []*SyncFullSchemaTableColumn `json:"columns,omitempty" azure:"ro"` + Columns []*SyncFullSchemaTableColumn // READ-ONLY; Error id of the table. - ErrorID *string `json:"errorId,omitempty" azure:"ro"` + ErrorID *string // READ-ONLY; If there is error in the table. - HasError *bool `json:"hasError,omitempty" azure:"ro"` + HasError *bool // READ-ONLY; Name of the table. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Quoted name of the table. - QuotedName *string `json:"quotedName,omitempty" azure:"ro"` + QuotedName *string } // SyncFullSchemaTableColumn - Properties of the column in the table of database full schema. type SyncFullSchemaTableColumn struct { // READ-ONLY; Data size of the column. - DataSize *string `json:"dataSize,omitempty" azure:"ro"` + DataSize *string // READ-ONLY; Data type of the column. - DataType *string `json:"dataType,omitempty" azure:"ro"` + DataType *string // READ-ONLY; Error id of the column. - ErrorID *string `json:"errorId,omitempty" azure:"ro"` + ErrorID *string // READ-ONLY; If there is error in the table. - HasError *bool `json:"hasError,omitempty" azure:"ro"` + HasError *bool // READ-ONLY; If it is the primary key of the table. - IsPrimaryKey *bool `json:"isPrimaryKey,omitempty" azure:"ro"` + IsPrimaryKey *bool // READ-ONLY; Name of the column. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Quoted name of the column. - QuotedName *string `json:"quotedName,omitempty" azure:"ro"` + QuotedName *string } // SyncGroup - An Azure SQL Database sync group. type SyncGroup struct { // Resource properties. - Properties *SyncGroupProperties `json:"properties,omitempty"` + Properties *SyncGroupProperties // The name and capacity of the SKU. - SKU *SKU `json:"sku,omitempty"` + SKU *SKU // READ-ONLY; Resource ID. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; Resource name. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // SyncGroupListResult - A list of sync groups. type SyncGroupListResult struct { // READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` + NextLink *string // READ-ONLY; Array of results. - Value []*SyncGroup `json:"value,omitempty" azure:"ro"` + Value []*SyncGroup } // SyncGroupLogListResult - A list of sync group log properties. type SyncGroupLogListResult struct { // READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` + NextLink *string // READ-ONLY; Array of results. - Value []*SyncGroupLogProperties `json:"value,omitempty" azure:"ro"` + Value []*SyncGroupLogProperties } // SyncGroupLogProperties - Properties of an Azure SQL Database sync group log. type SyncGroupLogProperties struct { // READ-ONLY; Details of the sync group log. - Details *string `json:"details,omitempty" azure:"ro"` + Details *string // READ-ONLY; OperationStatus of the sync group log. - OperationStatus *string `json:"operationStatus,omitempty" azure:"ro"` + OperationStatus *string // READ-ONLY; Source of the sync group log. - Source *string `json:"source,omitempty" azure:"ro"` + Source *string // READ-ONLY; Timestamp of the sync group log. - Timestamp *time.Time `json:"timestamp,omitempty" azure:"ro"` + Timestamp *time.Time // READ-ONLY; TracingId of the sync group log. - TracingID *string `json:"tracingId,omitempty" azure:"ro"` + TracingID *string // READ-ONLY; Type of the sync group log. - Type *SyncGroupLogType `json:"type,omitempty" azure:"ro"` + Type *SyncGroupLogType } // SyncGroupProperties - Properties of a sync group. type SyncGroupProperties struct { // Conflict logging retention period. - ConflictLoggingRetentionInDays *int32 `json:"conflictLoggingRetentionInDays,omitempty"` + ConflictLoggingRetentionInDays *int32 // Conflict resolution policy of the sync group. - ConflictResolutionPolicy *SyncConflictResolutionPolicy `json:"conflictResolutionPolicy,omitempty"` + ConflictResolutionPolicy *SyncConflictResolutionPolicy // If conflict logging is enabled. - EnableConflictLogging *bool `json:"enableConflictLogging,omitempty"` + EnableConflictLogging *bool // Password for the sync group hub database credential. - HubDatabasePassword *string `json:"hubDatabasePassword,omitempty"` + HubDatabasePassword *string // User name for the sync group hub database credential. - HubDatabaseUserName *string `json:"hubDatabaseUserName,omitempty"` + HubDatabaseUserName *string // Sync interval of the sync group. - Interval *int32 `json:"interval,omitempty"` + Interval *int32 // Sync schema of the sync group. - Schema *SyncGroupSchema `json:"schema,omitempty"` + Schema *SyncGroupSchema // ARM resource id of the sync database in the sync group. - SyncDatabaseID *string `json:"syncDatabaseId,omitempty"` + SyncDatabaseID *string // If use private link connection is enabled. - UsePrivateLinkConnection *bool `json:"usePrivateLinkConnection,omitempty"` + UsePrivateLinkConnection *bool // READ-ONLY; Last sync time of the sync group. - LastSyncTime *time.Time `json:"lastSyncTime,omitempty" azure:"ro"` + LastSyncTime *time.Time // READ-ONLY; Private endpoint name of the sync group if use private link connection is enabled. - PrivateEndpointName *string `json:"privateEndpointName,omitempty" azure:"ro"` + PrivateEndpointName *string // READ-ONLY; Sync state of the sync group. - SyncState *SyncGroupState `json:"syncState,omitempty" azure:"ro"` + SyncState *SyncGroupState } // SyncGroupSchema - Properties of sync group schema. type SyncGroupSchema struct { // Name of master sync member where the schema is from. - MasterSyncMemberName *string `json:"masterSyncMemberName,omitempty"` + MasterSyncMemberName *string // List of tables in sync group schema. - Tables []*SyncGroupSchemaTable `json:"tables,omitempty"` + Tables []*SyncGroupSchemaTable } // SyncGroupSchemaTable - Properties of table in sync group schema. type SyncGroupSchemaTable struct { // List of columns in sync group schema. - Columns []*SyncGroupSchemaTableColumn `json:"columns,omitempty"` + Columns []*SyncGroupSchemaTableColumn // Quoted name of sync group schema table. - QuotedName *string `json:"quotedName,omitempty"` + QuotedName *string } // SyncGroupSchemaTableColumn - Properties of column in sync group table. type SyncGroupSchemaTableColumn struct { // Data size of the column. - DataSize *string `json:"dataSize,omitempty"` + DataSize *string // Data type of the column. - DataType *string `json:"dataType,omitempty"` + DataType *string // Quoted name of sync group table column. - QuotedName *string `json:"quotedName,omitempty"` -} - -// SyncGroupsClientBeginCreateOrUpdateOptions contains the optional parameters for the SyncGroupsClient.BeginCreateOrUpdate -// method. -type SyncGroupsClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// SyncGroupsClientBeginDeleteOptions contains the optional parameters for the SyncGroupsClient.BeginDelete method. -type SyncGroupsClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// SyncGroupsClientBeginRefreshHubSchemaOptions contains the optional parameters for the SyncGroupsClient.BeginRefreshHubSchema -// method. -type SyncGroupsClientBeginRefreshHubSchemaOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// SyncGroupsClientBeginUpdateOptions contains the optional parameters for the SyncGroupsClient.BeginUpdate method. -type SyncGroupsClientBeginUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// SyncGroupsClientCancelSyncOptions contains the optional parameters for the SyncGroupsClient.CancelSync method. -type SyncGroupsClientCancelSyncOptions struct { - // placeholder for future optional parameters -} - -// SyncGroupsClientGetOptions contains the optional parameters for the SyncGroupsClient.Get method. -type SyncGroupsClientGetOptions struct { - // placeholder for future optional parameters -} - -// SyncGroupsClientListByDatabaseOptions contains the optional parameters for the SyncGroupsClient.NewListByDatabasePager -// method. -type SyncGroupsClientListByDatabaseOptions struct { - // placeholder for future optional parameters -} - -// SyncGroupsClientListHubSchemasOptions contains the optional parameters for the SyncGroupsClient.NewListHubSchemasPager -// method. -type SyncGroupsClientListHubSchemasOptions struct { - // placeholder for future optional parameters -} - -// SyncGroupsClientListLogsOptions contains the optional parameters for the SyncGroupsClient.NewListLogsPager method. -type SyncGroupsClientListLogsOptions struct { - // The continuation token for this operation. - ContinuationToken *string -} - -// SyncGroupsClientListSyncDatabaseIDsOptions contains the optional parameters for the SyncGroupsClient.NewListSyncDatabaseIDsPager -// method. -type SyncGroupsClientListSyncDatabaseIDsOptions struct { - // placeholder for future optional parameters -} - -// SyncGroupsClientTriggerSyncOptions contains the optional parameters for the SyncGroupsClient.TriggerSync method. -type SyncGroupsClientTriggerSyncOptions struct { - // placeholder for future optional parameters + QuotedName *string } // SyncMember - An Azure SQL Database sync member. type SyncMember struct { // Resource properties. - Properties *SyncMemberProperties `json:"properties,omitempty"` + Properties *SyncMemberProperties // READ-ONLY; Resource ID. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; Resource name. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // SyncMemberListResult - A list of Azure SQL Database sync members. type SyncMemberListResult struct { // READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` + NextLink *string // READ-ONLY; Array of results. - Value []*SyncMember `json:"value,omitempty" azure:"ro"` + Value []*SyncMember } // SyncMemberProperties - Properties of a sync member. type SyncMemberProperties struct { // Database name of the member database in the sync member. - DatabaseName *string `json:"databaseName,omitempty"` + DatabaseName *string // Database type of the sync member. - DatabaseType *SyncMemberDbType `json:"databaseType,omitempty"` + DatabaseType *SyncMemberDbType // Password of the member database in the sync member. - Password *string `json:"password,omitempty"` + Password *string // SQL Server database id of the sync member. - SQLServerDatabaseID *string `json:"sqlServerDatabaseId,omitempty"` + SQLServerDatabaseID *string // Server name of the member database in the sync member - ServerName *string `json:"serverName,omitempty"` + ServerName *string // ARM resource id of the sync agent in the sync member. - SyncAgentID *string `json:"syncAgentId,omitempty"` + SyncAgentID *string // Sync direction of the sync member. - SyncDirection *SyncDirection `json:"syncDirection,omitempty"` + SyncDirection *SyncDirection // ARM resource id of the sync member logical database, for sync members in Azure. - SyncMemberAzureDatabaseResourceID *string `json:"syncMemberAzureDatabaseResourceId,omitempty"` + SyncMemberAzureDatabaseResourceID *string // Whether to use private link connection. - UsePrivateLinkConnection *bool `json:"usePrivateLinkConnection,omitempty"` + UsePrivateLinkConnection *bool // User name of the member database in the sync member. - UserName *string `json:"userName,omitempty"` + UserName *string // READ-ONLY; Private endpoint name of the sync member if use private link connection is enabled, for sync members in Azure. - PrivateEndpointName *string `json:"privateEndpointName,omitempty" azure:"ro"` + PrivateEndpointName *string // READ-ONLY; Sync state of the sync member. - SyncState *SyncMemberState `json:"syncState,omitempty" azure:"ro"` -} - -// SyncMembersClientBeginCreateOrUpdateOptions contains the optional parameters for the SyncMembersClient.BeginCreateOrUpdate -// method. -type SyncMembersClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// SyncMembersClientBeginDeleteOptions contains the optional parameters for the SyncMembersClient.BeginDelete method. -type SyncMembersClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// SyncMembersClientBeginRefreshMemberSchemaOptions contains the optional parameters for the SyncMembersClient.BeginRefreshMemberSchema -// method. -type SyncMembersClientBeginRefreshMemberSchemaOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// SyncMembersClientBeginUpdateOptions contains the optional parameters for the SyncMembersClient.BeginUpdate method. -type SyncMembersClientBeginUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// SyncMembersClientGetOptions contains the optional parameters for the SyncMembersClient.Get method. -type SyncMembersClientGetOptions struct { - // placeholder for future optional parameters -} - -// SyncMembersClientListBySyncGroupOptions contains the optional parameters for the SyncMembersClient.NewListBySyncGroupPager -// method. -type SyncMembersClientListBySyncGroupOptions struct { - // placeholder for future optional parameters -} - -// SyncMembersClientListMemberSchemasOptions contains the optional parameters for the SyncMembersClient.NewListMemberSchemasPager -// method. -type SyncMembersClientListMemberSchemasOptions struct { - // placeholder for future optional parameters + SyncState *SyncMemberState } // SystemData - Metadata pertaining to creation and last modification of the resource. type SystemData struct { // The timestamp of resource creation (UTC). - CreatedAt *time.Time `json:"createdAt,omitempty"` + CreatedAt *time.Time // The identity that created the resource. - CreatedBy *string `json:"createdBy,omitempty"` + CreatedBy *string // The type of identity that created the resource. - CreatedByType *CreatedByType `json:"createdByType,omitempty"` + CreatedByType *CreatedByType // The timestamp of resource last modification (UTC) - LastModifiedAt *time.Time `json:"lastModifiedAt,omitempty"` + LastModifiedAt *time.Time // The identity that last modified the resource. - LastModifiedBy *string `json:"lastModifiedBy,omitempty"` + LastModifiedBy *string // The type of identity that last modified the resource. - LastModifiedByType *CreatedByType `json:"lastModifiedByType,omitempty"` + LastModifiedByType *CreatedByType } // TdeCertificate - A TDE certificate that can be uploaded into a server. type TdeCertificate struct { // Resource properties. - Properties *TdeCertificateProperties `json:"properties,omitempty"` + Properties *TdeCertificateProperties // READ-ONLY; Resource ID. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; Resource name. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // TdeCertificateProperties - Properties of a TDE certificate. type TdeCertificateProperties struct { // REQUIRED; The base64 encoded certificate private blob. - PrivateBlob *string `json:"privateBlob,omitempty"` + PrivateBlob *string // The certificate password. - CertPassword *string `json:"certPassword,omitempty"` + CertPassword *string } -// TdeCertificatesClientBeginCreateOptions contains the optional parameters for the TdeCertificatesClient.BeginCreate method. -type TdeCertificatesClientBeginCreateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// TimeZone - Time Zone. +// TimeZone - Time Zone property. type TimeZone struct { // Resource properties. - Properties *TimeZoneProperties `json:"properties,omitempty"` + Properties *TimeZoneProperties // READ-ONLY; Resource ID. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; Resource name. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // TimeZoneListResult - A list of time zones. type TimeZoneListResult struct { // READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` + NextLink *string // READ-ONLY; Array of results. - Value []*TimeZone `json:"value,omitempty" azure:"ro"` + Value []*TimeZone } // TimeZoneProperties - The properties of a time zone. type TimeZoneProperties struct { // READ-ONLY; The time zone display name - DisplayName *string `json:"displayName,omitempty" azure:"ro"` + DisplayName *string // READ-ONLY; The time zone id - TimeZoneID *string `json:"timeZoneId,omitempty" azure:"ro"` -} - -// TimeZonesClientGetOptions contains the optional parameters for the TimeZonesClient.Get method. -type TimeZonesClientGetOptions struct { - // placeholder for future optional parameters -} - -// TimeZonesClientListByLocationOptions contains the optional parameters for the TimeZonesClient.NewListByLocationPager method. -type TimeZonesClientListByLocationOptions struct { - // placeholder for future optional parameters + TimeZoneID *string } type TopQueries struct { // List of top resource consuming queries with appropriate metric data - Queries []*QueryStatisticsProperties `json:"queries,omitempty"` + Queries []*QueryStatisticsProperties // READ-ONLY; Aggregation function used to calculate query metrics. - AggregationFunction *string `json:"aggregationFunction,omitempty" azure:"ro"` + AggregationFunction *string // READ-ONLY; The end time for the metric (ISO-8601 format). - EndTime *string `json:"endTime,omitempty" azure:"ro"` + EndTime *string // READ-ONLY; Interval type (length). - IntervalType *QueryTimeGrainType `json:"intervalType,omitempty" azure:"ro"` + IntervalType *QueryTimeGrainType // READ-ONLY; Requested number of top queries. - NumberOfQueries *int32 `json:"numberOfQueries,omitempty" azure:"ro"` + NumberOfQueries *int32 // READ-ONLY; Metric used to rank queries. - ObservationMetric *string `json:"observationMetric,omitempty" azure:"ro"` + ObservationMetric *string // READ-ONLY; The start time for the metric (ISO-8601 format). - StartTime *string `json:"startTime,omitempty" azure:"ro"` + StartTime *string } // TopQueriesListResult - A list of top resource consuming queries on managed instance type TopQueriesListResult struct { // READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` + NextLink *string // READ-ONLY; Array of results. - Value []*TopQueries `json:"value,omitempty" azure:"ro"` + Value []*TopQueries } // TrackedResource - ARM tracked top level resource. type TrackedResource struct { // REQUIRED; Resource location. - Location *string `json:"location,omitempty"` + Location *string // Resource tags. - Tags map[string]*string `json:"tags,omitempty"` + Tags map[string]*string // READ-ONLY; Resource ID. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; Resource name. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // TransparentDataEncryptionProperties - Properties of a transparent data encryption. type TransparentDataEncryptionProperties struct { // REQUIRED; Specifies the state of the transparent data encryption. - State *TransparentDataEncryptionState `json:"state,omitempty"` -} - -// TransparentDataEncryptionsClientCreateOrUpdateOptions contains the optional parameters for the TransparentDataEncryptionsClient.CreateOrUpdate -// method. -type TransparentDataEncryptionsClientCreateOrUpdateOptions struct { - // placeholder for future optional parameters -} - -// TransparentDataEncryptionsClientGetOptions contains the optional parameters for the TransparentDataEncryptionsClient.Get -// method. -type TransparentDataEncryptionsClientGetOptions struct { - // placeholder for future optional parameters -} - -// TransparentDataEncryptionsClientListByDatabaseOptions contains the optional parameters for the TransparentDataEncryptionsClient.NewListByDatabasePager -// method. -type TransparentDataEncryptionsClientListByDatabaseOptions struct { - // placeholder for future optional parameters + State *TransparentDataEncryptionState } // UpdateLongTermRetentionBackupParameters - Contains the information necessary to perform long term retention backup update // operation. type UpdateLongTermRetentionBackupParameters struct { // Resource properties. - Properties *UpdateLongTermRetentionBackupParametersProperties `json:"properties,omitempty"` + Properties *UpdateLongTermRetentionBackupParametersProperties } // UpdateLongTermRetentionBackupParametersProperties - Contains the properties to perform long term retention backup copy // operation. type UpdateLongTermRetentionBackupParametersProperties struct { // The storage redundancy type of the copied backup - RequestedBackupStorageRedundancy *BackupStorageRedundancy `json:"requestedBackupStorageRedundancy,omitempty"` + RequestedBackupStorageRedundancy *BackupStorageRedundancy } -// UpdateManagedInstanceDNSServersOperation - A recoverable managed database resource. -type UpdateManagedInstanceDNSServersOperation struct { +// UpdateVirtualClusterDNSServersOperation - A refresh DNS servers operation. +type UpdateVirtualClusterDNSServersOperation struct { // Resource properties. - Properties *DNSRefreshConfigurationProperties `json:"properties,omitempty"` + Properties *VirtualClusterDNSServersProperties // READ-ONLY; Resource ID. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; Resource name. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } type UpsertManagedServerOperationParameters struct { - Family *string `json:"family,omitempty"` - StorageSizeInGB *int32 `json:"storageSizeInGB,omitempty"` - Tier *string `json:"tier,omitempty"` - VCores *int32 `json:"vCores,omitempty"` + Family *string + StorageSizeInGB *int32 + Tier *string + VCores *int32 } -type UpsertManagedServerOperationStep struct { - Name *string `json:"name,omitempty"` - Order *int32 `json:"order,omitempty"` - Status *UpsertManagedServerOperationStepStatus `json:"status,omitempty"` +type UpsertManagedServerOperationStepWithEstimatesAndDuration struct { + Name *string + Order *int32 + Status *Status + StepEndTime *time.Time + StepStartTime *time.Time + TimeElapsed *string } // Usage - ARM usage. type Usage struct { // READ-ONLY; Usage current value. - CurrentValue *int32 `json:"currentValue,omitempty" azure:"ro"` + CurrentValue *int32 // READ-ONLY; Resource ID. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; Usage limit. - Limit *int32 `json:"limit,omitempty" azure:"ro"` + Limit *int32 // READ-ONLY; Resource name. - Name *Name `json:"name,omitempty" azure:"ro"` + Name *Name // READ-ONLY; Usage requested limit. - RequestedLimit *int32 `json:"requestedLimit,omitempty" azure:"ro"` + RequestedLimit *int32 // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` + Type *string // READ-ONLY; Usage unit. - Unit *string `json:"unit,omitempty" azure:"ro"` + Unit *string } // UsageListResult - A list of usages. type UsageListResult struct { // READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` + NextLink *string // READ-ONLY; Array of results. - Value []*Usage `json:"value,omitempty" azure:"ro"` -} - -// UsagesClientListByInstancePoolOptions contains the optional parameters for the UsagesClient.NewListByInstancePoolPager -// method. -type UsagesClientListByInstancePoolOptions struct { - // Optional request parameter to include managed instance usages within the instance pool. - ExpandChildren *bool + Value []*Usage } // UserIdentity - Azure Active Directory identity configuration for a resource. type UserIdentity struct { // READ-ONLY; The Azure Active Directory client id. - ClientID *string `json:"clientId,omitempty" azure:"ro"` + ClientID *string // READ-ONLY; The Azure Active Directory principal id. - PrincipalID *string `json:"principalId,omitempty" azure:"ro"` + PrincipalID *string +} + +// VaRule - SQL Vulnerability Assessment rule metadata details. +type VaRule struct { + // READ-ONLY; SQL Vulnerability Assessment benchmark references. + BenchmarkReferences []*BenchmarkReference + + // READ-ONLY; SQL Vulnerability Assessment rule category. + Category *string + + // READ-ONLY; SQL Vulnerability Assessment rule description. + Description *string + + // READ-ONLY; SQL Vulnerability Assessment rule query details. + QueryCheck *QueryCheck + + // READ-ONLY; SQL Vulnerability Assessment rule rationale. + Rationale *string + + // READ-ONLY; SQL Vulnerability Assessment rule Id. + RuleID *string + + // READ-ONLY; SQL Vulnerability Assessment rule type. + RuleType *RuleType + + // READ-ONLY; SQL Vulnerability Assessment rule severity. + Severity *RuleSeverity + + // READ-ONLY; SQL Vulnerability Assessment rule title. + Title *string } // VirtualCluster - An Azure SQL virtual cluster. type VirtualCluster struct { // REQUIRED; Resource location. - Location *string `json:"location,omitempty"` + Location *string // Resource properties. - Properties *VirtualClusterProperties `json:"properties,omitempty"` + Properties *VirtualClusterProperties // Resource tags. - Tags map[string]*string `json:"tags,omitempty"` + Tags map[string]*string // READ-ONLY; Resource ID. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; Resource name. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` + Type *string +} + +// VirtualClusterDNSServersProperties - The properties of dns servers on virtual cluster. +type VirtualClusterDNSServersProperties struct { + // READ-ONLY; The status of the DNS refresh operation. + Status *DNSRefreshOperationStatus } // VirtualClusterListResult - A list of virtual clusters. type VirtualClusterListResult struct { // READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` + NextLink *string // READ-ONLY; Array of results. - Value []*VirtualCluster `json:"value,omitempty" azure:"ro"` + Value []*VirtualCluster } // VirtualClusterProperties - The properties of a virtual cluster. type VirtualClusterProperties struct { - // If the service has different generations of hardware, for the same SKU, then that can be captured here. - Family *string `json:"family,omitempty"` - - // Specifies maintenance configuration id to apply to this virtual cluster. - MaintenanceConfigurationID *string `json:"maintenanceConfigurationId,omitempty"` + // Virtual cluster version. + Version *string // READ-ONLY; List of resources in this virtual cluster. - ChildResources []*string `json:"childResources,omitempty" azure:"ro"` + ChildResources []*string // READ-ONLY; Subnet resource ID for the virtual cluster. - SubnetID *string `json:"subnetId,omitempty" azure:"ro"` + SubnetID *string } -// VirtualClusterUpdate - An update request for an Azure SQL Database virtual cluster. +// VirtualClusterUpdate - An update request for virtual cluster. type VirtualClusterUpdate struct { // Resource properties. - Properties *VirtualClusterProperties `json:"properties,omitempty"` + Properties *VirtualClusterProperties // Resource tags. - Tags map[string]*string `json:"tags,omitempty"` -} - -// VirtualClustersClientBeginDeleteOptions contains the optional parameters for the VirtualClustersClient.BeginDelete method. -type VirtualClustersClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// VirtualClustersClientBeginUpdateOptions contains the optional parameters for the VirtualClustersClient.BeginUpdate method. -type VirtualClustersClientBeginUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// VirtualClustersClientGetOptions contains the optional parameters for the VirtualClustersClient.Get method. -type VirtualClustersClientGetOptions struct { - // placeholder for future optional parameters -} - -// VirtualClustersClientListByResourceGroupOptions contains the optional parameters for the VirtualClustersClient.NewListByResourceGroupPager -// method. -type VirtualClustersClientListByResourceGroupOptions struct { - // placeholder for future optional parameters -} - -// VirtualClustersClientListOptions contains the optional parameters for the VirtualClustersClient.NewListPager method. -type VirtualClustersClientListOptions struct { - // placeholder for future optional parameters -} - -// VirtualClustersClientUpdateDNSServersOptions contains the optional parameters for the VirtualClustersClient.UpdateDNSServers -// method. -type VirtualClustersClientUpdateDNSServersOptions struct { - // placeholder for future optional parameters + Tags map[string]*string } // VirtualNetworkRule - A virtual network rule. type VirtualNetworkRule struct { // Resource properties. - Properties *VirtualNetworkRuleProperties `json:"properties,omitempty"` + Properties *VirtualNetworkRuleProperties // READ-ONLY; Resource ID. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; Resource name. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // VirtualNetworkRuleListResult - A list of virtual network rules. type VirtualNetworkRuleListResult struct { // READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` + NextLink *string // READ-ONLY; Array of results. - Value []*VirtualNetworkRule `json:"value,omitempty" azure:"ro"` + Value []*VirtualNetworkRule } // VirtualNetworkRuleProperties - Properties of a virtual network rule. type VirtualNetworkRuleProperties struct { // REQUIRED; The ARM resource id of the virtual network subnet. - VirtualNetworkSubnetID *string `json:"virtualNetworkSubnetId,omitempty"` + VirtualNetworkSubnetID *string // Create firewall rule before the virtual network has vnet service endpoint enabled. - IgnoreMissingVnetServiceEndpoint *bool `json:"ignoreMissingVnetServiceEndpoint,omitempty"` + IgnoreMissingVnetServiceEndpoint *bool // READ-ONLY; Virtual Network Rule State - State *VirtualNetworkRuleState `json:"state,omitempty" azure:"ro"` + State *VirtualNetworkRuleState } -// VirtualNetworkRulesClientBeginCreateOrUpdateOptions contains the optional parameters for the VirtualNetworkRulesClient.BeginCreateOrUpdate -// method. -type VirtualNetworkRulesClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} +// VulnerabilityAssessment - A SQL Vulnerability Assessment. +type VulnerabilityAssessment struct { + // Resource properties. + Properties *VulnerabilityAssessmentPolicyProperties + + // READ-ONLY; Resource ID. + ID *string -// VirtualNetworkRulesClientBeginDeleteOptions contains the optional parameters for the VirtualNetworkRulesClient.BeginDelete -// method. -type VirtualNetworkRulesClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string + // READ-ONLY; Resource name. + Name *string + + // READ-ONLY; SystemData of SqlVulnerabilityAssessmentResource. + SystemData *SystemData + + // READ-ONLY; Resource type. + Type *string } -// VirtualNetworkRulesClientGetOptions contains the optional parameters for the VirtualNetworkRulesClient.Get method. -type VirtualNetworkRulesClientGetOptions struct { - // placeholder for future optional parameters +// VulnerabilityAssessmentListResult - A list of SQL Vulnerability Assessments. +type VulnerabilityAssessmentListResult struct { + // READ-ONLY; Link to retrieve next page of results. + NextLink *string + + // READ-ONLY; Array of results. + Value []*VulnerabilityAssessment } -// VirtualNetworkRulesClientListByServerOptions contains the optional parameters for the VirtualNetworkRulesClient.NewListByServerPager -// method. -type VirtualNetworkRulesClientListByServerOptions struct { - // placeholder for future optional parameters +type VulnerabilityAssessmentPolicyProperties struct { + // Specifies the state of the SQL Vulnerability Assessment, whether it is enabled or disabled or a state has not been applied + // yet on the specific database or server. + State *SQLVulnerabilityAssessmentState } // VulnerabilityAssessmentRecurringScansProperties - Properties of a Vulnerability Assessment recurring scans. type VulnerabilityAssessmentRecurringScansProperties struct { // Specifies that the schedule scan notification will be is sent to the subscription administrators. - EmailSubscriptionAdmins *bool `json:"emailSubscriptionAdmins,omitempty"` + EmailSubscriptionAdmins *bool // Specifies an array of e-mail addresses to which the scan notification is sent. - Emails []*string `json:"emails,omitempty"` + Emails []*string // Recurring scans state. - IsEnabled *bool `json:"isEnabled,omitempty"` + IsEnabled *bool } // VulnerabilityAssessmentScanError - Properties of a vulnerability assessment scan error. type VulnerabilityAssessmentScanError struct { // READ-ONLY; The error code. - Code *string `json:"code,omitempty" azure:"ro"` + Code *string + + // READ-ONLY; The error message. + Message *string +} + +// VulnerabilityAssessmentScanForSQLError - Properties of a vulnerability assessment scan error. +type VulnerabilityAssessmentScanForSQLError struct { + // READ-ONLY; The error code. + Code *string // READ-ONLY; The error message. - Message *string `json:"message,omitempty" azure:"ro"` + Message *string +} + +// VulnerabilityAssessmentScanListResult - A list of vulnerability assessment scan results. +type VulnerabilityAssessmentScanListResult struct { + // READ-ONLY; Link to retrieve next page of results. + NextLink *string + + // READ-ONLY; Array of results. + Value []*VulnerabilityAssessmentScanResults } // VulnerabilityAssessmentScanRecord - A vulnerability assessment scan record. type VulnerabilityAssessmentScanRecord struct { // Resource properties. - Properties *VulnerabilityAssessmentScanRecordProperties `json:"properties,omitempty"` + Properties *VulnerabilityAssessmentScanRecordProperties + + // READ-ONLY; Resource ID. + ID *string + + // READ-ONLY; Resource name. + Name *string + + // READ-ONLY; Resource type. + Type *string +} + +// VulnerabilityAssessmentScanRecordForSQL - A vulnerability assessment scan record. +type VulnerabilityAssessmentScanRecordForSQL struct { + // Resource properties. + Properties *VulnerabilityAssessmentScanRecordForSQLProperties // READ-ONLY; Resource ID. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; Resource name. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string + + // READ-ONLY; SystemData of SqlVulnerabilityAssessmentScanRecordResource. + SystemData *SystemData // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` + Type *string +} + +// VulnerabilityAssessmentScanRecordForSQLListResult - A list of vulnerability assessment scan records. +type VulnerabilityAssessmentScanRecordForSQLListResult struct { + // READ-ONLY; Link to retrieve next page of results. + NextLink *string + + // READ-ONLY; Array of results. + Value []*VulnerabilityAssessmentScanRecordForSQL +} + +// VulnerabilityAssessmentScanRecordForSQLProperties - Properties of a vulnerability assessment scan record. +type VulnerabilityAssessmentScanRecordForSQLProperties struct { + // READ-ONLY; The database name. + Database *string + + // READ-ONLY; The scan end time (UTC). + EndTime *time.Time + + // READ-ONLY; The scan errors. + Errors []*VulnerabilityAssessmentScanForSQLError + + // READ-ONLY; The number of failed rules with high severity. + HighSeverityFailedRulesCount *int32 + + // READ-ONLY; Baseline created for this database, and has one or more rules. + IsBaselineApplied *bool + + // READ-ONLY; The last scan time. + LastScanTime *time.Time + + // READ-ONLY; The number of failed rules with low severity. + LowSeverityFailedRulesCount *int32 + + // READ-ONLY; The number of failed rules with medium severity. + MediumSeverityFailedRulesCount *int32 + + // READ-ONLY; The SQL version. + SQLVersion *string + + // READ-ONLY; The scan ID. + ScanID *string + + // READ-ONLY; The server name. + Server *string + + // READ-ONLY; The scan start time (UTC). + StartTime *time.Time + + // READ-ONLY; The scan status. + State *VulnerabilityAssessmentScanState + + // READ-ONLY; The number of total failed rules. + TotalFailedRulesCount *int32 + + // READ-ONLY; The number of total passed rules. + TotalPassedRulesCount *int32 + + // READ-ONLY; The number of total rules assessed. + TotalRulesCount *int32 + + // READ-ONLY; The scan trigger type. + TriggerType *VulnerabilityAssessmentScanTriggerType } // VulnerabilityAssessmentScanRecordListResult - A list of vulnerability assessment scan records. type VulnerabilityAssessmentScanRecordListResult struct { // READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` + NextLink *string // READ-ONLY; Array of results. - Value []*VulnerabilityAssessmentScanRecord `json:"value,omitempty" azure:"ro"` + Value []*VulnerabilityAssessmentScanRecord } // VulnerabilityAssessmentScanRecordProperties - Properties of a vulnerability assessment scan record. type VulnerabilityAssessmentScanRecordProperties struct { // READ-ONLY; The scan end time (UTC). - EndTime *time.Time `json:"endTime,omitempty" azure:"ro"` + EndTime *time.Time // READ-ONLY; The scan errors. - Errors []*VulnerabilityAssessmentScanError `json:"errors,omitempty" azure:"ro"` + Errors []*VulnerabilityAssessmentScanError // READ-ONLY; The number of failed security checks. - NumberOfFailedSecurityChecks *int32 `json:"numberOfFailedSecurityChecks,omitempty" azure:"ro"` + NumberOfFailedSecurityChecks *int32 // READ-ONLY; The scan ID. - ScanID *string `json:"scanId,omitempty" azure:"ro"` + ScanID *string // READ-ONLY; The scan start time (UTC). - StartTime *time.Time `json:"startTime,omitempty" azure:"ro"` + StartTime *time.Time // READ-ONLY; The scan status. - State *VulnerabilityAssessmentScanState `json:"state,omitempty" azure:"ro"` + State *VulnerabilityAssessmentScanState // READ-ONLY; The scan results storage container path. - StorageContainerPath *string `json:"storageContainerPath,omitempty" azure:"ro"` + StorageContainerPath *string // READ-ONLY; The scan trigger type. - TriggerType *VulnerabilityAssessmentScanTriggerType `json:"triggerType,omitempty" azure:"ro"` + TriggerType *VulnerabilityAssessmentScanTriggerType +} + +// VulnerabilityAssessmentScanResultProperties - SQL Vulnerability Assessment scan result properties for a single rule. +type VulnerabilityAssessmentScanResultProperties struct { + // READ-ONLY; SQL Vulnerability Assessment rule result adjusted with baseline. + BaselineAdjustedResult *BaselineAdjustedResult + + // READ-ONLY; SQL Vulnerability Assessment error message. + ErrorMessage *string + + // READ-ONLY; SQL Vulnerability Assessment is the query results trimmed. + IsTrimmed *bool + + // READ-ONLY; SQL Vulnerability Assessment query results that was run. + QueryResults [][]*string + + // READ-ONLY; SQL Vulnerability Assessment the remediation details. + Remediation *Remediation + + // READ-ONLY; SQL Vulnerability Assessment rule Id. + RuleID *string + + // READ-ONLY; SQL Vulnerability Assessment rule metadata. + RuleMetadata *VaRule + + // READ-ONLY; SQL Vulnerability Assessment rule result status. + Status *RuleStatus +} + +type VulnerabilityAssessmentScanResults struct { + // Resource properties. + Properties *VulnerabilityAssessmentScanResultProperties + + // READ-ONLY; Resource ID. + ID *string + + // READ-ONLY; Resource name. + Name *string + + // READ-ONLY; SystemData of AdvancedThreatProtectionResource. + SystemData *SystemData + + // READ-ONLY; Resource type. + Type *string } // WorkloadClassifier - Workload classifier operations for a data warehouse type WorkloadClassifier struct { // Resource properties. - Properties *WorkloadClassifierProperties `json:"properties,omitempty"` + Properties *WorkloadClassifierProperties // READ-ONLY; Resource ID. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; Resource name. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // WorkloadClassifierListResult - A list of workload classifiers for a workload group. type WorkloadClassifierListResult struct { // READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` + NextLink *string // READ-ONLY; Array of results. - Value []*WorkloadClassifier `json:"value,omitempty" azure:"ro"` + Value []*WorkloadClassifier } // WorkloadClassifierProperties - Workload classifier definition. For more information look at sys.workloadmanagementworkload_classifiers // (DMV). type WorkloadClassifierProperties struct { // REQUIRED; The workload classifier member name. - MemberName *string `json:"memberName,omitempty"` + MemberName *string // The workload classifier context. - Context *string `json:"context,omitempty"` + Context *string // The workload classifier end time for classification. - EndTime *string `json:"endTime,omitempty"` + EndTime *string // The workload classifier importance. - Importance *string `json:"importance,omitempty"` + Importance *string // The workload classifier label. - Label *string `json:"label,omitempty"` + Label *string // The workload classifier start time for classification. - StartTime *string `json:"startTime,omitempty"` -} - -// WorkloadClassifiersClientBeginCreateOrUpdateOptions contains the optional parameters for the WorkloadClassifiersClient.BeginCreateOrUpdate -// method. -type WorkloadClassifiersClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// WorkloadClassifiersClientBeginDeleteOptions contains the optional parameters for the WorkloadClassifiersClient.BeginDelete -// method. -type WorkloadClassifiersClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// WorkloadClassifiersClientGetOptions contains the optional parameters for the WorkloadClassifiersClient.Get method. -type WorkloadClassifiersClientGetOptions struct { - // placeholder for future optional parameters -} - -// WorkloadClassifiersClientListByWorkloadGroupOptions contains the optional parameters for the WorkloadClassifiersClient.NewListByWorkloadGroupPager -// method. -type WorkloadClassifiersClientListByWorkloadGroupOptions struct { - // placeholder for future optional parameters + StartTime *string } // WorkloadGroup - Workload group operations for a data warehouse type WorkloadGroup struct { // Resource properties. - Properties *WorkloadGroupProperties `json:"properties,omitempty"` + Properties *WorkloadGroupProperties // READ-ONLY; Resource ID. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; Resource name. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // WorkloadGroupListResult - A list of workload groups. type WorkloadGroupListResult struct { // READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` + NextLink *string // READ-ONLY; Array of results. - Value []*WorkloadGroup `json:"value,omitempty" azure:"ro"` + Value []*WorkloadGroup } // WorkloadGroupProperties - Workload group definition. For more information look at sys.workloadmanagementworkload_groups // (DMV). type WorkloadGroupProperties struct { // REQUIRED; The workload group cap percentage resource. - MaxResourcePercent *int32 `json:"maxResourcePercent,omitempty"` + MaxResourcePercent *int32 // REQUIRED; The workload group minimum percentage resource. - MinResourcePercent *int32 `json:"minResourcePercent,omitempty"` + MinResourcePercent *int32 // REQUIRED; The workload group request minimum grant percentage. - MinResourcePercentPerRequest *float64 `json:"minResourcePercentPerRequest,omitempty"` + MinResourcePercentPerRequest *float64 // The workload group importance level. - Importance *string `json:"importance,omitempty"` + Importance *string // The workload group request maximum grant percentage. - MaxResourcePercentPerRequest *float64 `json:"maxResourcePercentPerRequest,omitempty"` + MaxResourcePercentPerRequest *float64 // The workload group query execution timeout. - QueryExecutionTimeout *int32 `json:"queryExecutionTimeout,omitempty"` -} - -// WorkloadGroupsClientBeginCreateOrUpdateOptions contains the optional parameters for the WorkloadGroupsClient.BeginCreateOrUpdate -// method. -type WorkloadGroupsClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// WorkloadGroupsClientBeginDeleteOptions contains the optional parameters for the WorkloadGroupsClient.BeginDelete method. -type WorkloadGroupsClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// WorkloadGroupsClientGetOptions contains the optional parameters for the WorkloadGroupsClient.Get method. -type WorkloadGroupsClientGetOptions struct { - // placeholder for future optional parameters -} - -// WorkloadGroupsClientListByDatabaseOptions contains the optional parameters for the WorkloadGroupsClient.NewListByDatabasePager -// method. -type WorkloadGroupsClientListByDatabaseOptions struct { - // placeholder for future optional parameters + QueryExecutionTimeout *int32 } diff --git a/sdk/resourcemanager/sql/armsql/models_serde.go b/sdk/resourcemanager/sql/armsql/models_serde.go index e1686b004d78..db7d0c1f2894 100644 --- a/sdk/resourcemanager/sql/armsql/models_serde.go +++ b/sdk/resourcemanager/sql/armsql/models_serde.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armsql @@ -639,6 +638,107 @@ func (b *BaseLongTermRetentionPolicyProperties) UnmarshalJSON(data []byte) error return nil } +// MarshalJSON implements the json.Marshaller interface for type Baseline. +func (b Baseline) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "expectedResults", b.ExpectedResults) + populateTimeRFC3339(objectMap, "updatedTime", b.UpdatedTime) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Baseline. +func (b *Baseline) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "expectedResults": + err = unpopulate(val, "ExpectedResults", &b.ExpectedResults) + delete(rawMsg, key) + case "updatedTime": + err = unpopulateTimeRFC3339(val, "UpdatedTime", &b.UpdatedTime) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BaselineAdjustedResult. +func (b BaselineAdjustedResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "baseline", b.Baseline) + populate(objectMap, "resultsNotInBaseline", b.ResultsNotInBaseline) + populate(objectMap, "resultsOnlyInBaseline", b.ResultsOnlyInBaseline) + populate(objectMap, "status", b.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BaselineAdjustedResult. +func (b *BaselineAdjustedResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "baseline": + err = unpopulate(val, "Baseline", &b.Baseline) + delete(rawMsg, key) + case "resultsNotInBaseline": + err = unpopulate(val, "ResultsNotInBaseline", &b.ResultsNotInBaseline) + delete(rawMsg, key) + case "resultsOnlyInBaseline": + err = unpopulate(val, "ResultsOnlyInBaseline", &b.ResultsOnlyInBaseline) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &b.Status) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BenchmarkReference. +func (b BenchmarkReference) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "benchmark", b.Benchmark) + populate(objectMap, "reference", b.Reference) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BenchmarkReference. +func (b *BenchmarkReference) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "benchmark": + err = unpopulate(val, "Benchmark", &b.Benchmark) + delete(rawMsg, key) + case "reference": + err = unpopulate(val, "Reference", &b.Reference) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type CheckNameAvailabilityRequest. func (c CheckNameAvailabilityRequest) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -837,33 +937,6 @@ func (c *CreateDatabaseRestorePointDefinition) UnmarshalJSON(data []byte) error return nil } -// MarshalJSON implements the json.Marshaller interface for type DNSRefreshConfigurationProperties. -func (d DNSRefreshConfigurationProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "status", d.Status) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DNSRefreshConfigurationProperties. -func (d *DNSRefreshConfigurationProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "status": - err = unpopulate(val, "Status", &d.Status) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - // MarshalJSON implements the json.Marshaller interface for type DataMaskingPolicy. func (d DataMaskingPolicy) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -1000,6 +1073,7 @@ func (d *DataMaskingRule) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type DataMaskingRuleListResult. func (d DataMaskingRuleListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "nextLink", d.NextLink) populate(objectMap, "value", d.Value) return json.Marshal(objectMap) } @@ -1013,6 +1087,9 @@ func (d *DataMaskingRuleListResult) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &d.NextLink) + delete(rawMsg, key) case "value": err = unpopulate(val, "Value", &d.Value) delete(rawMsg, key) @@ -1691,7 +1768,14 @@ func (d *DatabaseExtensions) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type DatabaseExtensionsProperties. func (d DatabaseExtensionsProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "administratorLogin", d.AdministratorLogin) + populate(objectMap, "administratorLoginPassword", d.AdministratorLoginPassword) + populate(objectMap, "authenticationType", d.AuthenticationType) + populate(objectMap, "databaseEdition", d.DatabaseEdition) + populate(objectMap, "maxSizeBytes", d.MaxSizeBytes) + populate(objectMap, "networkIsolation", d.NetworkIsolation) populate(objectMap, "operationMode", d.OperationMode) + populate(objectMap, "serviceObjectiveName", d.ServiceObjectiveName) populate(objectMap, "storageKey", d.StorageKey) populate(objectMap, "storageKeyType", d.StorageKeyType) populate(objectMap, "storageUri", d.StorageURI) @@ -1707,9 +1791,30 @@ func (d *DatabaseExtensionsProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "administratorLogin": + err = unpopulate(val, "AdministratorLogin", &d.AdministratorLogin) + delete(rawMsg, key) + case "administratorLoginPassword": + err = unpopulate(val, "AdministratorLoginPassword", &d.AdministratorLoginPassword) + delete(rawMsg, key) + case "authenticationType": + err = unpopulate(val, "AuthenticationType", &d.AuthenticationType) + delete(rawMsg, key) + case "databaseEdition": + err = unpopulate(val, "DatabaseEdition", &d.DatabaseEdition) + delete(rawMsg, key) + case "maxSizeBytes": + err = unpopulate(val, "MaxSizeBytes", &d.MaxSizeBytes) + delete(rawMsg, key) + case "networkIsolation": + err = unpopulate(val, "NetworkIsolation", &d.NetworkIsolation) + delete(rawMsg, key) case "operationMode": err = unpopulate(val, "OperationMode", &d.OperationMode) delete(rawMsg, key) + case "serviceObjectiveName": + err = unpopulate(val, "ServiceObjectiveName", &d.ServiceObjectiveName) + delete(rawMsg, key) case "storageKey": err = unpopulate(val, "StorageKey", &d.StorageKey) delete(rawMsg, key) @@ -1762,6 +1867,45 @@ func (d *DatabaseIdentity) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type DatabaseKey. +func (d DatabaseKey) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populateTimeRFC3339(objectMap, "creationDate", d.CreationDate) + populate(objectMap, "subregion", d.Subregion) + populate(objectMap, "thumbprint", d.Thumbprint) + populate(objectMap, "type", d.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DatabaseKey. +func (d *DatabaseKey) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "creationDate": + err = unpopulateTimeRFC3339(val, "CreationDate", &d.CreationDate) + delete(rawMsg, key) + case "subregion": + err = unpopulate(val, "Subregion", &d.Subregion) + delete(rawMsg, key) + case "thumbprint": + err = unpopulate(val, "Thumbprint", &d.Thumbprint) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &d.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type DatabaseListResult. func (d DatabaseListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -1876,6 +2020,7 @@ func (d DatabaseOperationProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "isUserError", d.IsUserError) populate(objectMap, "operation", d.Operation) populate(objectMap, "operationFriendlyName", d.OperationFriendlyName) + populate(objectMap, "operationPhaseDetails", d.OperationPhaseDetails) populate(objectMap, "percentComplete", d.PercentComplete) populate(objectMap, "serverName", d.ServerName) populateTimeRFC3339(objectMap, "startTime", d.StartTime) @@ -1922,6 +2067,9 @@ func (d *DatabaseOperationProperties) UnmarshalJSON(data []byte) error { case "operationFriendlyName": err = unpopulate(val, "OperationFriendlyName", &d.OperationFriendlyName) delete(rawMsg, key) + case "operationPhaseDetails": + err = unpopulate(val, "OperationPhaseDetails", &d.OperationPhaseDetails) + delete(rawMsg, key) case "percentComplete": err = unpopulate(val, "PercentComplete", &d.PercentComplete) delete(rawMsg, key) @@ -1946,6 +2094,7 @@ func (d *DatabaseOperationProperties) UnmarshalJSON(data []byte) error { func (d DatabaseProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "autoPauseDelay", d.AutoPauseDelay) + populate(objectMap, "availabilityZone", d.AvailabilityZone) populate(objectMap, "catalogCollation", d.CatalogCollation) populate(objectMap, "collation", d.Collation) populate(objectMap, "createMode", d.CreateMode) @@ -1957,18 +2106,23 @@ func (d DatabaseProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "defaultSecondaryLocation", d.DefaultSecondaryLocation) populateTimeRFC3339(objectMap, "earliestRestoreDate", d.EarliestRestoreDate) populate(objectMap, "elasticPoolId", d.ElasticPoolID) + populate(objectMap, "encryptionProtector", d.EncryptionProtector) populate(objectMap, "failoverGroupId", d.FailoverGroupID) populate(objectMap, "federatedClientId", d.FederatedClientID) populate(objectMap, "highAvailabilityReplicaCount", d.HighAvailabilityReplicaCount) populate(objectMap, "isInfraEncryptionEnabled", d.IsInfraEncryptionEnabled) populate(objectMap, "isLedgerOn", d.IsLedgerOn) + populate(objectMap, "keys", d.Keys) populate(objectMap, "licenseType", d.LicenseType) populate(objectMap, "longTermRetentionBackupResourceId", d.LongTermRetentionBackupResourceID) populate(objectMap, "maintenanceConfigurationId", d.MaintenanceConfigurationID) + populate(objectMap, "manualCutover", d.ManualCutover) populate(objectMap, "maxLogSizeBytes", d.MaxLogSizeBytes) populate(objectMap, "maxSizeBytes", d.MaxSizeBytes) populate(objectMap, "minCapacity", d.MinCapacity) populateTimeRFC3339(objectMap, "pausedDate", d.PausedDate) + populate(objectMap, "performCutover", d.PerformCutover) + populate(objectMap, "preferredEnclaveType", d.PreferredEnclaveType) populate(objectMap, "readScale", d.ReadScale) populate(objectMap, "recoverableDatabaseId", d.RecoverableDatabaseID) populate(objectMap, "recoveryServicesRecoveryPointId", d.RecoveryServicesRecoveryPointID) @@ -1999,6 +2153,9 @@ func (d *DatabaseProperties) UnmarshalJSON(data []byte) error { case "autoPauseDelay": err = unpopulate(val, "AutoPauseDelay", &d.AutoPauseDelay) delete(rawMsg, key) + case "availabilityZone": + err = unpopulate(val, "AvailabilityZone", &d.AvailabilityZone) + delete(rawMsg, key) case "catalogCollation": err = unpopulate(val, "CatalogCollation", &d.CatalogCollation) delete(rawMsg, key) @@ -2032,6 +2189,9 @@ func (d *DatabaseProperties) UnmarshalJSON(data []byte) error { case "elasticPoolId": err = unpopulate(val, "ElasticPoolID", &d.ElasticPoolID) delete(rawMsg, key) + case "encryptionProtector": + err = unpopulate(val, "EncryptionProtector", &d.EncryptionProtector) + delete(rawMsg, key) case "failoverGroupId": err = unpopulate(val, "FailoverGroupID", &d.FailoverGroupID) delete(rawMsg, key) @@ -2047,6 +2207,9 @@ func (d *DatabaseProperties) UnmarshalJSON(data []byte) error { case "isLedgerOn": err = unpopulate(val, "IsLedgerOn", &d.IsLedgerOn) delete(rawMsg, key) + case "keys": + err = unpopulate(val, "Keys", &d.Keys) + delete(rawMsg, key) case "licenseType": err = unpopulate(val, "LicenseType", &d.LicenseType) delete(rawMsg, key) @@ -2056,6 +2219,9 @@ func (d *DatabaseProperties) UnmarshalJSON(data []byte) error { case "maintenanceConfigurationId": err = unpopulate(val, "MaintenanceConfigurationID", &d.MaintenanceConfigurationID) delete(rawMsg, key) + case "manualCutover": + err = unpopulate(val, "ManualCutover", &d.ManualCutover) + delete(rawMsg, key) case "maxLogSizeBytes": err = unpopulate(val, "MaxLogSizeBytes", &d.MaxLogSizeBytes) delete(rawMsg, key) @@ -2068,6 +2234,12 @@ func (d *DatabaseProperties) UnmarshalJSON(data []byte) error { case "pausedDate": err = unpopulateTimeRFC3339(val, "PausedDate", &d.PausedDate) delete(rawMsg, key) + case "performCutover": + err = unpopulate(val, "PerformCutover", &d.PerformCutover) + delete(rawMsg, key) + case "preferredEnclaveType": + err = unpopulate(val, "PreferredEnclaveType", &d.PreferredEnclaveType) + delete(rawMsg, key) case "readScale": err = unpopulate(val, "ReadScale", &d.ReadScale) delete(rawMsg, key) @@ -2121,17 +2293,19 @@ func (d *DatabaseProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type DatabaseSchema. -func (d DatabaseSchema) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DatabaseSQLVulnerabilityAssessmentBaselineSet. +func (d DatabaseSQLVulnerabilityAssessmentBaselineSet) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", d.ID) populate(objectMap, "name", d.Name) + populate(objectMap, "properties", d.Properties) + populate(objectMap, "systemData", d.SystemData) populate(objectMap, "type", d.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DatabaseSchema. -func (d *DatabaseSchema) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DatabaseSQLVulnerabilityAssessmentBaselineSet. +func (d *DatabaseSQLVulnerabilityAssessmentBaselineSet) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", d, err) @@ -2145,6 +2319,12 @@ func (d *DatabaseSchema) UnmarshalJSON(data []byte) error { case "name": err = unpopulate(val, "Name", &d.Name) delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &d.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &d.SystemData) + delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &d.Type) delete(rawMsg, key) @@ -2156,16 +2336,16 @@ func (d *DatabaseSchema) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type DatabaseSchemaListResult. -func (d DatabaseSchemaListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DatabaseSQLVulnerabilityAssessmentBaselineSetListResult. +func (d DatabaseSQLVulnerabilityAssessmentBaselineSetListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "nextLink", d.NextLink) populate(objectMap, "value", d.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DatabaseSchemaListResult. -func (d *DatabaseSchemaListResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DatabaseSQLVulnerabilityAssessmentBaselineSetListResult. +func (d *DatabaseSQLVulnerabilityAssessmentBaselineSetListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", d, err) @@ -2187,16 +2367,15 @@ func (d *DatabaseSchemaListResult) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type DatabaseSecurityAlertListResult. -func (d DatabaseSecurityAlertListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DatabaseSQLVulnerabilityAssessmentBaselineSetProperties. +func (d DatabaseSQLVulnerabilityAssessmentBaselineSetProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", d.NextLink) - populate(objectMap, "value", d.Value) + populate(objectMap, "results", d.Results) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DatabaseSecurityAlertListResult. -func (d *DatabaseSecurityAlertListResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DatabaseSQLVulnerabilityAssessmentBaselineSetProperties. +func (d *DatabaseSQLVulnerabilityAssessmentBaselineSetProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", d, err) @@ -2204,11 +2383,8 @@ func (d *DatabaseSecurityAlertListResult) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &d.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &d.Value) + case "results": + err = unpopulate(val, "Results", &d.Results) delete(rawMsg, key) } if err != nil { @@ -2218,8 +2394,8 @@ func (d *DatabaseSecurityAlertListResult) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type DatabaseSecurityAlertPolicy. -func (d DatabaseSecurityAlertPolicy) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DatabaseSQLVulnerabilityAssessmentRuleBaseline. +func (d DatabaseSQLVulnerabilityAssessmentRuleBaseline) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", d.ID) populate(objectMap, "name", d.Name) @@ -2229,8 +2405,8 @@ func (d DatabaseSecurityAlertPolicy) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DatabaseSecurityAlertPolicy. -func (d *DatabaseSecurityAlertPolicy) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DatabaseSQLVulnerabilityAssessmentRuleBaseline. +func (d *DatabaseSQLVulnerabilityAssessmentRuleBaseline) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", d, err) @@ -2261,18 +2437,19 @@ func (d *DatabaseSecurityAlertPolicy) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type DatabaseTable. -func (d DatabaseTable) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DatabaseSQLVulnerabilityAssessmentRuleBaselineInput. +func (d DatabaseSQLVulnerabilityAssessmentRuleBaselineInput) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", d.ID) populate(objectMap, "name", d.Name) populate(objectMap, "properties", d.Properties) + populate(objectMap, "systemData", d.SystemData) populate(objectMap, "type", d.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DatabaseTable. -func (d *DatabaseTable) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DatabaseSQLVulnerabilityAssessmentRuleBaselineInput. +func (d *DatabaseSQLVulnerabilityAssessmentRuleBaselineInput) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", d, err) @@ -2289,6 +2466,9 @@ func (d *DatabaseTable) UnmarshalJSON(data []byte) error { case "properties": err = unpopulate(val, "Properties", &d.Properties) delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &d.SystemData) + delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &d.Type) delete(rawMsg, key) @@ -2300,16 +2480,16 @@ func (d *DatabaseTable) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type DatabaseTableListResult. -func (d DatabaseTableListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DatabaseSQLVulnerabilityAssessmentRuleBaselineInputProperties. +func (d DatabaseSQLVulnerabilityAssessmentRuleBaselineInputProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", d.NextLink) - populate(objectMap, "value", d.Value) + populate(objectMap, "latestScan", d.LatestScan) + populate(objectMap, "results", d.Results) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DatabaseTableListResult. -func (d *DatabaseTableListResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DatabaseSQLVulnerabilityAssessmentRuleBaselineInputProperties. +func (d *DatabaseSQLVulnerabilityAssessmentRuleBaselineInputProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", d, err) @@ -2317,11 +2497,11 @@ func (d *DatabaseTableListResult) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &d.NextLink) + case "latestScan": + err = unpopulate(val, "LatestScan", &d.LatestScan) delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &d.Value) + case "results": + err = unpopulate(val, "Results", &d.Results) delete(rawMsg, key) } if err != nil { @@ -2331,16 +2511,19 @@ func (d *DatabaseTableListResult) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type DatabaseTableProperties. -func (d DatabaseTableProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DatabaseSQLVulnerabilityAssessmentRuleBaselineListInput. +func (d DatabaseSQLVulnerabilityAssessmentRuleBaselineListInput) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "memoryOptimized", d.MemoryOptimized) - populate(objectMap, "temporalType", d.TemporalType) + populate(objectMap, "id", d.ID) + populate(objectMap, "name", d.Name) + populate(objectMap, "properties", d.Properties) + populate(objectMap, "systemData", d.SystemData) + populate(objectMap, "type", d.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DatabaseTableProperties. -func (d *DatabaseTableProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DatabaseSQLVulnerabilityAssessmentRuleBaselineListInput. +func (d *DatabaseSQLVulnerabilityAssessmentRuleBaselineListInput) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", d, err) @@ -2348,11 +2531,20 @@ func (d *DatabaseTableProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "memoryOptimized": - err = unpopulate(val, "MemoryOptimized", &d.MemoryOptimized) + case "id": + err = unpopulate(val, "ID", &d.ID) delete(rawMsg, key) - case "temporalType": - err = unpopulate(val, "TemporalType", &d.TemporalType) + case "name": + err = unpopulate(val, "Name", &d.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &d.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &d.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &d.Type) delete(rawMsg, key) } if err != nil { @@ -2362,18 +2554,16 @@ func (d *DatabaseTableProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type DatabaseUpdate. -func (d DatabaseUpdate) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DatabaseSQLVulnerabilityAssessmentRuleBaselineListInputProperties. +func (d DatabaseSQLVulnerabilityAssessmentRuleBaselineListInputProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "identity", d.Identity) - populate(objectMap, "properties", d.Properties) - populate(objectMap, "sku", d.SKU) - populate(objectMap, "tags", d.Tags) + populate(objectMap, "latestScan", d.LatestScan) + populate(objectMap, "results", d.Results) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DatabaseUpdate. -func (d *DatabaseUpdate) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DatabaseSQLVulnerabilityAssessmentRuleBaselineListInputProperties. +func (d *DatabaseSQLVulnerabilityAssessmentRuleBaselineListInputProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", d, err) @@ -2381,17 +2571,11 @@ func (d *DatabaseUpdate) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "identity": - err = unpopulate(val, "Identity", &d.Identity) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &d.Properties) + case "latestScan": + err = unpopulate(val, "LatestScan", &d.LatestScan) delete(rawMsg, key) - case "sku": - err = unpopulate(val, "SKU", &d.SKU) - delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &d.Tags) + case "results": + err = unpopulate(val, "Results", &d.Results) delete(rawMsg, key) } if err != nil { @@ -2401,52 +2585,16 @@ func (d *DatabaseUpdate) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type DatabaseUpdateProperties. -func (d DatabaseUpdateProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DatabaseSQLVulnerabilityAssessmentRuleBaselineListResult. +func (d DatabaseSQLVulnerabilityAssessmentRuleBaselineListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "autoPauseDelay", d.AutoPauseDelay) - populate(objectMap, "catalogCollation", d.CatalogCollation) - populate(objectMap, "collation", d.Collation) - populate(objectMap, "createMode", d.CreateMode) - populateTimeRFC3339(objectMap, "creationDate", d.CreationDate) - populate(objectMap, "currentBackupStorageRedundancy", d.CurrentBackupStorageRedundancy) - populate(objectMap, "currentSku", d.CurrentSKU) - populate(objectMap, "currentServiceObjectiveName", d.CurrentServiceObjectiveName) - populate(objectMap, "databaseId", d.DatabaseID) - populate(objectMap, "defaultSecondaryLocation", d.DefaultSecondaryLocation) - populateTimeRFC3339(objectMap, "earliestRestoreDate", d.EarliestRestoreDate) - populate(objectMap, "elasticPoolId", d.ElasticPoolID) - populate(objectMap, "failoverGroupId", d.FailoverGroupID) - populate(objectMap, "federatedClientId", d.FederatedClientID) - populate(objectMap, "highAvailabilityReplicaCount", d.HighAvailabilityReplicaCount) - populate(objectMap, "isInfraEncryptionEnabled", d.IsInfraEncryptionEnabled) - populate(objectMap, "isLedgerOn", d.IsLedgerOn) - populate(objectMap, "licenseType", d.LicenseType) - populate(objectMap, "longTermRetentionBackupResourceId", d.LongTermRetentionBackupResourceID) - populate(objectMap, "maintenanceConfigurationId", d.MaintenanceConfigurationID) - populate(objectMap, "maxLogSizeBytes", d.MaxLogSizeBytes) - populate(objectMap, "maxSizeBytes", d.MaxSizeBytes) - populate(objectMap, "minCapacity", d.MinCapacity) - populateTimeRFC3339(objectMap, "pausedDate", d.PausedDate) - populate(objectMap, "readScale", d.ReadScale) - populate(objectMap, "recoverableDatabaseId", d.RecoverableDatabaseID) - populate(objectMap, "recoveryServicesRecoveryPointId", d.RecoveryServicesRecoveryPointID) - populate(objectMap, "requestedBackupStorageRedundancy", d.RequestedBackupStorageRedundancy) - populate(objectMap, "requestedServiceObjectiveName", d.RequestedServiceObjectiveName) - populate(objectMap, "restorableDroppedDatabaseId", d.RestorableDroppedDatabaseID) - populateTimeRFC3339(objectMap, "restorePointInTime", d.RestorePointInTime) - populateTimeRFC3339(objectMap, "resumedDate", d.ResumedDate) - populate(objectMap, "sampleName", d.SampleName) - populate(objectMap, "secondaryType", d.SecondaryType) - populateTimeRFC3339(objectMap, "sourceDatabaseDeletionDate", d.SourceDatabaseDeletionDate) - populate(objectMap, "sourceDatabaseId", d.SourceDatabaseID) - populate(objectMap, "status", d.Status) - populate(objectMap, "zoneRedundant", d.ZoneRedundant) + populate(objectMap, "nextLink", d.NextLink) + populate(objectMap, "value", d.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DatabaseUpdateProperties. -func (d *DatabaseUpdateProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DatabaseSQLVulnerabilityAssessmentRuleBaselineListResult. +func (d *DatabaseSQLVulnerabilityAssessmentRuleBaselineListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", d, err) @@ -2454,119 +2602,38 @@ func (d *DatabaseUpdateProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "autoPauseDelay": - err = unpopulate(val, "AutoPauseDelay", &d.AutoPauseDelay) - delete(rawMsg, key) - case "catalogCollation": - err = unpopulate(val, "CatalogCollation", &d.CatalogCollation) - delete(rawMsg, key) - case "collation": - err = unpopulate(val, "Collation", &d.Collation) - delete(rawMsg, key) - case "createMode": - err = unpopulate(val, "CreateMode", &d.CreateMode) - delete(rawMsg, key) - case "creationDate": - err = unpopulateTimeRFC3339(val, "CreationDate", &d.CreationDate) - delete(rawMsg, key) - case "currentBackupStorageRedundancy": - err = unpopulate(val, "CurrentBackupStorageRedundancy", &d.CurrentBackupStorageRedundancy) - delete(rawMsg, key) - case "currentSku": - err = unpopulate(val, "CurrentSKU", &d.CurrentSKU) - delete(rawMsg, key) - case "currentServiceObjectiveName": - err = unpopulate(val, "CurrentServiceObjectiveName", &d.CurrentServiceObjectiveName) - delete(rawMsg, key) - case "databaseId": - err = unpopulate(val, "DatabaseID", &d.DatabaseID) - delete(rawMsg, key) - case "defaultSecondaryLocation": - err = unpopulate(val, "DefaultSecondaryLocation", &d.DefaultSecondaryLocation) - delete(rawMsg, key) - case "earliestRestoreDate": - err = unpopulateTimeRFC3339(val, "EarliestRestoreDate", &d.EarliestRestoreDate) - delete(rawMsg, key) - case "elasticPoolId": - err = unpopulate(val, "ElasticPoolID", &d.ElasticPoolID) - delete(rawMsg, key) - case "failoverGroupId": - err = unpopulate(val, "FailoverGroupID", &d.FailoverGroupID) - delete(rawMsg, key) - case "federatedClientId": - err = unpopulate(val, "FederatedClientID", &d.FederatedClientID) - delete(rawMsg, key) - case "highAvailabilityReplicaCount": - err = unpopulate(val, "HighAvailabilityReplicaCount", &d.HighAvailabilityReplicaCount) - delete(rawMsg, key) - case "isInfraEncryptionEnabled": - err = unpopulate(val, "IsInfraEncryptionEnabled", &d.IsInfraEncryptionEnabled) - delete(rawMsg, key) - case "isLedgerOn": - err = unpopulate(val, "IsLedgerOn", &d.IsLedgerOn) - delete(rawMsg, key) - case "licenseType": - err = unpopulate(val, "LicenseType", &d.LicenseType) - delete(rawMsg, key) - case "longTermRetentionBackupResourceId": - err = unpopulate(val, "LongTermRetentionBackupResourceID", &d.LongTermRetentionBackupResourceID) - delete(rawMsg, key) - case "maintenanceConfigurationId": - err = unpopulate(val, "MaintenanceConfigurationID", &d.MaintenanceConfigurationID) - delete(rawMsg, key) - case "maxLogSizeBytes": - err = unpopulate(val, "MaxLogSizeBytes", &d.MaxLogSizeBytes) - delete(rawMsg, key) - case "maxSizeBytes": - err = unpopulate(val, "MaxSizeBytes", &d.MaxSizeBytes) - delete(rawMsg, key) - case "minCapacity": - err = unpopulate(val, "MinCapacity", &d.MinCapacity) - delete(rawMsg, key) - case "pausedDate": - err = unpopulateTimeRFC3339(val, "PausedDate", &d.PausedDate) - delete(rawMsg, key) - case "readScale": - err = unpopulate(val, "ReadScale", &d.ReadScale) - delete(rawMsg, key) - case "recoverableDatabaseId": - err = unpopulate(val, "RecoverableDatabaseID", &d.RecoverableDatabaseID) - delete(rawMsg, key) - case "recoveryServicesRecoveryPointId": - err = unpopulate(val, "RecoveryServicesRecoveryPointID", &d.RecoveryServicesRecoveryPointID) - delete(rawMsg, key) - case "requestedBackupStorageRedundancy": - err = unpopulate(val, "RequestedBackupStorageRedundancy", &d.RequestedBackupStorageRedundancy) - delete(rawMsg, key) - case "requestedServiceObjectiveName": - err = unpopulate(val, "RequestedServiceObjectiveName", &d.RequestedServiceObjectiveName) - delete(rawMsg, key) - case "restorableDroppedDatabaseId": - err = unpopulate(val, "RestorableDroppedDatabaseID", &d.RestorableDroppedDatabaseID) - delete(rawMsg, key) - case "restorePointInTime": - err = unpopulateTimeRFC3339(val, "RestorePointInTime", &d.RestorePointInTime) - delete(rawMsg, key) - case "resumedDate": - err = unpopulateTimeRFC3339(val, "ResumedDate", &d.ResumedDate) - delete(rawMsg, key) - case "sampleName": - err = unpopulate(val, "SampleName", &d.SampleName) - delete(rawMsg, key) - case "secondaryType": - err = unpopulate(val, "SecondaryType", &d.SecondaryType) - delete(rawMsg, key) - case "sourceDatabaseDeletionDate": - err = unpopulateTimeRFC3339(val, "SourceDatabaseDeletionDate", &d.SourceDatabaseDeletionDate) - delete(rawMsg, key) - case "sourceDatabaseId": - err = unpopulate(val, "SourceDatabaseID", &d.SourceDatabaseID) + case "nextLink": + err = unpopulate(val, "NextLink", &d.NextLink) delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &d.Status) + case "value": + err = unpopulate(val, "Value", &d.Value) delete(rawMsg, key) - case "zoneRedundant": - err = unpopulate(val, "ZoneRedundant", &d.ZoneRedundant) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DatabaseSQLVulnerabilityAssessmentRuleBaselineProperties. +func (d DatabaseSQLVulnerabilityAssessmentRuleBaselineProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "results", d.Results) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DatabaseSQLVulnerabilityAssessmentRuleBaselineProperties. +func (d *DatabaseSQLVulnerabilityAssessmentRuleBaselineProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "results": + err = unpopulate(val, "Results", &d.Results) delete(rawMsg, key) } if err != nil { @@ -2576,18 +2643,17 @@ func (d *DatabaseUpdateProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type DatabaseUsage. -func (d DatabaseUsage) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DatabaseSchema. +func (d DatabaseSchema) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", d.ID) populate(objectMap, "name", d.Name) - populate(objectMap, "properties", d.Properties) populate(objectMap, "type", d.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DatabaseUsage. -func (d *DatabaseUsage) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DatabaseSchema. +func (d *DatabaseSchema) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", d, err) @@ -2601,9 +2667,6 @@ func (d *DatabaseUsage) UnmarshalJSON(data []byte) error { case "name": err = unpopulate(val, "Name", &d.Name) delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &d.Properties) - delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &d.Type) delete(rawMsg, key) @@ -2615,16 +2678,16 @@ func (d *DatabaseUsage) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type DatabaseUsageListResult. -func (d DatabaseUsageListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DatabaseSchemaListResult. +func (d DatabaseSchemaListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "nextLink", d.NextLink) populate(objectMap, "value", d.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DatabaseUsageListResult. -func (d *DatabaseUsageListResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DatabaseSchemaListResult. +func (d *DatabaseSchemaListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", d, err) @@ -2646,18 +2709,16 @@ func (d *DatabaseUsageListResult) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type DatabaseUsageProperties. -func (d DatabaseUsageProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DatabaseSecurityAlertListResult. +func (d DatabaseSecurityAlertListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "currentValue", d.CurrentValue) - populate(objectMap, "displayName", d.DisplayName) - populate(objectMap, "limit", d.Limit) - populate(objectMap, "unit", d.Unit) + populate(objectMap, "nextLink", d.NextLink) + populate(objectMap, "value", d.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DatabaseUsageProperties. -func (d *DatabaseUsageProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DatabaseSecurityAlertListResult. +func (d *DatabaseSecurityAlertListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", d, err) @@ -2665,17 +2726,11 @@ func (d *DatabaseUsageProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "currentValue": - err = unpopulate(val, "CurrentValue", &d.CurrentValue) - delete(rawMsg, key) - case "displayName": - err = unpopulate(val, "DisplayName", &d.DisplayName) - delete(rawMsg, key) - case "limit": - err = unpopulate(val, "Limit", &d.Limit) + case "nextLink": + err = unpopulate(val, "NextLink", &d.NextLink) delete(rawMsg, key) - case "unit": - err = unpopulate(val, "Unit", &d.Unit) + case "value": + err = unpopulate(val, "Value", &d.Value) delete(rawMsg, key) } if err != nil { @@ -2685,16 +2740,19 @@ func (d *DatabaseUsageProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type DatabaseUserIdentity. -func (d DatabaseUserIdentity) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DatabaseSecurityAlertPolicy. +func (d DatabaseSecurityAlertPolicy) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "clientId", d.ClientID) - populate(objectMap, "principalId", d.PrincipalID) + populate(objectMap, "id", d.ID) + populate(objectMap, "name", d.Name) + populate(objectMap, "properties", d.Properties) + populate(objectMap, "systemData", d.SystemData) + populate(objectMap, "type", d.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DatabaseUserIdentity. -func (d *DatabaseUserIdentity) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DatabaseSecurityAlertPolicy. +func (d *DatabaseSecurityAlertPolicy) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", d, err) @@ -2702,11 +2760,20 @@ func (d *DatabaseUserIdentity) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "clientId": - err = unpopulate(val, "ClientID", &d.ClientID) + case "id": + err = unpopulate(val, "ID", &d.ID) delete(rawMsg, key) - case "principalId": - err = unpopulate(val, "PrincipalID", &d.PrincipalID) + case "name": + err = unpopulate(val, "Name", &d.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &d.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &d.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &d.Type) delete(rawMsg, key) } if err != nil { @@ -2716,8 +2783,8 @@ func (d *DatabaseUserIdentity) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type DatabaseVulnerabilityAssessment. -func (d DatabaseVulnerabilityAssessment) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DatabaseTable. +func (d DatabaseTable) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", d.ID) populate(objectMap, "name", d.Name) @@ -2726,8 +2793,8 @@ func (d DatabaseVulnerabilityAssessment) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DatabaseVulnerabilityAssessment. -func (d *DatabaseVulnerabilityAssessment) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DatabaseTable. +func (d *DatabaseTable) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", d, err) @@ -2755,16 +2822,16 @@ func (d *DatabaseVulnerabilityAssessment) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type DatabaseVulnerabilityAssessmentListResult. -func (d DatabaseVulnerabilityAssessmentListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DatabaseTableListResult. +func (d DatabaseTableListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "nextLink", d.NextLink) populate(objectMap, "value", d.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DatabaseVulnerabilityAssessmentListResult. -func (d *DatabaseVulnerabilityAssessmentListResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DatabaseTableListResult. +func (d *DatabaseTableListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", d, err) @@ -2786,18 +2853,16 @@ func (d *DatabaseVulnerabilityAssessmentListResult) UnmarshalJSON(data []byte) e return nil } -// MarshalJSON implements the json.Marshaller interface for type DatabaseVulnerabilityAssessmentProperties. -func (d DatabaseVulnerabilityAssessmentProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DatabaseTableProperties. +func (d DatabaseTableProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "recurringScans", d.RecurringScans) - populate(objectMap, "storageAccountAccessKey", d.StorageAccountAccessKey) - populate(objectMap, "storageContainerPath", d.StorageContainerPath) - populate(objectMap, "storageContainerSasKey", d.StorageContainerSasKey) + populate(objectMap, "memoryOptimized", d.MemoryOptimized) + populate(objectMap, "temporalType", d.TemporalType) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DatabaseVulnerabilityAssessmentProperties. -func (d *DatabaseVulnerabilityAssessmentProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DatabaseTableProperties. +func (d *DatabaseTableProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", d, err) @@ -2805,17 +2870,11 @@ func (d *DatabaseVulnerabilityAssessmentProperties) UnmarshalJSON(data []byte) e for key, val := range rawMsg { var err error switch key { - case "recurringScans": - err = unpopulate(val, "RecurringScans", &d.RecurringScans) - delete(rawMsg, key) - case "storageAccountAccessKey": - err = unpopulate(val, "StorageAccountAccessKey", &d.StorageAccountAccessKey) - delete(rawMsg, key) - case "storageContainerPath": - err = unpopulate(val, "StorageContainerPath", &d.StorageContainerPath) + case "memoryOptimized": + err = unpopulate(val, "MemoryOptimized", &d.MemoryOptimized) delete(rawMsg, key) - case "storageContainerSasKey": - err = unpopulate(val, "StorageContainerSasKey", &d.StorageContainerSasKey) + case "temporalType": + err = unpopulate(val, "TemporalType", &d.TemporalType) delete(rawMsg, key) } if err != nil { @@ -2825,18 +2884,18 @@ func (d *DatabaseVulnerabilityAssessmentProperties) UnmarshalJSON(data []byte) e return nil } -// MarshalJSON implements the json.Marshaller interface for type DatabaseVulnerabilityAssessmentRuleBaseline. -func (d DatabaseVulnerabilityAssessmentRuleBaseline) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DatabaseUpdate. +func (d DatabaseUpdate) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", d.ID) - populate(objectMap, "name", d.Name) + populate(objectMap, "identity", d.Identity) populate(objectMap, "properties", d.Properties) - populate(objectMap, "type", d.Type) + populate(objectMap, "sku", d.SKU) + populate(objectMap, "tags", d.Tags) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DatabaseVulnerabilityAssessmentRuleBaseline. -func (d *DatabaseVulnerabilityAssessmentRuleBaseline) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DatabaseUpdate. +func (d *DatabaseUpdate) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", d, err) @@ -2844,17 +2903,17 @@ func (d *DatabaseVulnerabilityAssessmentRuleBaseline) UnmarshalJSON(data []byte) for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &d.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &d.Name) + case "identity": + err = unpopulate(val, "Identity", &d.Identity) delete(rawMsg, key) case "properties": err = unpopulate(val, "Properties", &d.Properties) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &d.Type) + case "sku": + err = unpopulate(val, "SKU", &d.SKU) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &d.Tags) delete(rawMsg, key) } if err != nil { @@ -2864,15 +2923,57 @@ func (d *DatabaseVulnerabilityAssessmentRuleBaseline) UnmarshalJSON(data []byte) return nil } -// MarshalJSON implements the json.Marshaller interface for type DatabaseVulnerabilityAssessmentRuleBaselineItem. -func (d DatabaseVulnerabilityAssessmentRuleBaselineItem) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DatabaseUpdateProperties. +func (d DatabaseUpdateProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "result", d.Result) + populate(objectMap, "autoPauseDelay", d.AutoPauseDelay) + populate(objectMap, "catalogCollation", d.CatalogCollation) + populate(objectMap, "collation", d.Collation) + populate(objectMap, "createMode", d.CreateMode) + populateTimeRFC3339(objectMap, "creationDate", d.CreationDate) + populate(objectMap, "currentBackupStorageRedundancy", d.CurrentBackupStorageRedundancy) + populate(objectMap, "currentSku", d.CurrentSKU) + populate(objectMap, "currentServiceObjectiveName", d.CurrentServiceObjectiveName) + populate(objectMap, "databaseId", d.DatabaseID) + populate(objectMap, "defaultSecondaryLocation", d.DefaultSecondaryLocation) + populateTimeRFC3339(objectMap, "earliestRestoreDate", d.EarliestRestoreDate) + populate(objectMap, "elasticPoolId", d.ElasticPoolID) + populate(objectMap, "encryptionProtector", d.EncryptionProtector) + populate(objectMap, "failoverGroupId", d.FailoverGroupID) + populate(objectMap, "federatedClientId", d.FederatedClientID) + populate(objectMap, "highAvailabilityReplicaCount", d.HighAvailabilityReplicaCount) + populate(objectMap, "isInfraEncryptionEnabled", d.IsInfraEncryptionEnabled) + populate(objectMap, "isLedgerOn", d.IsLedgerOn) + populate(objectMap, "keys", d.Keys) + populate(objectMap, "licenseType", d.LicenseType) + populate(objectMap, "longTermRetentionBackupResourceId", d.LongTermRetentionBackupResourceID) + populate(objectMap, "maintenanceConfigurationId", d.MaintenanceConfigurationID) + populate(objectMap, "manualCutover", d.ManualCutover) + populate(objectMap, "maxLogSizeBytes", d.MaxLogSizeBytes) + populate(objectMap, "maxSizeBytes", d.MaxSizeBytes) + populate(objectMap, "minCapacity", d.MinCapacity) + populateTimeRFC3339(objectMap, "pausedDate", d.PausedDate) + populate(objectMap, "performCutover", d.PerformCutover) + populate(objectMap, "preferredEnclaveType", d.PreferredEnclaveType) + populate(objectMap, "readScale", d.ReadScale) + populate(objectMap, "recoverableDatabaseId", d.RecoverableDatabaseID) + populate(objectMap, "recoveryServicesRecoveryPointId", d.RecoveryServicesRecoveryPointID) + populate(objectMap, "requestedBackupStorageRedundancy", d.RequestedBackupStorageRedundancy) + populate(objectMap, "requestedServiceObjectiveName", d.RequestedServiceObjectiveName) + populate(objectMap, "restorableDroppedDatabaseId", d.RestorableDroppedDatabaseID) + populateTimeRFC3339(objectMap, "restorePointInTime", d.RestorePointInTime) + populateTimeRFC3339(objectMap, "resumedDate", d.ResumedDate) + populate(objectMap, "sampleName", d.SampleName) + populate(objectMap, "secondaryType", d.SecondaryType) + populateTimeRFC3339(objectMap, "sourceDatabaseDeletionDate", d.SourceDatabaseDeletionDate) + populate(objectMap, "sourceDatabaseId", d.SourceDatabaseID) + populate(objectMap, "status", d.Status) + populate(objectMap, "zoneRedundant", d.ZoneRedundant) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DatabaseVulnerabilityAssessmentRuleBaselineItem. -func (d *DatabaseVulnerabilityAssessmentRuleBaselineItem) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DatabaseUpdateProperties. +func (d *DatabaseUpdateProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", d, err) @@ -2880,8 +2981,134 @@ func (d *DatabaseVulnerabilityAssessmentRuleBaselineItem) UnmarshalJSON(data []b for key, val := range rawMsg { var err error switch key { - case "result": - err = unpopulate(val, "Result", &d.Result) + case "autoPauseDelay": + err = unpopulate(val, "AutoPauseDelay", &d.AutoPauseDelay) + delete(rawMsg, key) + case "catalogCollation": + err = unpopulate(val, "CatalogCollation", &d.CatalogCollation) + delete(rawMsg, key) + case "collation": + err = unpopulate(val, "Collation", &d.Collation) + delete(rawMsg, key) + case "createMode": + err = unpopulate(val, "CreateMode", &d.CreateMode) + delete(rawMsg, key) + case "creationDate": + err = unpopulateTimeRFC3339(val, "CreationDate", &d.CreationDate) + delete(rawMsg, key) + case "currentBackupStorageRedundancy": + err = unpopulate(val, "CurrentBackupStorageRedundancy", &d.CurrentBackupStorageRedundancy) + delete(rawMsg, key) + case "currentSku": + err = unpopulate(val, "CurrentSKU", &d.CurrentSKU) + delete(rawMsg, key) + case "currentServiceObjectiveName": + err = unpopulate(val, "CurrentServiceObjectiveName", &d.CurrentServiceObjectiveName) + delete(rawMsg, key) + case "databaseId": + err = unpopulate(val, "DatabaseID", &d.DatabaseID) + delete(rawMsg, key) + case "defaultSecondaryLocation": + err = unpopulate(val, "DefaultSecondaryLocation", &d.DefaultSecondaryLocation) + delete(rawMsg, key) + case "earliestRestoreDate": + err = unpopulateTimeRFC3339(val, "EarliestRestoreDate", &d.EarliestRestoreDate) + delete(rawMsg, key) + case "elasticPoolId": + err = unpopulate(val, "ElasticPoolID", &d.ElasticPoolID) + delete(rawMsg, key) + case "encryptionProtector": + err = unpopulate(val, "EncryptionProtector", &d.EncryptionProtector) + delete(rawMsg, key) + case "failoverGroupId": + err = unpopulate(val, "FailoverGroupID", &d.FailoverGroupID) + delete(rawMsg, key) + case "federatedClientId": + err = unpopulate(val, "FederatedClientID", &d.FederatedClientID) + delete(rawMsg, key) + case "highAvailabilityReplicaCount": + err = unpopulate(val, "HighAvailabilityReplicaCount", &d.HighAvailabilityReplicaCount) + delete(rawMsg, key) + case "isInfraEncryptionEnabled": + err = unpopulate(val, "IsInfraEncryptionEnabled", &d.IsInfraEncryptionEnabled) + delete(rawMsg, key) + case "isLedgerOn": + err = unpopulate(val, "IsLedgerOn", &d.IsLedgerOn) + delete(rawMsg, key) + case "keys": + err = unpopulate(val, "Keys", &d.Keys) + delete(rawMsg, key) + case "licenseType": + err = unpopulate(val, "LicenseType", &d.LicenseType) + delete(rawMsg, key) + case "longTermRetentionBackupResourceId": + err = unpopulate(val, "LongTermRetentionBackupResourceID", &d.LongTermRetentionBackupResourceID) + delete(rawMsg, key) + case "maintenanceConfigurationId": + err = unpopulate(val, "MaintenanceConfigurationID", &d.MaintenanceConfigurationID) + delete(rawMsg, key) + case "manualCutover": + err = unpopulate(val, "ManualCutover", &d.ManualCutover) + delete(rawMsg, key) + case "maxLogSizeBytes": + err = unpopulate(val, "MaxLogSizeBytes", &d.MaxLogSizeBytes) + delete(rawMsg, key) + case "maxSizeBytes": + err = unpopulate(val, "MaxSizeBytes", &d.MaxSizeBytes) + delete(rawMsg, key) + case "minCapacity": + err = unpopulate(val, "MinCapacity", &d.MinCapacity) + delete(rawMsg, key) + case "pausedDate": + err = unpopulateTimeRFC3339(val, "PausedDate", &d.PausedDate) + delete(rawMsg, key) + case "performCutover": + err = unpopulate(val, "PerformCutover", &d.PerformCutover) + delete(rawMsg, key) + case "preferredEnclaveType": + err = unpopulate(val, "PreferredEnclaveType", &d.PreferredEnclaveType) + delete(rawMsg, key) + case "readScale": + err = unpopulate(val, "ReadScale", &d.ReadScale) + delete(rawMsg, key) + case "recoverableDatabaseId": + err = unpopulate(val, "RecoverableDatabaseID", &d.RecoverableDatabaseID) + delete(rawMsg, key) + case "recoveryServicesRecoveryPointId": + err = unpopulate(val, "RecoveryServicesRecoveryPointID", &d.RecoveryServicesRecoveryPointID) + delete(rawMsg, key) + case "requestedBackupStorageRedundancy": + err = unpopulate(val, "RequestedBackupStorageRedundancy", &d.RequestedBackupStorageRedundancy) + delete(rawMsg, key) + case "requestedServiceObjectiveName": + err = unpopulate(val, "RequestedServiceObjectiveName", &d.RequestedServiceObjectiveName) + delete(rawMsg, key) + case "restorableDroppedDatabaseId": + err = unpopulate(val, "RestorableDroppedDatabaseID", &d.RestorableDroppedDatabaseID) + delete(rawMsg, key) + case "restorePointInTime": + err = unpopulateTimeRFC3339(val, "RestorePointInTime", &d.RestorePointInTime) + delete(rawMsg, key) + case "resumedDate": + err = unpopulateTimeRFC3339(val, "ResumedDate", &d.ResumedDate) + delete(rawMsg, key) + case "sampleName": + err = unpopulate(val, "SampleName", &d.SampleName) + delete(rawMsg, key) + case "secondaryType": + err = unpopulate(val, "SecondaryType", &d.SecondaryType) + delete(rawMsg, key) + case "sourceDatabaseDeletionDate": + err = unpopulateTimeRFC3339(val, "SourceDatabaseDeletionDate", &d.SourceDatabaseDeletionDate) + delete(rawMsg, key) + case "sourceDatabaseId": + err = unpopulate(val, "SourceDatabaseID", &d.SourceDatabaseID) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &d.Status) + delete(rawMsg, key) + case "zoneRedundant": + err = unpopulate(val, "ZoneRedundant", &d.ZoneRedundant) delete(rawMsg, key) } if err != nil { @@ -2891,15 +3118,18 @@ func (d *DatabaseVulnerabilityAssessmentRuleBaselineItem) UnmarshalJSON(data []b return nil } -// MarshalJSON implements the json.Marshaller interface for type DatabaseVulnerabilityAssessmentRuleBaselineProperties. -func (d DatabaseVulnerabilityAssessmentRuleBaselineProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DatabaseUsage. +func (d DatabaseUsage) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "baselineResults", d.BaselineResults) + populate(objectMap, "id", d.ID) + populate(objectMap, "name", d.Name) + populate(objectMap, "properties", d.Properties) + populate(objectMap, "type", d.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DatabaseVulnerabilityAssessmentRuleBaselineProperties. -func (d *DatabaseVulnerabilityAssessmentRuleBaselineProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DatabaseUsage. +func (d *DatabaseUsage) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", d, err) @@ -2907,8 +3137,17 @@ func (d *DatabaseVulnerabilityAssessmentRuleBaselineProperties) UnmarshalJSON(da for key, val := range rawMsg { var err error switch key { - case "baselineResults": - err = unpopulate(val, "BaselineResults", &d.BaselineResults) + case "id": + err = unpopulate(val, "ID", &d.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &d.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &d.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &d.Type) delete(rawMsg, key) } if err != nil { @@ -2918,15 +3157,16 @@ func (d *DatabaseVulnerabilityAssessmentRuleBaselineProperties) UnmarshalJSON(da return nil } -// MarshalJSON implements the json.Marshaller interface for type DatabaseVulnerabilityAssessmentScanExportProperties. -func (d DatabaseVulnerabilityAssessmentScanExportProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DatabaseUsageListResult. +func (d DatabaseUsageListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "exportedReportLocation", d.ExportedReportLocation) + populate(objectMap, "nextLink", d.NextLink) + populate(objectMap, "value", d.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DatabaseVulnerabilityAssessmentScanExportProperties. -func (d *DatabaseVulnerabilityAssessmentScanExportProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DatabaseUsageListResult. +func (d *DatabaseUsageListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", d, err) @@ -2934,8 +3174,11 @@ func (d *DatabaseVulnerabilityAssessmentScanExportProperties) UnmarshalJSON(data for key, val := range rawMsg { var err error switch key { - case "exportedReportLocation": - err = unpopulate(val, "ExportedReportLocation", &d.ExportedReportLocation) + case "nextLink": + err = unpopulate(val, "NextLink", &d.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &d.Value) delete(rawMsg, key) } if err != nil { @@ -2945,18 +3188,18 @@ func (d *DatabaseVulnerabilityAssessmentScanExportProperties) UnmarshalJSON(data return nil } -// MarshalJSON implements the json.Marshaller interface for type DatabaseVulnerabilityAssessmentScansExport. -func (d DatabaseVulnerabilityAssessmentScansExport) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DatabaseUsageProperties. +func (d DatabaseUsageProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", d.ID) - populate(objectMap, "name", d.Name) - populate(objectMap, "properties", d.Properties) - populate(objectMap, "type", d.Type) + populate(objectMap, "currentValue", d.CurrentValue) + populate(objectMap, "displayName", d.DisplayName) + populate(objectMap, "limit", d.Limit) + populate(objectMap, "unit", d.Unit) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DatabaseVulnerabilityAssessmentScansExport. -func (d *DatabaseVulnerabilityAssessmentScansExport) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DatabaseUsageProperties. +func (d *DatabaseUsageProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", d, err) @@ -2964,17 +3207,17 @@ func (d *DatabaseVulnerabilityAssessmentScansExport) UnmarshalJSON(data []byte) for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &d.ID) + case "currentValue": + err = unpopulate(val, "CurrentValue", &d.CurrentValue) delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &d.Name) + case "displayName": + err = unpopulate(val, "DisplayName", &d.DisplayName) delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &d.Properties) + case "limit": + err = unpopulate(val, "Limit", &d.Limit) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &d.Type) + case "unit": + err = unpopulate(val, "Unit", &d.Unit) delete(rawMsg, key) } if err != nil { @@ -2984,8 +3227,39 @@ func (d *DatabaseVulnerabilityAssessmentScansExport) UnmarshalJSON(data []byte) return nil } -// MarshalJSON implements the json.Marshaller interface for type DeletedServer. -func (d DeletedServer) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DatabaseUserIdentity. +func (d DatabaseUserIdentity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "clientId", d.ClientID) + populate(objectMap, "principalId", d.PrincipalID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DatabaseUserIdentity. +func (d *DatabaseUserIdentity) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "clientId": + err = unpopulate(val, "ClientID", &d.ClientID) + delete(rawMsg, key) + case "principalId": + err = unpopulate(val, "PrincipalID", &d.PrincipalID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DatabaseVulnerabilityAssessment. +func (d DatabaseVulnerabilityAssessment) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", d.ID) populate(objectMap, "name", d.Name) @@ -2994,8 +3268,8 @@ func (d DeletedServer) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DeletedServer. -func (d *DeletedServer) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DatabaseVulnerabilityAssessment. +func (d *DatabaseVulnerabilityAssessment) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", d, err) @@ -3023,16 +3297,16 @@ func (d *DeletedServer) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type DeletedServerListResult. -func (d DeletedServerListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DatabaseVulnerabilityAssessmentListResult. +func (d DatabaseVulnerabilityAssessmentListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "nextLink", d.NextLink) populate(objectMap, "value", d.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DeletedServerListResult. -func (d *DeletedServerListResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DatabaseVulnerabilityAssessmentListResult. +func (d *DatabaseVulnerabilityAssessmentListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", d, err) @@ -3054,18 +3328,18 @@ func (d *DeletedServerListResult) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type DeletedServerProperties. -func (d DeletedServerProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DatabaseVulnerabilityAssessmentProperties. +func (d DatabaseVulnerabilityAssessmentProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populateTimeRFC3339(objectMap, "deletionTime", d.DeletionTime) - populate(objectMap, "fullyQualifiedDomainName", d.FullyQualifiedDomainName) - populate(objectMap, "originalId", d.OriginalID) - populate(objectMap, "version", d.Version) + populate(objectMap, "recurringScans", d.RecurringScans) + populate(objectMap, "storageAccountAccessKey", d.StorageAccountAccessKey) + populate(objectMap, "storageContainerPath", d.StorageContainerPath) + populate(objectMap, "storageContainerSasKey", d.StorageContainerSasKey) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DeletedServerProperties. -func (d *DeletedServerProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DatabaseVulnerabilityAssessmentProperties. +func (d *DatabaseVulnerabilityAssessmentProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", d, err) @@ -3073,17 +3347,17 @@ func (d *DeletedServerProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "deletionTime": - err = unpopulateTimeRFC3339(val, "DeletionTime", &d.DeletionTime) + case "recurringScans": + err = unpopulate(val, "RecurringScans", &d.RecurringScans) delete(rawMsg, key) - case "fullyQualifiedDomainName": - err = unpopulate(val, "FullyQualifiedDomainName", &d.FullyQualifiedDomainName) + case "storageAccountAccessKey": + err = unpopulate(val, "StorageAccountAccessKey", &d.StorageAccountAccessKey) delete(rawMsg, key) - case "originalId": - err = unpopulate(val, "OriginalID", &d.OriginalID) + case "storageContainerPath": + err = unpopulate(val, "StorageContainerPath", &d.StorageContainerPath) delete(rawMsg, key) - case "version": - err = unpopulate(val, "Version", &d.Version) + case "storageContainerSasKey": + err = unpopulate(val, "StorageContainerSasKey", &d.StorageContainerSasKey) delete(rawMsg, key) } if err != nil { @@ -3093,8 +3367,8 @@ func (d *DeletedServerProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type DistributedAvailabilityGroup. -func (d DistributedAvailabilityGroup) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DatabaseVulnerabilityAssessmentRuleBaseline. +func (d DatabaseVulnerabilityAssessmentRuleBaseline) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", d.ID) populate(objectMap, "name", d.Name) @@ -3103,8 +3377,8 @@ func (d DistributedAvailabilityGroup) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DistributedAvailabilityGroup. -func (d *DistributedAvailabilityGroup) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DatabaseVulnerabilityAssessmentRuleBaseline. +func (d *DatabaseVulnerabilityAssessmentRuleBaseline) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", d, err) @@ -3132,24 +3406,18 @@ func (d *DistributedAvailabilityGroup) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type DistributedAvailabilityGroupProperties. -func (d DistributedAvailabilityGroupProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DatabaseVulnerabilityAssessmentRuleBaselineAutoGenerated. +func (d DatabaseVulnerabilityAssessmentRuleBaselineAutoGenerated) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "distributedAvailabilityGroupId", d.DistributedAvailabilityGroupID) - populate(objectMap, "lastHardenedLsn", d.LastHardenedLsn) - populate(objectMap, "linkState", d.LinkState) - populate(objectMap, "primaryAvailabilityGroupName", d.PrimaryAvailabilityGroupName) - populate(objectMap, "replicationMode", d.ReplicationMode) - populate(objectMap, "secondaryAvailabilityGroupName", d.SecondaryAvailabilityGroupName) - populate(objectMap, "sourceEndpoint", d.SourceEndpoint) - populate(objectMap, "sourceReplicaId", d.SourceReplicaID) - populate(objectMap, "targetDatabase", d.TargetDatabase) - populate(objectMap, "targetReplicaId", d.TargetReplicaID) + populate(objectMap, "id", d.ID) + populate(objectMap, "name", d.Name) + populate(objectMap, "properties", d.Properties) + populate(objectMap, "type", d.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DistributedAvailabilityGroupProperties. -func (d *DistributedAvailabilityGroupProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DatabaseVulnerabilityAssessmentRuleBaselineAutoGenerated. +func (d *DatabaseVulnerabilityAssessmentRuleBaselineAutoGenerated) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", d, err) @@ -3157,35 +3425,17 @@ func (d *DistributedAvailabilityGroupProperties) UnmarshalJSON(data []byte) erro for key, val := range rawMsg { var err error switch key { - case "distributedAvailabilityGroupId": - err = unpopulate(val, "DistributedAvailabilityGroupID", &d.DistributedAvailabilityGroupID) - delete(rawMsg, key) - case "lastHardenedLsn": - err = unpopulate(val, "LastHardenedLsn", &d.LastHardenedLsn) - delete(rawMsg, key) - case "linkState": - err = unpopulate(val, "LinkState", &d.LinkState) - delete(rawMsg, key) - case "primaryAvailabilityGroupName": - err = unpopulate(val, "PrimaryAvailabilityGroupName", &d.PrimaryAvailabilityGroupName) - delete(rawMsg, key) - case "replicationMode": - err = unpopulate(val, "ReplicationMode", &d.ReplicationMode) - delete(rawMsg, key) - case "secondaryAvailabilityGroupName": - err = unpopulate(val, "SecondaryAvailabilityGroupName", &d.SecondaryAvailabilityGroupName) - delete(rawMsg, key) - case "sourceEndpoint": - err = unpopulate(val, "SourceEndpoint", &d.SourceEndpoint) + case "id": + err = unpopulate(val, "ID", &d.ID) delete(rawMsg, key) - case "sourceReplicaId": - err = unpopulate(val, "SourceReplicaID", &d.SourceReplicaID) + case "name": + err = unpopulate(val, "Name", &d.Name) delete(rawMsg, key) - case "targetDatabase": - err = unpopulate(val, "TargetDatabase", &d.TargetDatabase) + case "properties": + err = unpopulate(val, "Properties", &d.Properties) delete(rawMsg, key) - case "targetReplicaId": - err = unpopulate(val, "TargetReplicaID", &d.TargetReplicaID) + case "type": + err = unpopulate(val, "Type", &d.Type) delete(rawMsg, key) } if err != nil { @@ -3195,16 +3445,15 @@ func (d *DistributedAvailabilityGroupProperties) UnmarshalJSON(data []byte) erro return nil } -// MarshalJSON implements the json.Marshaller interface for type DistributedAvailabilityGroupsListResult. -func (d DistributedAvailabilityGroupsListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DatabaseVulnerabilityAssessmentRuleBaselineItem. +func (d DatabaseVulnerabilityAssessmentRuleBaselineItem) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", d.NextLink) - populate(objectMap, "value", d.Value) + populate(objectMap, "result", d.Result) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DistributedAvailabilityGroupsListResult. -func (d *DistributedAvailabilityGroupsListResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DatabaseVulnerabilityAssessmentRuleBaselineItem. +func (d *DatabaseVulnerabilityAssessmentRuleBaselineItem) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", d, err) @@ -3212,11 +3461,8 @@ func (d *DistributedAvailabilityGroupsListResult) UnmarshalJSON(data []byte) err for key, val := range rawMsg { var err error switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &d.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &d.Value) + case "result": + err = unpopulate(val, "Result", &d.Result) delete(rawMsg, key) } if err != nil { @@ -3226,429 +3472,504 @@ func (d *DistributedAvailabilityGroupsListResult) UnmarshalJSON(data []byte) err return nil } -// MarshalJSON implements the json.Marshaller interface for type EditionCapability. -func (e EditionCapability) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DatabaseVulnerabilityAssessmentRuleBaselineProperties. +func (d DatabaseVulnerabilityAssessmentRuleBaselineProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "name", e.Name) - populate(objectMap, "readScale", e.ReadScale) - populate(objectMap, "reason", e.Reason) - populate(objectMap, "status", e.Status) - populate(objectMap, "supportedServiceLevelObjectives", e.SupportedServiceLevelObjectives) - populate(objectMap, "supportedStorageCapabilities", e.SupportedStorageCapabilities) - populate(objectMap, "zoneRedundant", e.ZoneRedundant) + populate(objectMap, "baselineResults", d.BaselineResults) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type EditionCapability. -func (e *EditionCapability) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DatabaseVulnerabilityAssessmentRuleBaselineProperties. +func (d *DatabaseVulnerabilityAssessmentRuleBaselineProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } for key, val := range rawMsg { var err error switch key { - case "name": - err = unpopulate(val, "Name", &e.Name) - delete(rawMsg, key) - case "readScale": - err = unpopulate(val, "ReadScale", &e.ReadScale) - delete(rawMsg, key) - case "reason": - err = unpopulate(val, "Reason", &e.Reason) - delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &e.Status) - delete(rawMsg, key) - case "supportedServiceLevelObjectives": - err = unpopulate(val, "SupportedServiceLevelObjectives", &e.SupportedServiceLevelObjectives) - delete(rawMsg, key) - case "supportedStorageCapabilities": - err = unpopulate(val, "SupportedStorageCapabilities", &e.SupportedStorageCapabilities) - delete(rawMsg, key) - case "zoneRedundant": - err = unpopulate(val, "ZoneRedundant", &e.ZoneRedundant) + case "baselineResults": + err = unpopulate(val, "BaselineResults", &d.BaselineResults) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ElasticPool. -func (e ElasticPool) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DatabaseVulnerabilityAssessmentRuleBaselinePropertiesAutoGenerated. +func (d DatabaseVulnerabilityAssessmentRuleBaselinePropertiesAutoGenerated) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", e.ID) - populate(objectMap, "kind", e.Kind) - populate(objectMap, "location", e.Location) - populate(objectMap, "name", e.Name) - populate(objectMap, "properties", e.Properties) - populate(objectMap, "sku", e.SKU) - populate(objectMap, "tags", e.Tags) - populate(objectMap, "type", e.Type) + populate(objectMap, "baselineResults", d.BaselineResults) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ElasticPool. -func (e *ElasticPool) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DatabaseVulnerabilityAssessmentRuleBaselinePropertiesAutoGenerated. +func (d *DatabaseVulnerabilityAssessmentRuleBaselinePropertiesAutoGenerated) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &e.ID) - delete(rawMsg, key) - case "kind": - err = unpopulate(val, "Kind", &e.Kind) - delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &e.Location) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &e.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &e.Properties) - delete(rawMsg, key) - case "sku": - err = unpopulate(val, "SKU", &e.SKU) - delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &e.Tags) + case "baselineResults": + err = unpopulate(val, "BaselineResults", &d.BaselineResults) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &e.Type) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DatabaseVulnerabilityAssessmentScanExportProperties. +func (d DatabaseVulnerabilityAssessmentScanExportProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "exportedReportLocation", d.ExportedReportLocation) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DatabaseVulnerabilityAssessmentScanExportProperties. +func (d *DatabaseVulnerabilityAssessmentScanExportProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "exportedReportLocation": + err = unpopulate(val, "ExportedReportLocation", &d.ExportedReportLocation) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ElasticPoolActivity. -func (e ElasticPoolActivity) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DatabaseVulnerabilityAssessmentScansExport. +func (d DatabaseVulnerabilityAssessmentScansExport) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", e.ID) - populate(objectMap, "location", e.Location) - populate(objectMap, "name", e.Name) - populate(objectMap, "properties", e.Properties) - populate(objectMap, "type", e.Type) + populate(objectMap, "id", d.ID) + populate(objectMap, "name", d.Name) + populate(objectMap, "properties", d.Properties) + populate(objectMap, "type", d.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ElasticPoolActivity. -func (e *ElasticPoolActivity) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DatabaseVulnerabilityAssessmentScansExport. +func (d *DatabaseVulnerabilityAssessmentScansExport) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } for key, val := range rawMsg { var err error switch key { case "id": - err = unpopulate(val, "ID", &e.ID) - delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &e.Location) + err = unpopulate(val, "ID", &d.ID) delete(rawMsg, key) case "name": - err = unpopulate(val, "Name", &e.Name) + err = unpopulate(val, "Name", &d.Name) delete(rawMsg, key) case "properties": - err = unpopulate(val, "Properties", &e.Properties) + err = unpopulate(val, "Properties", &d.Properties) delete(rawMsg, key) case "type": - err = unpopulate(val, "Type", &e.Type) + err = unpopulate(val, "Type", &d.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ElasticPoolActivityListResult. -func (e ElasticPoolActivityListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DeletedServer. +func (d DeletedServer) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "value", e.Value) + populate(objectMap, "id", d.ID) + populate(objectMap, "name", d.Name) + populate(objectMap, "properties", d.Properties) + populate(objectMap, "type", d.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ElasticPoolActivityListResult. -func (e *ElasticPoolActivityListResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DeletedServer. +func (d *DeletedServer) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } for key, val := range rawMsg { var err error switch key { - case "value": - err = unpopulate(val, "Value", &e.Value) + case "id": + err = unpopulate(val, "ID", &d.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &d.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &d.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &d.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ElasticPoolActivityProperties. -func (e ElasticPoolActivityProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DeletedServerListResult. +func (d DeletedServerListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "elasticPoolName", e.ElasticPoolName) - populateTimeRFC3339(objectMap, "endTime", e.EndTime) - populate(objectMap, "errorCode", e.ErrorCode) - populate(objectMap, "errorMessage", e.ErrorMessage) - populate(objectMap, "errorSeverity", e.ErrorSeverity) - populate(objectMap, "operation", e.Operation) - populate(objectMap, "operationId", e.OperationID) - populate(objectMap, "percentComplete", e.PercentComplete) - populate(objectMap, "requestedDatabaseDtuCap", e.RequestedDatabaseDtuCap) - populate(objectMap, "requestedDatabaseDtuGuarantee", e.RequestedDatabaseDtuGuarantee) - populate(objectMap, "requestedDatabaseDtuMax", e.RequestedDatabaseDtuMax) - populate(objectMap, "requestedDatabaseDtuMin", e.RequestedDatabaseDtuMin) - populate(objectMap, "requestedDtu", e.RequestedDtu) - populate(objectMap, "requestedDtuGuarantee", e.RequestedDtuGuarantee) - populate(objectMap, "requestedElasticPoolName", e.RequestedElasticPoolName) - populate(objectMap, "requestedStorageLimitInGB", e.RequestedStorageLimitInGB) - populate(objectMap, "requestedStorageLimitInMB", e.RequestedStorageLimitInMB) - populate(objectMap, "serverName", e.ServerName) - populateTimeRFC3339(objectMap, "startTime", e.StartTime) - populate(objectMap, "state", e.State) + populate(objectMap, "nextLink", d.NextLink) + populate(objectMap, "value", d.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ElasticPoolActivityProperties. -func (e *ElasticPoolActivityProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DeletedServerListResult. +func (d *DeletedServerListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } for key, val := range rawMsg { var err error switch key { - case "elasticPoolName": - err = unpopulate(val, "ElasticPoolName", &e.ElasticPoolName) - delete(rawMsg, key) - case "endTime": - err = unpopulateTimeRFC3339(val, "EndTime", &e.EndTime) - delete(rawMsg, key) - case "errorCode": - err = unpopulate(val, "ErrorCode", &e.ErrorCode) - delete(rawMsg, key) - case "errorMessage": - err = unpopulate(val, "ErrorMessage", &e.ErrorMessage) - delete(rawMsg, key) - case "errorSeverity": - err = unpopulate(val, "ErrorSeverity", &e.ErrorSeverity) - delete(rawMsg, key) - case "operation": - err = unpopulate(val, "Operation", &e.Operation) - delete(rawMsg, key) - case "operationId": - err = unpopulate(val, "OperationID", &e.OperationID) - delete(rawMsg, key) - case "percentComplete": - err = unpopulate(val, "PercentComplete", &e.PercentComplete) - delete(rawMsg, key) - case "requestedDatabaseDtuCap": - err = unpopulate(val, "RequestedDatabaseDtuCap", &e.RequestedDatabaseDtuCap) - delete(rawMsg, key) - case "requestedDatabaseDtuGuarantee": - err = unpopulate(val, "RequestedDatabaseDtuGuarantee", &e.RequestedDatabaseDtuGuarantee) - delete(rawMsg, key) - case "requestedDatabaseDtuMax": - err = unpopulate(val, "RequestedDatabaseDtuMax", &e.RequestedDatabaseDtuMax) - delete(rawMsg, key) - case "requestedDatabaseDtuMin": - err = unpopulate(val, "RequestedDatabaseDtuMin", &e.RequestedDatabaseDtuMin) - delete(rawMsg, key) - case "requestedDtu": - err = unpopulate(val, "RequestedDtu", &e.RequestedDtu) - delete(rawMsg, key) - case "requestedDtuGuarantee": - err = unpopulate(val, "RequestedDtuGuarantee", &e.RequestedDtuGuarantee) - delete(rawMsg, key) - case "requestedElasticPoolName": - err = unpopulate(val, "RequestedElasticPoolName", &e.RequestedElasticPoolName) - delete(rawMsg, key) - case "requestedStorageLimitInGB": - err = unpopulate(val, "RequestedStorageLimitInGB", &e.RequestedStorageLimitInGB) - delete(rawMsg, key) - case "requestedStorageLimitInMB": - err = unpopulate(val, "RequestedStorageLimitInMB", &e.RequestedStorageLimitInMB) - delete(rawMsg, key) - case "serverName": - err = unpopulate(val, "ServerName", &e.ServerName) - delete(rawMsg, key) - case "startTime": - err = unpopulateTimeRFC3339(val, "StartTime", &e.StartTime) + case "nextLink": + err = unpopulate(val, "NextLink", &d.NextLink) delete(rawMsg, key) - case "state": - err = unpopulate(val, "State", &e.State) + case "value": + err = unpopulate(val, "Value", &d.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ElasticPoolDatabaseActivity. -func (e ElasticPoolDatabaseActivity) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DeletedServerProperties. +func (d DeletedServerProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", e.ID) - populate(objectMap, "location", e.Location) - populate(objectMap, "name", e.Name) - populate(objectMap, "properties", e.Properties) - populate(objectMap, "type", e.Type) + populateTimeRFC3339(objectMap, "deletionTime", d.DeletionTime) + populate(objectMap, "fullyQualifiedDomainName", d.FullyQualifiedDomainName) + populate(objectMap, "originalId", d.OriginalID) + populate(objectMap, "version", d.Version) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ElasticPoolDatabaseActivity. -func (e *ElasticPoolDatabaseActivity) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DeletedServerProperties. +func (d *DeletedServerProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &e.ID) - delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &e.Location) + case "deletionTime": + err = unpopulateTimeRFC3339(val, "DeletionTime", &d.DeletionTime) delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &e.Name) + case "fullyQualifiedDomainName": + err = unpopulate(val, "FullyQualifiedDomainName", &d.FullyQualifiedDomainName) delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &e.Properties) + case "originalId": + err = unpopulate(val, "OriginalID", &d.OriginalID) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &e.Type) + case "version": + err = unpopulate(val, "Version", &d.Version) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ElasticPoolDatabaseActivityListResult. -func (e ElasticPoolDatabaseActivityListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DistributedAvailabilityGroup. +func (d DistributedAvailabilityGroup) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "value", e.Value) + populate(objectMap, "id", d.ID) + populate(objectMap, "name", d.Name) + populate(objectMap, "properties", d.Properties) + populate(objectMap, "type", d.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ElasticPoolDatabaseActivityListResult. -func (e *ElasticPoolDatabaseActivityListResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DistributedAvailabilityGroup. +func (d *DistributedAvailabilityGroup) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } for key, val := range rawMsg { var err error switch key { - case "value": - err = unpopulate(val, "Value", &e.Value) + case "id": + err = unpopulate(val, "ID", &d.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &d.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &d.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &d.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ElasticPoolDatabaseActivityProperties. -func (e ElasticPoolDatabaseActivityProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DistributedAvailabilityGroupProperties. +func (d DistributedAvailabilityGroupProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "currentElasticPoolName", e.CurrentElasticPoolName) - populate(objectMap, "currentServiceObjective", e.CurrentServiceObjective) - populate(objectMap, "databaseName", e.DatabaseName) - populateTimeRFC3339(objectMap, "endTime", e.EndTime) - populate(objectMap, "errorCode", e.ErrorCode) - populate(objectMap, "errorMessage", e.ErrorMessage) - populate(objectMap, "errorSeverity", e.ErrorSeverity) - populate(objectMap, "operation", e.Operation) - populate(objectMap, "operationId", e.OperationID) - populate(objectMap, "percentComplete", e.PercentComplete) - populate(objectMap, "requestedElasticPoolName", e.RequestedElasticPoolName) - populate(objectMap, "requestedServiceObjective", e.RequestedServiceObjective) - populate(objectMap, "serverName", e.ServerName) - populateTimeRFC3339(objectMap, "startTime", e.StartTime) - populate(objectMap, "state", e.State) + populate(objectMap, "distributedAvailabilityGroupId", d.DistributedAvailabilityGroupID) + populate(objectMap, "instanceRole", d.InstanceRole) + populate(objectMap, "lastHardenedLsn", d.LastHardenedLsn) + populate(objectMap, "linkState", d.LinkState) + populate(objectMap, "primaryAvailabilityGroupName", d.PrimaryAvailabilityGroupName) + populate(objectMap, "replicationMode", d.ReplicationMode) + populate(objectMap, "secondaryAvailabilityGroupName", d.SecondaryAvailabilityGroupName) + populate(objectMap, "sourceEndpoint", d.SourceEndpoint) + populate(objectMap, "sourceReplicaId", d.SourceReplicaID) + populate(objectMap, "targetDatabase", d.TargetDatabase) + populate(objectMap, "targetReplicaId", d.TargetReplicaID) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ElasticPoolDatabaseActivityProperties. -func (e *ElasticPoolDatabaseActivityProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DistributedAvailabilityGroupProperties. +func (d *DistributedAvailabilityGroupProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } for key, val := range rawMsg { var err error switch key { - case "currentElasticPoolName": - err = unpopulate(val, "CurrentElasticPoolName", &e.CurrentElasticPoolName) + case "distributedAvailabilityGroupId": + err = unpopulate(val, "DistributedAvailabilityGroupID", &d.DistributedAvailabilityGroupID) delete(rawMsg, key) - case "currentServiceObjective": - err = unpopulate(val, "CurrentServiceObjective", &e.CurrentServiceObjective) + case "instanceRole": + err = unpopulate(val, "InstanceRole", &d.InstanceRole) delete(rawMsg, key) - case "databaseName": - err = unpopulate(val, "DatabaseName", &e.DatabaseName) + case "lastHardenedLsn": + err = unpopulate(val, "LastHardenedLsn", &d.LastHardenedLsn) delete(rawMsg, key) - case "endTime": - err = unpopulateTimeRFC3339(val, "EndTime", &e.EndTime) + case "linkState": + err = unpopulate(val, "LinkState", &d.LinkState) delete(rawMsg, key) - case "errorCode": - err = unpopulate(val, "ErrorCode", &e.ErrorCode) + case "primaryAvailabilityGroupName": + err = unpopulate(val, "PrimaryAvailabilityGroupName", &d.PrimaryAvailabilityGroupName) delete(rawMsg, key) - case "errorMessage": - err = unpopulate(val, "ErrorMessage", &e.ErrorMessage) + case "replicationMode": + err = unpopulate(val, "ReplicationMode", &d.ReplicationMode) delete(rawMsg, key) - case "errorSeverity": - err = unpopulate(val, "ErrorSeverity", &e.ErrorSeverity) + case "secondaryAvailabilityGroupName": + err = unpopulate(val, "SecondaryAvailabilityGroupName", &d.SecondaryAvailabilityGroupName) delete(rawMsg, key) - case "operation": - err = unpopulate(val, "Operation", &e.Operation) + case "sourceEndpoint": + err = unpopulate(val, "SourceEndpoint", &d.SourceEndpoint) delete(rawMsg, key) - case "operationId": - err = unpopulate(val, "OperationID", &e.OperationID) + case "sourceReplicaId": + err = unpopulate(val, "SourceReplicaID", &d.SourceReplicaID) delete(rawMsg, key) - case "percentComplete": - err = unpopulate(val, "PercentComplete", &e.PercentComplete) + case "targetDatabase": + err = unpopulate(val, "TargetDatabase", &d.TargetDatabase) delete(rawMsg, key) - case "requestedElasticPoolName": - err = unpopulate(val, "RequestedElasticPoolName", &e.RequestedElasticPoolName) + case "targetReplicaId": + err = unpopulate(val, "TargetReplicaID", &d.TargetReplicaID) delete(rawMsg, key) - case "requestedServiceObjective": - err = unpopulate(val, "RequestedServiceObjective", &e.RequestedServiceObjective) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DistributedAvailabilityGroupSetRole. +func (d DistributedAvailabilityGroupSetRole) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "instanceRole", d.InstanceRole) + populate(objectMap, "roleChangeType", d.RoleChangeType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DistributedAvailabilityGroupSetRole. +func (d *DistributedAvailabilityGroupSetRole) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "instanceRole": + err = unpopulate(val, "InstanceRole", &d.InstanceRole) delete(rawMsg, key) - case "serverName": - err = unpopulate(val, "ServerName", &e.ServerName) + case "roleChangeType": + err = unpopulate(val, "RoleChangeType", &d.RoleChangeType) delete(rawMsg, key) - case "startTime": - err = unpopulateTimeRFC3339(val, "StartTime", &e.StartTime) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DistributedAvailabilityGroupsListResult. +func (d DistributedAvailabilityGroupsListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", d.NextLink) + populate(objectMap, "value", d.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DistributedAvailabilityGroupsListResult. +func (d *DistributedAvailabilityGroupsListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &d.NextLink) delete(rawMsg, key) - case "state": - err = unpopulate(val, "State", &e.State) + case "value": + err = unpopulate(val, "Value", &d.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EditionCapability. +func (e EditionCapability) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "name", e.Name) + populate(objectMap, "readScale", e.ReadScale) + populate(objectMap, "reason", e.Reason) + populate(objectMap, "status", e.Status) + populate(objectMap, "supportedServiceLevelObjectives", e.SupportedServiceLevelObjectives) + populate(objectMap, "supportedStorageCapabilities", e.SupportedStorageCapabilities) + populate(objectMap, "zonePinning", e.ZonePinning) + populate(objectMap, "zoneRedundant", e.ZoneRedundant) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EditionCapability. +func (e *EditionCapability) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &e.Name) + delete(rawMsg, key) + case "readScale": + err = unpopulate(val, "ReadScale", &e.ReadScale) + delete(rawMsg, key) + case "reason": + err = unpopulate(val, "Reason", &e.Reason) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &e.Status) + delete(rawMsg, key) + case "supportedServiceLevelObjectives": + err = unpopulate(val, "SupportedServiceLevelObjectives", &e.SupportedServiceLevelObjectives) + delete(rawMsg, key) + case "supportedStorageCapabilities": + err = unpopulate(val, "SupportedStorageCapabilities", &e.SupportedStorageCapabilities) + delete(rawMsg, key) + case "zonePinning": + err = unpopulate(val, "ZonePinning", &e.ZonePinning) + delete(rawMsg, key) + case "zoneRedundant": + err = unpopulate(val, "ZoneRedundant", &e.ZoneRedundant) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ElasticPool. +func (e ElasticPool) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", e.ID) + populate(objectMap, "kind", e.Kind) + populate(objectMap, "location", e.Location) + populate(objectMap, "name", e.Name) + populate(objectMap, "properties", e.Properties) + populate(objectMap, "sku", e.SKU) + populate(objectMap, "tags", e.Tags) + populate(objectMap, "type", e.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ElasticPool. +func (e *ElasticPool) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &e.ID) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &e.Kind) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &e.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &e.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &e.Properties) + delete(rawMsg, key) + case "sku": + err = unpopulate(val, "SKU", &e.SKU) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &e.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &e.Type) delete(rawMsg, key) } if err != nil { @@ -3665,6 +3986,7 @@ func (e ElasticPoolEditionCapability) MarshalJSON() ([]byte, error) { populate(objectMap, "reason", e.Reason) populate(objectMap, "status", e.Status) populate(objectMap, "supportedElasticPoolPerformanceLevels", e.SupportedElasticPoolPerformanceLevels) + populate(objectMap, "zonePinning", e.ZonePinning) populate(objectMap, "zoneRedundant", e.ZoneRedundant) return json.Marshal(objectMap) } @@ -3690,6 +4012,9 @@ func (e *ElasticPoolEditionCapability) UnmarshalJSON(data []byte) error { case "supportedElasticPoolPerformanceLevels": err = unpopulate(val, "SupportedElasticPoolPerformanceLevels", &e.SupportedElasticPoolPerformanceLevels) delete(rawMsg, key) + case "zonePinning": + err = unpopulate(val, "ZonePinning", &e.ZonePinning) + delete(rawMsg, key) case "zoneRedundant": err = unpopulate(val, "ZoneRedundant", &e.ZoneRedundant) delete(rawMsg, key) @@ -4068,12 +4393,15 @@ func (e *ElasticPoolPerformanceLevelCapability) UnmarshalJSON(data []byte) error // MarshalJSON implements the json.Marshaller interface for type ElasticPoolProperties. func (e ElasticPoolProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "availabilityZone", e.AvailabilityZone) populateTimeRFC3339(objectMap, "creationDate", e.CreationDate) populate(objectMap, "highAvailabilityReplicaCount", e.HighAvailabilityReplicaCount) populate(objectMap, "licenseType", e.LicenseType) populate(objectMap, "maintenanceConfigurationId", e.MaintenanceConfigurationID) populate(objectMap, "maxSizeBytes", e.MaxSizeBytes) + populate(objectMap, "minCapacity", e.MinCapacity) populate(objectMap, "perDatabaseSettings", e.PerDatabaseSettings) + populate(objectMap, "preferredEnclaveType", e.PreferredEnclaveType) populate(objectMap, "state", e.State) populate(objectMap, "zoneRedundant", e.ZoneRedundant) return json.Marshal(objectMap) @@ -4088,6 +4416,9 @@ func (e *ElasticPoolProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "availabilityZone": + err = unpopulate(val, "AvailabilityZone", &e.AvailabilityZone) + delete(rawMsg, key) case "creationDate": err = unpopulateTimeRFC3339(val, "CreationDate", &e.CreationDate) delete(rawMsg, key) @@ -4103,9 +4434,15 @@ func (e *ElasticPoolProperties) UnmarshalJSON(data []byte) error { case "maxSizeBytes": err = unpopulate(val, "MaxSizeBytes", &e.MaxSizeBytes) delete(rawMsg, key) + case "minCapacity": + err = unpopulate(val, "MinCapacity", &e.MinCapacity) + delete(rawMsg, key) case "perDatabaseSettings": err = unpopulate(val, "PerDatabaseSettings", &e.PerDatabaseSettings) delete(rawMsg, key) + case "preferredEnclaveType": + err = unpopulate(val, "PreferredEnclaveType", &e.PreferredEnclaveType) + delete(rawMsg, key) case "state": err = unpopulate(val, "State", &e.State) delete(rawMsg, key) @@ -4158,11 +4495,14 @@ func (e *ElasticPoolUpdate) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ElasticPoolUpdateProperties. func (e ElasticPoolUpdateProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "availabilityZone", e.AvailabilityZone) populate(objectMap, "highAvailabilityReplicaCount", e.HighAvailabilityReplicaCount) populate(objectMap, "licenseType", e.LicenseType) populate(objectMap, "maintenanceConfigurationId", e.MaintenanceConfigurationID) populate(objectMap, "maxSizeBytes", e.MaxSizeBytes) + populate(objectMap, "minCapacity", e.MinCapacity) populate(objectMap, "perDatabaseSettings", e.PerDatabaseSettings) + populate(objectMap, "preferredEnclaveType", e.PreferredEnclaveType) populate(objectMap, "zoneRedundant", e.ZoneRedundant) return json.Marshal(objectMap) } @@ -4176,6 +4516,9 @@ func (e *ElasticPoolUpdateProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "availabilityZone": + err = unpopulate(val, "AvailabilityZone", &e.AvailabilityZone) + delete(rawMsg, key) case "highAvailabilityReplicaCount": err = unpopulate(val, "HighAvailabilityReplicaCount", &e.HighAvailabilityReplicaCount) delete(rawMsg, key) @@ -4188,9 +4531,15 @@ func (e *ElasticPoolUpdateProperties) UnmarshalJSON(data []byte) error { case "maxSizeBytes": err = unpopulate(val, "MaxSizeBytes", &e.MaxSizeBytes) delete(rawMsg, key) + case "minCapacity": + err = unpopulate(val, "MinCapacity", &e.MinCapacity) + delete(rawMsg, key) case "perDatabaseSettings": err = unpopulate(val, "PerDatabaseSettings", &e.PerDatabaseSettings) delete(rawMsg, key) + case "preferredEnclaveType": + err = unpopulate(val, "PreferredEnclaveType", &e.PreferredEnclaveType) + delete(rawMsg, key) case "zoneRedundant": err = unpopulate(val, "ZoneRedundant", &e.ZoneRedundant) delete(rawMsg, key) @@ -4424,6 +4773,64 @@ func (e *EndpointCertificateProperties) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type EndpointDependency. +func (e EndpointDependency) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "domainName", e.DomainName) + populate(objectMap, "endpointDetails", e.EndpointDetails) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EndpointDependency. +func (e *EndpointDependency) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "domainName": + err = unpopulate(val, "DomainName", &e.DomainName) + delete(rawMsg, key) + case "endpointDetails": + err = unpopulate(val, "EndpointDetails", &e.EndpointDetails) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EndpointDetail. +func (e EndpointDetail) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "port", e.Port) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EndpointDetail. +func (e *EndpointDetail) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "port": + err = unpopulate(val, "Port", &e.Port) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type ExportDatabaseDefinition. func (e ExportDatabaseDefinition) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -5149,6 +5556,7 @@ func (g *GeoBackupPolicy) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type GeoBackupPolicyListResult. func (g GeoBackupPolicyListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "nextLink", g.NextLink) populate(objectMap, "value", g.Value) return json.Marshal(objectMap) } @@ -5162,6 +5570,9 @@ func (g *GeoBackupPolicyListResult) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &g.NextLink) + delete(rawMsg, key) case "value": err = unpopulate(val, "Value", &g.Value) delete(rawMsg, key) @@ -5429,9 +5840,12 @@ func (i *ImportExportExtensionsOperationResult) UnmarshalJSON(data []byte) error // MarshalJSON implements the json.Marshaller interface for type ImportExportExtensionsOperationResultProperties. func (i ImportExportExtensionsOperationResultProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "blobUri", i.BlobURI) populate(objectMap, "databaseName", i.DatabaseName) populate(objectMap, "errorMessage", i.ErrorMessage) populate(objectMap, "lastModifiedTime", i.LastModifiedTime) + populate(objectMap, "privateEndpointConnections", i.PrivateEndpointConnections) + populate(objectMap, "queuedTime", i.QueuedTime) populate(objectMap, "requestId", i.RequestID) populate(objectMap, "requestType", i.RequestType) populate(objectMap, "serverName", i.ServerName) @@ -5448,6 +5862,9 @@ func (i *ImportExportExtensionsOperationResultProperties) UnmarshalJSON(data []b for key, val := range rawMsg { var err error switch key { + case "blobUri": + err = unpopulate(val, "BlobURI", &i.BlobURI) + delete(rawMsg, key) case "databaseName": err = unpopulate(val, "DatabaseName", &i.DatabaseName) delete(rawMsg, key) @@ -5457,10 +5874,16 @@ func (i *ImportExportExtensionsOperationResultProperties) UnmarshalJSON(data []b case "lastModifiedTime": err = unpopulate(val, "LastModifiedTime", &i.LastModifiedTime) delete(rawMsg, key) - case "requestId": - err = unpopulate(val, "RequestID", &i.RequestID) + case "privateEndpointConnections": + err = unpopulate(val, "PrivateEndpointConnections", &i.PrivateEndpointConnections) delete(rawMsg, key) - case "requestType": + case "queuedTime": + err = unpopulate(val, "QueuedTime", &i.QueuedTime) + delete(rawMsg, key) + case "requestId": + err = unpopulate(val, "RequestID", &i.RequestID) + delete(rawMsg, key) + case "requestType": err = unpopulate(val, "RequestType", &i.RequestType) delete(rawMsg, key) case "serverName": @@ -5725,6 +6148,7 @@ func (i InstanceFailoverGroupProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "readWriteEndpoint", i.ReadWriteEndpoint) populate(objectMap, "replicationRole", i.ReplicationRole) populate(objectMap, "replicationState", i.ReplicationState) + populate(objectMap, "secondaryType", i.SecondaryType) return json.Marshal(objectMap) } @@ -5755,6 +6179,9 @@ func (i *InstanceFailoverGroupProperties) UnmarshalJSON(data []byte) error { case "replicationState": err = unpopulate(val, "ReplicationState", &i.ReplicationState) delete(rawMsg, key) + case "secondaryType": + err = unpopulate(val, "SecondaryType", &i.SecondaryType) + delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", i, err) @@ -8124,6 +8551,80 @@ func (m *ManagedDatabase) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type ManagedDatabaseAdvancedThreatProtection. +func (m ManagedDatabaseAdvancedThreatProtection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", m.ID) + populate(objectMap, "name", m.Name) + populate(objectMap, "properties", m.Properties) + populate(objectMap, "systemData", m.SystemData) + populate(objectMap, "type", m.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedDatabaseAdvancedThreatProtection. +func (m *ManagedDatabaseAdvancedThreatProtection) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &m.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &m.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &m.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &m.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &m.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ManagedDatabaseAdvancedThreatProtectionListResult. +func (m ManagedDatabaseAdvancedThreatProtectionListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", m.NextLink) + populate(objectMap, "value", m.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedDatabaseAdvancedThreatProtectionListResult. +func (m *ManagedDatabaseAdvancedThreatProtectionListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &m.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &m.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type ManagedDatabaseListResult. func (m ManagedDatabaseListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -8155,6 +8656,190 @@ func (m *ManagedDatabaseListResult) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type ManagedDatabaseMoveDefinition. +func (m ManagedDatabaseMoveDefinition) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "destinationManagedDatabaseId", m.DestinationManagedDatabaseID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedDatabaseMoveDefinition. +func (m *ManagedDatabaseMoveDefinition) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "destinationManagedDatabaseId": + err = unpopulate(val, "DestinationManagedDatabaseID", &m.DestinationManagedDatabaseID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ManagedDatabaseMoveOperationListResult. +func (m ManagedDatabaseMoveOperationListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", m.NextLink) + populate(objectMap, "value", m.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedDatabaseMoveOperationListResult. +func (m *ManagedDatabaseMoveOperationListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &m.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &m.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ManagedDatabaseMoveOperationResult. +func (m ManagedDatabaseMoveOperationResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", m.ID) + populate(objectMap, "name", m.Name) + populate(objectMap, "properties", m.Properties) + populate(objectMap, "type", m.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedDatabaseMoveOperationResult. +func (m *ManagedDatabaseMoveOperationResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &m.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &m.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &m.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &m.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ManagedDatabaseMoveOperationResultProperties. +func (m ManagedDatabaseMoveOperationResultProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "errorCode", m.ErrorCode) + populate(objectMap, "errorDescription", m.ErrorDescription) + populate(objectMap, "errorSeverity", m.ErrorSeverity) + populate(objectMap, "isCancellable", m.IsCancellable) + populate(objectMap, "isUserError", m.IsUserError) + populate(objectMap, "operation", m.Operation) + populate(objectMap, "operationFriendlyName", m.OperationFriendlyName) + populate(objectMap, "operationMode", m.OperationMode) + populate(objectMap, "sourceDatabaseName", m.SourceDatabaseName) + populate(objectMap, "sourceManagedInstanceId", m.SourceManagedInstanceID) + populate(objectMap, "sourceManagedInstanceName", m.SourceManagedInstanceName) + populateTimeRFC3339(objectMap, "startTime", m.StartTime) + populate(objectMap, "state", m.State) + populate(objectMap, "targetDatabaseName", m.TargetDatabaseName) + populate(objectMap, "targetManagedInstanceId", m.TargetManagedInstanceID) + populate(objectMap, "targetManagedInstanceName", m.TargetManagedInstanceName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedDatabaseMoveOperationResultProperties. +func (m *ManagedDatabaseMoveOperationResultProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "errorCode": + err = unpopulate(val, "ErrorCode", &m.ErrorCode) + delete(rawMsg, key) + case "errorDescription": + err = unpopulate(val, "ErrorDescription", &m.ErrorDescription) + delete(rawMsg, key) + case "errorSeverity": + err = unpopulate(val, "ErrorSeverity", &m.ErrorSeverity) + delete(rawMsg, key) + case "isCancellable": + err = unpopulate(val, "IsCancellable", &m.IsCancellable) + delete(rawMsg, key) + case "isUserError": + err = unpopulate(val, "IsUserError", &m.IsUserError) + delete(rawMsg, key) + case "operation": + err = unpopulate(val, "Operation", &m.Operation) + delete(rawMsg, key) + case "operationFriendlyName": + err = unpopulate(val, "OperationFriendlyName", &m.OperationFriendlyName) + delete(rawMsg, key) + case "operationMode": + err = unpopulate(val, "OperationMode", &m.OperationMode) + delete(rawMsg, key) + case "sourceDatabaseName": + err = unpopulate(val, "SourceDatabaseName", &m.SourceDatabaseName) + delete(rawMsg, key) + case "sourceManagedInstanceId": + err = unpopulate(val, "SourceManagedInstanceID", &m.SourceManagedInstanceID) + delete(rawMsg, key) + case "sourceManagedInstanceName": + err = unpopulate(val, "SourceManagedInstanceName", &m.SourceManagedInstanceName) + delete(rawMsg, key) + case "startTime": + err = unpopulateTimeRFC3339(val, "StartTime", &m.StartTime) + delete(rawMsg, key) + case "state": + err = unpopulate(val, "State", &m.State) + delete(rawMsg, key) + case "targetDatabaseName": + err = unpopulate(val, "TargetDatabaseName", &m.TargetDatabaseName) + delete(rawMsg, key) + case "targetManagedInstanceId": + err = unpopulate(val, "TargetManagedInstanceID", &m.TargetManagedInstanceID) + delete(rawMsg, key) + case "targetManagedInstanceName": + err = unpopulate(val, "TargetManagedInstanceName", &m.TargetManagedInstanceName) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type ManagedDatabaseProperties. func (m ManagedDatabaseProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -8163,9 +8848,13 @@ func (m ManagedDatabaseProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "collation", m.Collation) populate(objectMap, "createMode", m.CreateMode) populateTimeRFC3339(objectMap, "creationDate", m.CreationDate) + populate(objectMap, "crossSubscriptionRestorableDroppedDatabaseId", m.CrossSubscriptionRestorableDroppedDatabaseID) + populate(objectMap, "crossSubscriptionSourceDatabaseId", m.CrossSubscriptionSourceDatabaseID) + populate(objectMap, "crossSubscriptionTargetManagedInstanceId", m.CrossSubscriptionTargetManagedInstanceID) populate(objectMap, "defaultSecondaryLocation", m.DefaultSecondaryLocation) populateTimeRFC3339(objectMap, "earliestRestorePoint", m.EarliestRestorePoint) populate(objectMap, "failoverGroupId", m.FailoverGroupID) + populate(objectMap, "isLedgerOn", m.IsLedgerOn) populate(objectMap, "lastBackupName", m.LastBackupName) populate(objectMap, "longTermRetentionBackupResourceId", m.LongTermRetentionBackupResourceID) populate(objectMap, "recoverableDatabaseId", m.RecoverableDatabaseID) @@ -8173,6 +8862,7 @@ func (m ManagedDatabaseProperties) MarshalJSON() ([]byte, error) { populateTimeRFC3339(objectMap, "restorePointInTime", m.RestorePointInTime) populate(objectMap, "sourceDatabaseId", m.SourceDatabaseID) populate(objectMap, "status", m.Status) + populate(objectMap, "storageContainerIdentity", m.StorageContainerIdentity) populate(objectMap, "storageContainerSasToken", m.StorageContainerSasToken) populate(objectMap, "storageContainerUri", m.StorageContainerURI) return json.Marshal(objectMap) @@ -8202,6 +8892,15 @@ func (m *ManagedDatabaseProperties) UnmarshalJSON(data []byte) error { case "creationDate": err = unpopulateTimeRFC3339(val, "CreationDate", &m.CreationDate) delete(rawMsg, key) + case "crossSubscriptionRestorableDroppedDatabaseId": + err = unpopulate(val, "CrossSubscriptionRestorableDroppedDatabaseID", &m.CrossSubscriptionRestorableDroppedDatabaseID) + delete(rawMsg, key) + case "crossSubscriptionSourceDatabaseId": + err = unpopulate(val, "CrossSubscriptionSourceDatabaseID", &m.CrossSubscriptionSourceDatabaseID) + delete(rawMsg, key) + case "crossSubscriptionTargetManagedInstanceId": + err = unpopulate(val, "CrossSubscriptionTargetManagedInstanceID", &m.CrossSubscriptionTargetManagedInstanceID) + delete(rawMsg, key) case "defaultSecondaryLocation": err = unpopulate(val, "DefaultSecondaryLocation", &m.DefaultSecondaryLocation) delete(rawMsg, key) @@ -8211,6 +8910,9 @@ func (m *ManagedDatabaseProperties) UnmarshalJSON(data []byte) error { case "failoverGroupId": err = unpopulate(val, "FailoverGroupID", &m.FailoverGroupID) delete(rawMsg, key) + case "isLedgerOn": + err = unpopulate(val, "IsLedgerOn", &m.IsLedgerOn) + delete(rawMsg, key) case "lastBackupName": err = unpopulate(val, "LastBackupName", &m.LastBackupName) delete(rawMsg, key) @@ -8232,6 +8934,9 @@ func (m *ManagedDatabaseProperties) UnmarshalJSON(data []byte) error { case "status": err = unpopulate(val, "Status", &m.Status) delete(rawMsg, key) + case "storageContainerIdentity": + err = unpopulate(val, "StorageContainerIdentity", &m.StorageContainerIdentity) + delete(rawMsg, key) case "storageContainerSasToken": err = unpopulate(val, "StorageContainerSasToken", &m.StorageContainerSasToken) delete(rawMsg, key) @@ -8246,24 +8951,20 @@ func (m *ManagedDatabaseProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ManagedDatabaseRestoreDetailsProperties. -func (m ManagedDatabaseRestoreDetailsProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ManagedDatabaseRestoreDetailsBackupSetProperties. +func (m ManagedDatabaseRestoreDetailsBackupSetProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "blockReason", m.BlockReason) - populate(objectMap, "currentRestoringFileName", m.CurrentRestoringFileName) - populate(objectMap, "lastRestoredFileName", m.LastRestoredFileName) - populateTimeRFC3339(objectMap, "lastRestoredFileTime", m.LastRestoredFileTime) - populate(objectMap, "lastUploadedFileName", m.LastUploadedFileName) - populateTimeRFC3339(objectMap, "lastUploadedFileTime", m.LastUploadedFileTime) - populate(objectMap, "numberOfFilesDetected", m.NumberOfFilesDetected) - populate(objectMap, "percentCompleted", m.PercentCompleted) + populate(objectMap, "backupSizeMB", m.BackupSizeMB) + populate(objectMap, "firstStripeName", m.FirstStripeName) + populate(objectMap, "numberOfStripes", m.NumberOfStripes) + populateTimeRFC3339(objectMap, "restoreFinishedTimestampUtc", m.RestoreFinishedTimestampUTC) + populateTimeRFC3339(objectMap, "restoreStartedTimestampUtc", m.RestoreStartedTimestampUTC) populate(objectMap, "status", m.Status) - populate(objectMap, "unrestorableFiles", m.UnrestorableFiles) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedDatabaseRestoreDetailsProperties. -func (m *ManagedDatabaseRestoreDetailsProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedDatabaseRestoreDetailsBackupSetProperties. +func (m *ManagedDatabaseRestoreDetailsBackupSetProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", m, err) @@ -8271,33 +8972,132 @@ func (m *ManagedDatabaseRestoreDetailsProperties) UnmarshalJSON(data []byte) err for key, val := range rawMsg { var err error switch key { - case "blockReason": - err = unpopulate(val, "BlockReason", &m.BlockReason) - delete(rawMsg, key) - case "currentRestoringFileName": - err = unpopulate(val, "CurrentRestoringFileName", &m.CurrentRestoringFileName) + case "backupSizeMB": + err = unpopulate(val, "BackupSizeMB", &m.BackupSizeMB) delete(rawMsg, key) - case "lastRestoredFileName": - err = unpopulate(val, "LastRestoredFileName", &m.LastRestoredFileName) + case "firstStripeName": + err = unpopulate(val, "FirstStripeName", &m.FirstStripeName) delete(rawMsg, key) - case "lastRestoredFileTime": - err = unpopulateTimeRFC3339(val, "LastRestoredFileTime", &m.LastRestoredFileTime) + case "numberOfStripes": + err = unpopulate(val, "NumberOfStripes", &m.NumberOfStripes) delete(rawMsg, key) - case "lastUploadedFileName": - err = unpopulate(val, "LastUploadedFileName", &m.LastUploadedFileName) + case "restoreFinishedTimestampUtc": + err = unpopulateTimeRFC3339(val, "RestoreFinishedTimestampUTC", &m.RestoreFinishedTimestampUTC) delete(rawMsg, key) - case "lastUploadedFileTime": - err = unpopulateTimeRFC3339(val, "LastUploadedFileTime", &m.LastUploadedFileTime) + case "restoreStartedTimestampUtc": + err = unpopulateTimeRFC3339(val, "RestoreStartedTimestampUTC", &m.RestoreStartedTimestampUTC) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &m.Status) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ManagedDatabaseRestoreDetailsProperties. +func (m ManagedDatabaseRestoreDetailsProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "blockReason", m.BlockReason) + populate(objectMap, "currentBackupType", m.CurrentBackupType) + populate(objectMap, "currentRestorePlanSizeMB", m.CurrentRestorePlanSizeMB) + populate(objectMap, "currentRestoredSizeMB", m.CurrentRestoredSizeMB) + populate(objectMap, "currentRestoringFileName", m.CurrentRestoringFileName) + populate(objectMap, "diffBackupSets", m.DiffBackupSets) + populate(objectMap, "fullBackupSets", m.FullBackupSets) + populate(objectMap, "lastRestoredFileName", m.LastRestoredFileName) + populateTimeRFC3339(objectMap, "lastRestoredFileTime", m.LastRestoredFileTime) + populate(objectMap, "lastUploadedFileName", m.LastUploadedFileName) + populateTimeRFC3339(objectMap, "lastUploadedFileTime", m.LastUploadedFileTime) + populate(objectMap, "logBackupSets", m.LogBackupSets) + populate(objectMap, "numberOfFilesDetected", m.NumberOfFilesDetected) + populate(objectMap, "numberOfFilesQueued", m.NumberOfFilesQueued) + populate(objectMap, "numberOfFilesRestored", m.NumberOfFilesRestored) + populate(objectMap, "numberOfFilesRestoring", m.NumberOfFilesRestoring) + populate(objectMap, "numberOfFilesSkipped", m.NumberOfFilesSkipped) + populate(objectMap, "numberOfFilesUnrestorable", m.NumberOfFilesUnrestorable) + populate(objectMap, "percentCompleted", m.PercentCompleted) + populate(objectMap, "status", m.Status) + populate(objectMap, "type", m.Type) + populate(objectMap, "unrestorableFiles", m.UnrestorableFiles) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedDatabaseRestoreDetailsProperties. +func (m *ManagedDatabaseRestoreDetailsProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "blockReason": + err = unpopulate(val, "BlockReason", &m.BlockReason) + delete(rawMsg, key) + case "currentBackupType": + err = unpopulate(val, "CurrentBackupType", &m.CurrentBackupType) + delete(rawMsg, key) + case "currentRestorePlanSizeMB": + err = unpopulate(val, "CurrentRestorePlanSizeMB", &m.CurrentRestorePlanSizeMB) + delete(rawMsg, key) + case "currentRestoredSizeMB": + err = unpopulate(val, "CurrentRestoredSizeMB", &m.CurrentRestoredSizeMB) + delete(rawMsg, key) + case "currentRestoringFileName": + err = unpopulate(val, "CurrentRestoringFileName", &m.CurrentRestoringFileName) + delete(rawMsg, key) + case "diffBackupSets": + err = unpopulate(val, "DiffBackupSets", &m.DiffBackupSets) + delete(rawMsg, key) + case "fullBackupSets": + err = unpopulate(val, "FullBackupSets", &m.FullBackupSets) + delete(rawMsg, key) + case "lastRestoredFileName": + err = unpopulate(val, "LastRestoredFileName", &m.LastRestoredFileName) + delete(rawMsg, key) + case "lastRestoredFileTime": + err = unpopulateTimeRFC3339(val, "LastRestoredFileTime", &m.LastRestoredFileTime) + delete(rawMsg, key) + case "lastUploadedFileName": + err = unpopulate(val, "LastUploadedFileName", &m.LastUploadedFileName) + delete(rawMsg, key) + case "lastUploadedFileTime": + err = unpopulateTimeRFC3339(val, "LastUploadedFileTime", &m.LastUploadedFileTime) + delete(rawMsg, key) + case "logBackupSets": + err = unpopulate(val, "LogBackupSets", &m.LogBackupSets) delete(rawMsg, key) case "numberOfFilesDetected": err = unpopulate(val, "NumberOfFilesDetected", &m.NumberOfFilesDetected) delete(rawMsg, key) + case "numberOfFilesQueued": + err = unpopulate(val, "NumberOfFilesQueued", &m.NumberOfFilesQueued) + delete(rawMsg, key) + case "numberOfFilesRestored": + err = unpopulate(val, "NumberOfFilesRestored", &m.NumberOfFilesRestored) + delete(rawMsg, key) + case "numberOfFilesRestoring": + err = unpopulate(val, "NumberOfFilesRestoring", &m.NumberOfFilesRestoring) + delete(rawMsg, key) + case "numberOfFilesSkipped": + err = unpopulate(val, "NumberOfFilesSkipped", &m.NumberOfFilesSkipped) + delete(rawMsg, key) + case "numberOfFilesUnrestorable": + err = unpopulate(val, "NumberOfFilesUnrestorable", &m.NumberOfFilesUnrestorable) + delete(rawMsg, key) case "percentCompleted": err = unpopulate(val, "PercentCompleted", &m.PercentCompleted) delete(rawMsg, key) case "status": err = unpopulate(val, "Status", &m.Status) delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &m.Type) + delete(rawMsg, key) case "unrestorableFiles": err = unpopulate(val, "UnrestorableFiles", &m.UnrestorableFiles) delete(rawMsg, key) @@ -8348,6 +9148,33 @@ func (m *ManagedDatabaseRestoreDetailsResult) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type ManagedDatabaseRestoreDetailsUnrestorableFileProperties. +func (m ManagedDatabaseRestoreDetailsUnrestorableFileProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "name", m.Name) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedDatabaseRestoreDetailsUnrestorableFileProperties. +func (m *ManagedDatabaseRestoreDetailsUnrestorableFileProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &m.Name) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type ManagedDatabaseSecurityAlertPolicy. func (m ManagedDatabaseSecurityAlertPolicy) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -8418,6 +9245,37 @@ func (m *ManagedDatabaseSecurityAlertPolicyListResult) UnmarshalJSON(data []byte return nil } +// MarshalJSON implements the json.Marshaller interface for type ManagedDatabaseStartMoveDefinition. +func (m ManagedDatabaseStartMoveDefinition) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "destinationManagedDatabaseId", m.DestinationManagedDatabaseID) + populate(objectMap, "operationMode", m.OperationMode) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedDatabaseStartMoveDefinition. +func (m *ManagedDatabaseStartMoveDefinition) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "destinationManagedDatabaseId": + err = unpopulate(val, "DestinationManagedDatabaseID", &m.DestinationManagedDatabaseID) + delete(rawMsg, key) + case "operationMode": + err = unpopulate(val, "OperationMode", &m.OperationMode) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type ManagedDatabaseUpdate. func (m ManagedDatabaseUpdate) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -8613,6 +9471,80 @@ func (m *ManagedInstanceAdministratorProperties) UnmarshalJSON(data []byte) erro return nil } +// MarshalJSON implements the json.Marshaller interface for type ManagedInstanceAdvancedThreatProtection. +func (m ManagedInstanceAdvancedThreatProtection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", m.ID) + populate(objectMap, "name", m.Name) + populate(objectMap, "properties", m.Properties) + populate(objectMap, "systemData", m.SystemData) + populate(objectMap, "type", m.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedInstanceAdvancedThreatProtection. +func (m *ManagedInstanceAdvancedThreatProtection) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &m.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &m.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &m.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &m.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &m.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ManagedInstanceAdvancedThreatProtectionListResult. +func (m ManagedInstanceAdvancedThreatProtectionListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", m.NextLink) + populate(objectMap, "value", m.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedInstanceAdvancedThreatProtectionListResult. +func (m *ManagedInstanceAdvancedThreatProtectionListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &m.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &m.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type ManagedInstanceAzureADOnlyAuthListResult. func (m ManagedInstanceAzureADOnlyAuthListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -8710,66 +9642,18 @@ func (m *ManagedInstanceAzureADOnlyAuthentication) UnmarshalJSON(data []byte) er return nil } -// MarshalJSON implements the json.Marshaller interface for type ManagedInstanceEditionCapability. -func (m ManagedInstanceEditionCapability) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "name", m.Name) - populate(objectMap, "reason", m.Reason) - populate(objectMap, "status", m.Status) - populate(objectMap, "supportedFamilies", m.SupportedFamilies) - populate(objectMap, "supportedStorageCapabilities", m.SupportedStorageCapabilities) - populate(objectMap, "zoneRedundant", m.ZoneRedundant) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedInstanceEditionCapability. -func (m *ManagedInstanceEditionCapability) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "name": - err = unpopulate(val, "Name", &m.Name) - delete(rawMsg, key) - case "reason": - err = unpopulate(val, "Reason", &m.Reason) - delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &m.Status) - delete(rawMsg, key) - case "supportedFamilies": - err = unpopulate(val, "SupportedFamilies", &m.SupportedFamilies) - delete(rawMsg, key) - case "supportedStorageCapabilities": - err = unpopulate(val, "SupportedStorageCapabilities", &m.SupportedStorageCapabilities) - delete(rawMsg, key) - case "zoneRedundant": - err = unpopulate(val, "ZoneRedundant", &m.ZoneRedundant) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ManagedInstanceEncryptionProtector. -func (m ManagedInstanceEncryptionProtector) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ManagedInstanceDtc. +func (m ManagedInstanceDtc) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", m.ID) - populate(objectMap, "kind", m.Kind) populate(objectMap, "name", m.Name) populate(objectMap, "properties", m.Properties) populate(objectMap, "type", m.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedInstanceEncryptionProtector. -func (m *ManagedInstanceEncryptionProtector) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedInstanceDtc. +func (m *ManagedInstanceDtc) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", m, err) @@ -8780,9 +9664,6 @@ func (m *ManagedInstanceEncryptionProtector) UnmarshalJSON(data []byte) error { case "id": err = unpopulate(val, "ID", &m.ID) delete(rawMsg, key) - case "kind": - err = unpopulate(val, "Kind", &m.Kind) - delete(rawMsg, key) case "name": err = unpopulate(val, "Name", &m.Name) delete(rawMsg, key) @@ -8800,16 +9681,16 @@ func (m *ManagedInstanceEncryptionProtector) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ManagedInstanceEncryptionProtectorListResult. -func (m ManagedInstanceEncryptionProtectorListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ManagedInstanceDtcListResult. +func (m ManagedInstanceDtcListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "nextLink", m.NextLink) populate(objectMap, "value", m.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedInstanceEncryptionProtectorListResult. -func (m *ManagedInstanceEncryptionProtectorListResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedInstanceDtcListResult. +func (m *ManagedInstanceDtcListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", m, err) @@ -8831,19 +9712,19 @@ func (m *ManagedInstanceEncryptionProtectorListResult) UnmarshalJSON(data []byte return nil } -// MarshalJSON implements the json.Marshaller interface for type ManagedInstanceEncryptionProtectorProperties. -func (m ManagedInstanceEncryptionProtectorProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ManagedInstanceDtcProperties. +func (m ManagedInstanceDtcProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "autoRotationEnabled", m.AutoRotationEnabled) - populate(objectMap, "serverKeyName", m.ServerKeyName) - populate(objectMap, "serverKeyType", m.ServerKeyType) - populate(objectMap, "thumbprint", m.Thumbprint) - populate(objectMap, "uri", m.URI) + populate(objectMap, "dtcEnabled", m.DtcEnabled) + populate(objectMap, "dtcHostNameDnsSuffix", m.DtcHostNameDNSSuffix) + populate(objectMap, "externalDnsSuffixSearchList", m.ExternalDNSSuffixSearchList) + populate(objectMap, "provisioningState", m.ProvisioningState) + populate(objectMap, "securitySettings", m.SecuritySettings) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedInstanceEncryptionProtectorProperties. -func (m *ManagedInstanceEncryptionProtectorProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedInstanceDtcProperties. +func (m *ManagedInstanceDtcProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", m, err) @@ -8851,16 +9732,258 @@ func (m *ManagedInstanceEncryptionProtectorProperties) UnmarshalJSON(data []byte for key, val := range rawMsg { var err error switch key { - case "autoRotationEnabled": - err = unpopulate(val, "AutoRotationEnabled", &m.AutoRotationEnabled) + case "dtcEnabled": + err = unpopulate(val, "DtcEnabled", &m.DtcEnabled) delete(rawMsg, key) - case "serverKeyName": - err = unpopulate(val, "ServerKeyName", &m.ServerKeyName) + case "dtcHostNameDnsSuffix": + err = unpopulate(val, "DtcHostNameDNSSuffix", &m.DtcHostNameDNSSuffix) delete(rawMsg, key) - case "serverKeyType": - err = unpopulate(val, "ServerKeyType", &m.ServerKeyType) + case "externalDnsSuffixSearchList": + err = unpopulate(val, "ExternalDNSSuffixSearchList", &m.ExternalDNSSuffixSearchList) delete(rawMsg, key) - case "thumbprint": + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &m.ProvisioningState) + delete(rawMsg, key) + case "securitySettings": + err = unpopulate(val, "SecuritySettings", &m.SecuritySettings) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ManagedInstanceDtcSecuritySettings. +func (m ManagedInstanceDtcSecuritySettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "snaLu6point2TransactionsEnabled", m.SnaLu6Point2TransactionsEnabled) + populate(objectMap, "transactionManagerCommunicationSettings", m.TransactionManagerCommunicationSettings) + populate(objectMap, "xaTransactionsDefaultTimeout", m.XaTransactionsDefaultTimeout) + populate(objectMap, "xaTransactionsEnabled", m.XaTransactionsEnabled) + populate(objectMap, "xaTransactionsMaximumTimeout", m.XaTransactionsMaximumTimeout) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedInstanceDtcSecuritySettings. +func (m *ManagedInstanceDtcSecuritySettings) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "snaLu6point2TransactionsEnabled": + err = unpopulate(val, "SnaLu6Point2TransactionsEnabled", &m.SnaLu6Point2TransactionsEnabled) + delete(rawMsg, key) + case "transactionManagerCommunicationSettings": + err = unpopulate(val, "TransactionManagerCommunicationSettings", &m.TransactionManagerCommunicationSettings) + delete(rawMsg, key) + case "xaTransactionsDefaultTimeout": + err = unpopulate(val, "XaTransactionsDefaultTimeout", &m.XaTransactionsDefaultTimeout) + delete(rawMsg, key) + case "xaTransactionsEnabled": + err = unpopulate(val, "XaTransactionsEnabled", &m.XaTransactionsEnabled) + delete(rawMsg, key) + case "xaTransactionsMaximumTimeout": + err = unpopulate(val, "XaTransactionsMaximumTimeout", &m.XaTransactionsMaximumTimeout) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ManagedInstanceDtcTransactionManagerCommunicationSettings. +func (m ManagedInstanceDtcTransactionManagerCommunicationSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "allowInboundEnabled", m.AllowInboundEnabled) + populate(objectMap, "allowOutboundEnabled", m.AllowOutboundEnabled) + populate(objectMap, "authentication", m.Authentication) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedInstanceDtcTransactionManagerCommunicationSettings. +func (m *ManagedInstanceDtcTransactionManagerCommunicationSettings) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "allowInboundEnabled": + err = unpopulate(val, "AllowInboundEnabled", &m.AllowInboundEnabled) + delete(rawMsg, key) + case "allowOutboundEnabled": + err = unpopulate(val, "AllowOutboundEnabled", &m.AllowOutboundEnabled) + delete(rawMsg, key) + case "authentication": + err = unpopulate(val, "Authentication", &m.Authentication) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ManagedInstanceEditionCapability. +func (m ManagedInstanceEditionCapability) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "name", m.Name) + populate(objectMap, "reason", m.Reason) + populate(objectMap, "status", m.Status) + populate(objectMap, "supportedFamilies", m.SupportedFamilies) + populate(objectMap, "supportedStorageCapabilities", m.SupportedStorageCapabilities) + populate(objectMap, "zoneRedundant", m.ZoneRedundant) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedInstanceEditionCapability. +func (m *ManagedInstanceEditionCapability) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &m.Name) + delete(rawMsg, key) + case "reason": + err = unpopulate(val, "Reason", &m.Reason) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &m.Status) + delete(rawMsg, key) + case "supportedFamilies": + err = unpopulate(val, "SupportedFamilies", &m.SupportedFamilies) + delete(rawMsg, key) + case "supportedStorageCapabilities": + err = unpopulate(val, "SupportedStorageCapabilities", &m.SupportedStorageCapabilities) + delete(rawMsg, key) + case "zoneRedundant": + err = unpopulate(val, "ZoneRedundant", &m.ZoneRedundant) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ManagedInstanceEncryptionProtector. +func (m ManagedInstanceEncryptionProtector) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", m.ID) + populate(objectMap, "kind", m.Kind) + populate(objectMap, "name", m.Name) + populate(objectMap, "properties", m.Properties) + populate(objectMap, "type", m.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedInstanceEncryptionProtector. +func (m *ManagedInstanceEncryptionProtector) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &m.ID) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &m.Kind) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &m.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &m.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &m.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ManagedInstanceEncryptionProtectorListResult. +func (m ManagedInstanceEncryptionProtectorListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", m.NextLink) + populate(objectMap, "value", m.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedInstanceEncryptionProtectorListResult. +func (m *ManagedInstanceEncryptionProtectorListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &m.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &m.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ManagedInstanceEncryptionProtectorProperties. +func (m ManagedInstanceEncryptionProtectorProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "autoRotationEnabled", m.AutoRotationEnabled) + populate(objectMap, "serverKeyName", m.ServerKeyName) + populate(objectMap, "serverKeyType", m.ServerKeyType) + populate(objectMap, "thumbprint", m.Thumbprint) + populate(objectMap, "uri", m.URI) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedInstanceEncryptionProtectorProperties. +func (m *ManagedInstanceEncryptionProtectorProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "autoRotationEnabled": + err = unpopulate(val, "AutoRotationEnabled", &m.AutoRotationEnabled) + delete(rawMsg, key) + case "serverKeyName": + err = unpopulate(val, "ServerKeyName", &m.ServerKeyName) + delete(rawMsg, key) + case "serverKeyType": + err = unpopulate(val, "ServerKeyType", &m.ServerKeyType) + delete(rawMsg, key) + case "thumbprint": err = unpopulate(val, "Thumbprint", &m.Thumbprint) delete(rawMsg, key) case "uri": @@ -9830,6 +10953,7 @@ func (m ManagedInstancePrivateLinkProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "groupId", m.GroupID) populate(objectMap, "requiredMembers", m.RequiredMembers) + populate(objectMap, "requiredZoneNames", m.RequiredZoneNames) return json.Marshal(objectMap) } @@ -9848,6 +10972,9 @@ func (m *ManagedInstancePrivateLinkProperties) UnmarshalJSON(data []byte) error case "requiredMembers": err = unpopulate(val, "RequiredMembers", &m.RequiredMembers) delete(rawMsg, key) + case "requiredZoneNames": + err = unpopulate(val, "RequiredZoneNames", &m.RequiredZoneNames) + delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", m, err) @@ -9922,6 +11049,7 @@ func (m ManagedInstanceProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "subnetId", m.SubnetID) populate(objectMap, "timezoneId", m.TimezoneID) populate(objectMap, "vCores", m.VCores) + populate(objectMap, "virtualClusterId", m.VirtualClusterID) populate(objectMap, "zoneRedundant", m.ZoneRedundant) return json.Marshal(objectMap) } @@ -10019,6 +11147,9 @@ func (m *ManagedInstanceProperties) UnmarshalJSON(data []byte) error { case "vCores": err = unpopulate(val, "VCores", &m.VCores) delete(rawMsg, key) + case "virtualClusterId": + err = unpopulate(val, "VirtualClusterID", &m.VirtualClusterID) + delete(rawMsg, key) case "zoneRedundant": err = unpopulate(val, "ZoneRedundant", &m.ZoneRedundant) delete(rawMsg, key) @@ -10350,19 +11481,18 @@ func (m *ManagedInstanceVulnerabilityAssessmentProperties) UnmarshalJSON(data [] return nil } -// MarshalJSON implements the json.Marshaller interface for type ManagedServerSecurityAlertPolicy. -func (m ManagedServerSecurityAlertPolicy) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ManagedLedgerDigestUploads. +func (m ManagedLedgerDigestUploads) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", m.ID) populate(objectMap, "name", m.Name) populate(objectMap, "properties", m.Properties) - populate(objectMap, "systemData", m.SystemData) populate(objectMap, "type", m.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedServerSecurityAlertPolicy. -func (m *ManagedServerSecurityAlertPolicy) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedLedgerDigestUploads. +func (m *ManagedLedgerDigestUploads) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", m, err) @@ -10379,9 +11509,6 @@ func (m *ManagedServerSecurityAlertPolicy) UnmarshalJSON(data []byte) error { case "properties": err = unpopulate(val, "Properties", &m.Properties) delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &m.SystemData) - delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &m.Type) delete(rawMsg, key) @@ -10393,16 +11520,16 @@ func (m *ManagedServerSecurityAlertPolicy) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ManagedServerSecurityAlertPolicyListResult. -func (m ManagedServerSecurityAlertPolicyListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ManagedLedgerDigestUploadsListResult. +func (m ManagedLedgerDigestUploadsListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "nextLink", m.NextLink) populate(objectMap, "value", m.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedServerSecurityAlertPolicyListResult. -func (m *ManagedServerSecurityAlertPolicyListResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedLedgerDigestUploadsListResult. +func (m *ManagedLedgerDigestUploadsListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", m, err) @@ -10424,8 +11551,39 @@ func (m *ManagedServerSecurityAlertPolicyListResult) UnmarshalJSON(data []byte) return nil } -// MarshalJSON implements the json.Marshaller interface for type ManagedTransparentDataEncryption. -func (m ManagedTransparentDataEncryption) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ManagedLedgerDigestUploadsProperties. +func (m ManagedLedgerDigestUploadsProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "digestStorageEndpoint", m.DigestStorageEndpoint) + populate(objectMap, "state", m.State) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedLedgerDigestUploadsProperties. +func (m *ManagedLedgerDigestUploadsProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "digestStorageEndpoint": + err = unpopulate(val, "DigestStorageEndpoint", &m.DigestStorageEndpoint) + delete(rawMsg, key) + case "state": + err = unpopulate(val, "State", &m.State) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ManagedServerDNSAlias. +func (m ManagedServerDNSAlias) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", m.ID) populate(objectMap, "name", m.Name) @@ -10434,8 +11592,8 @@ func (m ManagedTransparentDataEncryption) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedTransparentDataEncryption. -func (m *ManagedTransparentDataEncryption) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedServerDNSAlias. +func (m *ManagedServerDNSAlias) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", m, err) @@ -10463,16 +11621,15 @@ func (m *ManagedTransparentDataEncryption) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ManagedTransparentDataEncryptionListResult. -func (m ManagedTransparentDataEncryptionListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ManagedServerDNSAliasAcquisition. +func (m ManagedServerDNSAliasAcquisition) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", m.NextLink) - populate(objectMap, "value", m.Value) + populate(objectMap, "oldManagedServerDnsAliasResourceId", m.OldManagedServerDNSAliasResourceID) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedTransparentDataEncryptionListResult. -func (m *ManagedTransparentDataEncryptionListResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedServerDNSAliasAcquisition. +func (m *ManagedServerDNSAliasAcquisition) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", m, err) @@ -10480,11 +11637,8 @@ func (m *ManagedTransparentDataEncryptionListResult) UnmarshalJSON(data []byte) for key, val := range rawMsg { var err error switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &m.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &m.Value) + case "oldManagedServerDnsAliasResourceId": + err = unpopulate(val, "OldManagedServerDNSAliasResourceID", &m.OldManagedServerDNSAliasResourceID) delete(rawMsg, key) } if err != nil { @@ -10494,15 +11648,15 @@ func (m *ManagedTransparentDataEncryptionListResult) UnmarshalJSON(data []byte) return nil } -// MarshalJSON implements the json.Marshaller interface for type ManagedTransparentDataEncryptionProperties. -func (m ManagedTransparentDataEncryptionProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ManagedServerDNSAliasCreation. +func (m ManagedServerDNSAliasCreation) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "state", m.State) + populate(objectMap, "createDnsRecord", m.CreateDNSRecord) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedTransparentDataEncryptionProperties. -func (m *ManagedTransparentDataEncryptionProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedServerDNSAliasCreation. +func (m *ManagedServerDNSAliasCreation) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", m, err) @@ -10510,8 +11664,8 @@ func (m *ManagedTransparentDataEncryptionProperties) UnmarshalJSON(data []byte) for key, val := range rawMsg { var err error switch key { - case "state": - err = unpopulate(val, "State", &m.State) + case "createDnsRecord": + err = unpopulate(val, "CreateDNSRecord", &m.CreateDNSRecord) delete(rawMsg, key) } if err != nil { @@ -10521,16 +11675,16 @@ func (m *ManagedTransparentDataEncryptionProperties) UnmarshalJSON(data []byte) return nil } -// MarshalJSON implements the json.Marshaller interface for type MaxSizeCapability. -func (m MaxSizeCapability) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ManagedServerDNSAliasListResult. +func (m ManagedServerDNSAliasListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "limit", m.Limit) - populate(objectMap, "unit", m.Unit) + populate(objectMap, "nextLink", m.NextLink) + populate(objectMap, "value", m.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type MaxSizeCapability. -func (m *MaxSizeCapability) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedServerDNSAliasListResult. +func (m *ManagedServerDNSAliasListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", m, err) @@ -10538,11 +11692,11 @@ func (m *MaxSizeCapability) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "limit": - err = unpopulate(val, "Limit", &m.Limit) + case "nextLink": + err = unpopulate(val, "NextLink", &m.NextLink) delete(rawMsg, key) - case "unit": - err = unpopulate(val, "Unit", &m.Unit) + case "value": + err = unpopulate(val, "Value", &m.Value) delete(rawMsg, key) } if err != nil { @@ -10552,20 +11706,16 @@ func (m *MaxSizeCapability) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type MaxSizeRangeCapability. -func (m MaxSizeRangeCapability) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ManagedServerDNSAliasProperties. +func (m ManagedServerDNSAliasProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "logSize", m.LogSize) - populate(objectMap, "maxValue", m.MaxValue) - populate(objectMap, "minValue", m.MinValue) - populate(objectMap, "reason", m.Reason) - populate(objectMap, "scaleSize", m.ScaleSize) - populate(objectMap, "status", m.Status) + populate(objectMap, "azureDnsRecord", m.AzureDNSRecord) + populate(objectMap, "publicAzureDnsRecord", m.PublicAzureDNSRecord) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type MaxSizeRangeCapability. -func (m *MaxSizeRangeCapability) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedServerDNSAliasProperties. +func (m *ManagedServerDNSAliasProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", m, err) @@ -10573,23 +11723,11 @@ func (m *MaxSizeRangeCapability) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "logSize": - err = unpopulate(val, "LogSize", &m.LogSize) - delete(rawMsg, key) - case "maxValue": - err = unpopulate(val, "MaxValue", &m.MaxValue) - delete(rawMsg, key) - case "minValue": - err = unpopulate(val, "MinValue", &m.MinValue) - delete(rawMsg, key) - case "reason": - err = unpopulate(val, "Reason", &m.Reason) - delete(rawMsg, key) - case "scaleSize": - err = unpopulate(val, "ScaleSize", &m.ScaleSize) + case "azureDnsRecord": + err = unpopulate(val, "AzureDNSRecord", &m.AzureDNSRecord) delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &m.Status) + case "publicAzureDnsRecord": + err = unpopulate(val, "PublicAzureDNSRecord", &m.PublicAzureDNSRecord) delete(rawMsg, key) } if err != nil { @@ -10599,20 +11737,19 @@ func (m *MaxSizeRangeCapability) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type Metric. -func (m Metric) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ManagedServerSecurityAlertPolicy. +func (m ManagedServerSecurityAlertPolicy) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populateTimeRFC3339(objectMap, "endTime", m.EndTime) - populate(objectMap, "metricValues", m.MetricValues) + populate(objectMap, "id", m.ID) populate(objectMap, "name", m.Name) - populateTimeRFC3339(objectMap, "startTime", m.StartTime) - populate(objectMap, "timeGrain", m.TimeGrain) - populate(objectMap, "unit", m.Unit) + populate(objectMap, "properties", m.Properties) + populate(objectMap, "systemData", m.SystemData) + populate(objectMap, "type", m.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type Metric. -func (m *Metric) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedServerSecurityAlertPolicy. +func (m *ManagedServerSecurityAlertPolicy) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", m, err) @@ -10620,23 +11757,20 @@ func (m *Metric) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "endTime": - err = unpopulateTimeRFC3339(val, "EndTime", &m.EndTime) - delete(rawMsg, key) - case "metricValues": - err = unpopulate(val, "MetricValues", &m.MetricValues) + case "id": + err = unpopulate(val, "ID", &m.ID) delete(rawMsg, key) case "name": err = unpopulate(val, "Name", &m.Name) delete(rawMsg, key) - case "startTime": - err = unpopulateTimeRFC3339(val, "StartTime", &m.StartTime) + case "properties": + err = unpopulate(val, "Properties", &m.Properties) delete(rawMsg, key) - case "timeGrain": - err = unpopulate(val, "TimeGrain", &m.TimeGrain) + case "systemData": + err = unpopulate(val, "SystemData", &m.SystemData) delete(rawMsg, key) - case "unit": - err = unpopulate(val, "Unit", &m.Unit) + case "type": + err = unpopulate(val, "Type", &m.Type) delete(rawMsg, key) } if err != nil { @@ -10646,16 +11780,16 @@ func (m *Metric) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type MetricAvailability. -func (m MetricAvailability) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ManagedServerSecurityAlertPolicyListResult. +func (m ManagedServerSecurityAlertPolicyListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "retention", m.Retention) - populate(objectMap, "timeGrain", m.TimeGrain) + populate(objectMap, "nextLink", m.NextLink) + populate(objectMap, "value", m.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type MetricAvailability. -func (m *MetricAvailability) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedServerSecurityAlertPolicyListResult. +func (m *ManagedServerSecurityAlertPolicyListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", m, err) @@ -10663,11 +11797,11 @@ func (m *MetricAvailability) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "retention": - err = unpopulate(val, "Retention", &m.Retention) + case "nextLink": + err = unpopulate(val, "NextLink", &m.NextLink) delete(rawMsg, key) - case "timeGrain": - err = unpopulate(val, "TimeGrain", &m.TimeGrain) + case "value": + err = unpopulate(val, "Value", &m.Value) delete(rawMsg, key) } if err != nil { @@ -10677,19 +11811,18 @@ func (m *MetricAvailability) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type MetricDefinition. -func (m MetricDefinition) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ManagedTransparentDataEncryption. +func (m ManagedTransparentDataEncryption) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "metricAvailabilities", m.MetricAvailabilities) + populate(objectMap, "id", m.ID) populate(objectMap, "name", m.Name) - populate(objectMap, "primaryAggregationType", m.PrimaryAggregationType) - populate(objectMap, "resourceUri", m.ResourceURI) - populate(objectMap, "unit", m.Unit) + populate(objectMap, "properties", m.Properties) + populate(objectMap, "type", m.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type MetricDefinition. -func (m *MetricDefinition) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedTransparentDataEncryption. +func (m *ManagedTransparentDataEncryption) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", m, err) @@ -10697,20 +11830,17 @@ func (m *MetricDefinition) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "metricAvailabilities": - err = unpopulate(val, "MetricAvailabilities", &m.MetricAvailabilities) + case "id": + err = unpopulate(val, "ID", &m.ID) delete(rawMsg, key) case "name": err = unpopulate(val, "Name", &m.Name) delete(rawMsg, key) - case "primaryAggregationType": - err = unpopulate(val, "PrimaryAggregationType", &m.PrimaryAggregationType) - delete(rawMsg, key) - case "resourceUri": - err = unpopulate(val, "ResourceURI", &m.ResourceURI) + case "properties": + err = unpopulate(val, "Properties", &m.Properties) delete(rawMsg, key) - case "unit": - err = unpopulate(val, "Unit", &m.Unit) + case "type": + err = unpopulate(val, "Type", &m.Type) delete(rawMsg, key) } if err != nil { @@ -10720,15 +11850,16 @@ func (m *MetricDefinition) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type MetricDefinitionListResult. -func (m MetricDefinitionListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ManagedTransparentDataEncryptionListResult. +func (m ManagedTransparentDataEncryptionListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "nextLink", m.NextLink) populate(objectMap, "value", m.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type MetricDefinitionListResult. -func (m *MetricDefinitionListResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedTransparentDataEncryptionListResult. +func (m *ManagedTransparentDataEncryptionListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", m, err) @@ -10736,6 +11867,9 @@ func (m *MetricDefinitionListResult) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &m.NextLink) + delete(rawMsg, key) case "value": err = unpopulate(val, "Value", &m.Value) delete(rawMsg, key) @@ -10747,15 +11881,15 @@ func (m *MetricDefinitionListResult) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type MetricListResult. -func (m MetricListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ManagedTransparentDataEncryptionProperties. +func (m ManagedTransparentDataEncryptionProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "value", m.Value) + populate(objectMap, "state", m.State) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type MetricListResult. -func (m *MetricListResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedTransparentDataEncryptionProperties. +func (m *ManagedTransparentDataEncryptionProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", m, err) @@ -10763,8 +11897,8 @@ func (m *MetricListResult) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "value": - err = unpopulate(val, "Value", &m.Value) + case "state": + err = unpopulate(val, "State", &m.State) delete(rawMsg, key) } if err != nil { @@ -10774,16 +11908,16 @@ func (m *MetricListResult) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type MetricName. -func (m MetricName) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type MaxSizeCapability. +func (m MaxSizeCapability) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "localizedValue", m.LocalizedValue) - populate(objectMap, "value", m.Value) + populate(objectMap, "limit", m.Limit) + populate(objectMap, "unit", m.Unit) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type MetricName. -func (m *MetricName) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type MaxSizeCapability. +func (m *MaxSizeCapability) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", m, err) @@ -10791,11 +11925,11 @@ func (m *MetricName) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "localizedValue": - err = unpopulate(val, "LocalizedValue", &m.LocalizedValue) + case "limit": + err = unpopulate(val, "Limit", &m.Limit) delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &m.Value) + case "unit": + err = unpopulate(val, "Unit", &m.Unit) delete(rawMsg, key) } if err != nil { @@ -10805,20 +11939,20 @@ func (m *MetricName) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type MetricValue. -func (m MetricValue) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type MaxSizeRangeCapability. +func (m MaxSizeRangeCapability) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "average", m.Average) - populate(objectMap, "count", m.Count) - populate(objectMap, "maximum", m.Maximum) - populate(objectMap, "minimum", m.Minimum) - populateTimeRFC3339(objectMap, "timestamp", m.Timestamp) - populate(objectMap, "total", m.Total) + populate(objectMap, "logSize", m.LogSize) + populate(objectMap, "maxValue", m.MaxValue) + populate(objectMap, "minValue", m.MinValue) + populate(objectMap, "reason", m.Reason) + populate(objectMap, "scaleSize", m.ScaleSize) + populate(objectMap, "status", m.Status) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type MetricValue. -func (m *MetricValue) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type MaxSizeRangeCapability. +func (m *MaxSizeRangeCapability) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", m, err) @@ -10826,23 +11960,23 @@ func (m *MetricValue) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "average": - err = unpopulate(val, "Average", &m.Average) + case "logSize": + err = unpopulate(val, "LogSize", &m.LogSize) delete(rawMsg, key) - case "count": - err = unpopulate(val, "Count", &m.Count) + case "maxValue": + err = unpopulate(val, "MaxValue", &m.MaxValue) delete(rawMsg, key) - case "maximum": - err = unpopulate(val, "Maximum", &m.Maximum) + case "minValue": + err = unpopulate(val, "MinValue", &m.MinValue) delete(rawMsg, key) - case "minimum": - err = unpopulate(val, "Minimum", &m.Minimum) + case "reason": + err = unpopulate(val, "Reason", &m.Reason) delete(rawMsg, key) - case "timestamp": - err = unpopulateTimeRFC3339(val, "Timestamp", &m.Timestamp) + case "scaleSize": + err = unpopulate(val, "ScaleSize", &m.ScaleSize) delete(rawMsg, key) - case "total": - err = unpopulate(val, "Total", &m.Total) + case "status": + err = unpopulate(val, "Status", &m.Status) delete(rawMsg, key) } if err != nil { @@ -10887,16 +12021,16 @@ func (m *MinCapacityCapability) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type Name. -func (n Name) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type NSPConfigAccessRule. +func (n NSPConfigAccessRule) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "localizedValue", n.LocalizedValue) - populate(objectMap, "value", n.Value) + populate(objectMap, "name", n.Name) + populate(objectMap, "properties", n.Properties) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type Name. -func (n *Name) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type NSPConfigAccessRule. +func (n *NSPConfigAccessRule) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", n, err) @@ -10904,11 +12038,11 @@ func (n *Name) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "localizedValue": - err = unpopulate(val, "LocalizedValue", &n.LocalizedValue) + case "name": + err = unpopulate(val, "Name", &n.Name) delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &n.Value) + case "properties": + err = unpopulate(val, "Properties", &n.Properties) delete(rawMsg, key) } if err != nil { @@ -10918,16 +12052,19 @@ func (n *Name) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type NetworkIsolationSettings. -func (n NetworkIsolationSettings) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type NSPConfigAccessRuleProperties. +func (n NSPConfigAccessRuleProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "sqlServerResourceId", n.SQLServerResourceID) - populate(objectMap, "storageAccountResourceId", n.StorageAccountResourceID) + populate(objectMap, "addressPrefixes", n.AddressPrefixes) + populate(objectMap, "direction", n.Direction) + populate(objectMap, "fullyQualifiedDomainNames", n.FullyQualifiedDomainNames) + populate(objectMap, "networkSecurityPerimeters", n.NetworkSecurityPerimeters) + populate(objectMap, "subscriptions", n.Subscriptions) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type NetworkIsolationSettings. -func (n *NetworkIsolationSettings) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type NSPConfigAccessRuleProperties. +func (n *NSPConfigAccessRuleProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", n, err) @@ -10935,11 +12072,20 @@ func (n *NetworkIsolationSettings) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "sqlServerResourceId": - err = unpopulate(val, "SQLServerResourceID", &n.SQLServerResourceID) + case "addressPrefixes": + err = unpopulate(val, "AddressPrefixes", &n.AddressPrefixes) delete(rawMsg, key) - case "storageAccountResourceId": - err = unpopulate(val, "StorageAccountResourceID", &n.StorageAccountResourceID) + case "direction": + err = unpopulate(val, "Direction", &n.Direction) + delete(rawMsg, key) + case "fullyQualifiedDomainNames": + err = unpopulate(val, "FullyQualifiedDomainNames", &n.FullyQualifiedDomainNames) + delete(rawMsg, key) + case "networkSecurityPerimeters": + err = unpopulate(val, "NetworkSecurityPerimeters", &n.NetworkSecurityPerimeters) + delete(rawMsg, key) + case "subscriptions": + err = unpopulate(val, "Subscriptions", &n.Subscriptions) delete(rawMsg, key) } if err != nil { @@ -10949,545 +12095,685 @@ func (n *NetworkIsolationSettings) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type Operation. -func (o Operation) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type NSPConfigAssociation. +func (n NSPConfigAssociation) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "display", o.Display) - populate(objectMap, "name", o.Name) - populate(objectMap, "origin", o.Origin) - populate(objectMap, "properties", o.Properties) + populate(objectMap, "accessMode", n.AccessMode) + populate(objectMap, "name", n.Name) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type Operation. -func (o *Operation) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type NSPConfigAssociation. +func (n *NSPConfigAssociation) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) + return fmt.Errorf("unmarshalling type %T: %v", n, err) } for key, val := range rawMsg { var err error switch key { - case "display": - err = unpopulate(val, "Display", &o.Display) + case "accessMode": + err = unpopulate(val, "AccessMode", &n.AccessMode) delete(rawMsg, key) case "name": - err = unpopulate(val, "Name", &o.Name) - delete(rawMsg, key) - case "origin": - err = unpopulate(val, "Origin", &o.Origin) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &o.Properties) + err = unpopulate(val, "Name", &n.Name) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) + return fmt.Errorf("unmarshalling type %T: %v", n, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type OperationDisplay. -func (o OperationDisplay) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type NSPConfigNetworkSecurityPerimeterRule. +func (n NSPConfigNetworkSecurityPerimeterRule) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "description", o.Description) - populate(objectMap, "operation", o.Operation) - populate(objectMap, "provider", o.Provider) - populate(objectMap, "resource", o.Resource) + populate(objectMap, "id", n.ID) + populate(objectMap, "location", n.Location) + populate(objectMap, "perimeterGuid", n.PerimeterGUID) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type OperationDisplay. -func (o *OperationDisplay) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type NSPConfigNetworkSecurityPerimeterRule. +func (n *NSPConfigNetworkSecurityPerimeterRule) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) + return fmt.Errorf("unmarshalling type %T: %v", n, err) } for key, val := range rawMsg { var err error switch key { - case "description": - err = unpopulate(val, "Description", &o.Description) - delete(rawMsg, key) - case "operation": - err = unpopulate(val, "Operation", &o.Operation) + case "id": + err = unpopulate(val, "ID", &n.ID) delete(rawMsg, key) - case "provider": - err = unpopulate(val, "Provider", &o.Provider) + case "location": + err = unpopulate(val, "Location", &n.Location) delete(rawMsg, key) - case "resource": - err = unpopulate(val, "Resource", &o.Resource) + case "perimeterGuid": + err = unpopulate(val, "PerimeterGUID", &n.PerimeterGUID) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) + return fmt.Errorf("unmarshalling type %T: %v", n, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type OperationImpact. -func (o OperationImpact) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type NSPConfigPerimeter. +func (n NSPConfigPerimeter) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "changeValueAbsolute", o.ChangeValueAbsolute) - populate(objectMap, "changeValueRelative", o.ChangeValueRelative) - populate(objectMap, "name", o.Name) - populate(objectMap, "unit", o.Unit) + populate(objectMap, "id", n.ID) + populate(objectMap, "location", n.Location) + populate(objectMap, "perimeterGuid", n.PerimeterGUID) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type OperationImpact. -func (o *OperationImpact) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type NSPConfigPerimeter. +func (n *NSPConfigPerimeter) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) + return fmt.Errorf("unmarshalling type %T: %v", n, err) } for key, val := range rawMsg { var err error switch key { - case "changeValueAbsolute": - err = unpopulate(val, "ChangeValueAbsolute", &o.ChangeValueAbsolute) - delete(rawMsg, key) - case "changeValueRelative": - err = unpopulate(val, "ChangeValueRelative", &o.ChangeValueRelative) + case "id": + err = unpopulate(val, "ID", &n.ID) delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &o.Name) + case "location": + err = unpopulate(val, "Location", &n.Location) delete(rawMsg, key) - case "unit": - err = unpopulate(val, "Unit", &o.Unit) + case "perimeterGuid": + err = unpopulate(val, "PerimeterGUID", &n.PerimeterGUID) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) + return fmt.Errorf("unmarshalling type %T: %v", n, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type OperationListResult. -func (o OperationListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type NSPConfigProfile. +func (n NSPConfigProfile) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", o.NextLink) - populate(objectMap, "value", o.Value) + populate(objectMap, "accessRules", n.AccessRules) + populate(objectMap, "accessRulesVersion", n.AccessRulesVersion) + populate(objectMap, "name", n.Name) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type OperationListResult. -func (o *OperationListResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type NSPConfigProfile. +func (n *NSPConfigProfile) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) + return fmt.Errorf("unmarshalling type %T: %v", n, err) } for key, val := range rawMsg { var err error switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &o.NextLink) + case "accessRules": + err = unpopulate(val, "AccessRules", &n.AccessRules) delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &o.Value) + case "accessRulesVersion": + err = unpopulate(val, "AccessRulesVersion", &n.AccessRulesVersion) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &n.Name) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) + return fmt.Errorf("unmarshalling type %T: %v", n, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type OutboundFirewallRule. -func (o OutboundFirewallRule) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type NSPProvisioningIssue. +func (n NSPProvisioningIssue) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", o.ID) - populate(objectMap, "name", o.Name) - populate(objectMap, "properties", o.Properties) - populate(objectMap, "type", o.Type) + populate(objectMap, "name", n.Name) + populate(objectMap, "properties", n.Properties) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type OutboundFirewallRule. -func (o *OutboundFirewallRule) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type NSPProvisioningIssue. +func (n *NSPProvisioningIssue) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) + return fmt.Errorf("unmarshalling type %T: %v", n, err) } for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &o.ID) - delete(rawMsg, key) case "name": - err = unpopulate(val, "Name", &o.Name) + err = unpopulate(val, "Name", &n.Name) delete(rawMsg, key) case "properties": - err = unpopulate(val, "Properties", &o.Properties) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &o.Type) + err = unpopulate(val, "Properties", &n.Properties) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) + return fmt.Errorf("unmarshalling type %T: %v", n, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type OutboundFirewallRuleListResult. -func (o OutboundFirewallRuleListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type NSPProvisioningIssueProperties. +func (n NSPProvisioningIssueProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", o.NextLink) - populate(objectMap, "value", o.Value) + populate(objectMap, "description", n.Description) + populate(objectMap, "issueType", n.IssueType) + populate(objectMap, "severity", n.Severity) + populate(objectMap, "suggestedAccessRules", n.SuggestedAccessRules) + populate(objectMap, "suggestedResourceIds", n.SuggestedResourceIDs) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type OutboundFirewallRuleListResult. -func (o *OutboundFirewallRuleListResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type NSPProvisioningIssueProperties. +func (n *NSPProvisioningIssueProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) + return fmt.Errorf("unmarshalling type %T: %v", n, err) } for key, val := range rawMsg { var err error switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &o.NextLink) + case "description": + err = unpopulate(val, "Description", &n.Description) delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &o.Value) + case "issueType": + err = unpopulate(val, "IssueType", &n.IssueType) + delete(rawMsg, key) + case "severity": + err = unpopulate(val, "Severity", &n.Severity) + delete(rawMsg, key) + case "suggestedAccessRules": + err = unpopulate(val, "SuggestedAccessRules", &n.SuggestedAccessRules) + delete(rawMsg, key) + case "suggestedResourceIds": + err = unpopulate(val, "SuggestedResourceIDs", &n.SuggestedResourceIDs) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) + return fmt.Errorf("unmarshalling type %T: %v", n, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type OutboundFirewallRuleProperties. -func (o OutboundFirewallRuleProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type Name. +func (n Name) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "provisioningState", o.ProvisioningState) + populate(objectMap, "localizedValue", n.LocalizedValue) + populate(objectMap, "value", n.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type OutboundFirewallRuleProperties. -func (o *OutboundFirewallRuleProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type Name. +func (n *Name) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) + return fmt.Errorf("unmarshalling type %T: %v", n, err) } for key, val := range rawMsg { var err error switch key { - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &o.ProvisioningState) + case "localizedValue": + err = unpopulate(val, "LocalizedValue", &n.LocalizedValue) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &n.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) + return fmt.Errorf("unmarshalling type %T: %v", n, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type PartnerInfo. -func (p PartnerInfo) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type NetworkIsolationSettings. +func (n NetworkIsolationSettings) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", p.ID) - populate(objectMap, "location", p.Location) - populate(objectMap, "replicationRole", p.ReplicationRole) + populate(objectMap, "sqlServerResourceId", n.SQLServerResourceID) + populate(objectMap, "storageAccountResourceId", n.StorageAccountResourceID) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type PartnerInfo. -func (p *PartnerInfo) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type NetworkIsolationSettings. +func (n *NetworkIsolationSettings) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", n, err) } for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &p.ID) - delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &p.Location) + case "sqlServerResourceId": + err = unpopulate(val, "SQLServerResourceID", &n.SQLServerResourceID) delete(rawMsg, key) - case "replicationRole": - err = unpopulate(val, "ReplicationRole", &p.ReplicationRole) + case "storageAccountResourceId": + err = unpopulate(val, "StorageAccountResourceID", &n.StorageAccountResourceID) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", n, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type PartnerRegionInfo. -func (p PartnerRegionInfo) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type NetworkSecurityPerimeterConfiguration. +func (n NetworkSecurityPerimeterConfiguration) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "location", p.Location) - populate(objectMap, "replicationRole", p.ReplicationRole) + populate(objectMap, "id", n.ID) + populate(objectMap, "name", n.Name) + populate(objectMap, "properties", n.Properties) + populate(objectMap, "type", n.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type PartnerRegionInfo. -func (p *PartnerRegionInfo) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type NetworkSecurityPerimeterConfiguration. +func (n *NetworkSecurityPerimeterConfiguration) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", n, err) } for key, val := range rawMsg { var err error switch key { - case "location": - err = unpopulate(val, "Location", &p.Location) + case "id": + err = unpopulate(val, "ID", &n.ID) delete(rawMsg, key) - case "replicationRole": - err = unpopulate(val, "ReplicationRole", &p.ReplicationRole) + case "name": + err = unpopulate(val, "Name", &n.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &n.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &n.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", n, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type PerformanceLevelCapability. -func (p PerformanceLevelCapability) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type NetworkSecurityPerimeterConfigurationListResult. +func (n NetworkSecurityPerimeterConfigurationListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "unit", p.Unit) - populate(objectMap, "value", p.Value) + populate(objectMap, "nextLink", n.NextLink) + populate(objectMap, "value", n.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type PerformanceLevelCapability. -func (p *PerformanceLevelCapability) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type NetworkSecurityPerimeterConfigurationListResult. +func (n *NetworkSecurityPerimeterConfigurationListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", n, err) } for key, val := range rawMsg { var err error switch key { - case "unit": - err = unpopulate(val, "Unit", &p.Unit) + case "nextLink": + err = unpopulate(val, "NextLink", &n.NextLink) delete(rawMsg, key) case "value": - err = unpopulate(val, "Value", &p.Value) + err = unpopulate(val, "Value", &n.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", n, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnection. -func (p PrivateEndpointConnection) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type NetworkSecurityPerimeterConfigurationProperties. +func (n NetworkSecurityPerimeterConfigurationProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", p.ID) - populate(objectMap, "name", p.Name) - populate(objectMap, "properties", p.Properties) - populate(objectMap, "type", p.Type) + populate(objectMap, "networkSecurityPerimeter", n.NetworkSecurityPerimeter) + populate(objectMap, "profile", n.Profile) + populate(objectMap, "provisioningIssues", n.ProvisioningIssues) + populate(objectMap, "provisioningState", n.ProvisioningState) + populate(objectMap, "resourceAssociation", n.ResourceAssociation) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnection. -func (p *PrivateEndpointConnection) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type NetworkSecurityPerimeterConfigurationProperties. +func (n *NetworkSecurityPerimeterConfigurationProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", n, err) } for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &p.ID) + case "networkSecurityPerimeter": + err = unpopulate(val, "NetworkSecurityPerimeter", &n.NetworkSecurityPerimeter) delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &p.Name) + case "profile": + err = unpopulate(val, "Profile", &n.Profile) delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &p.Properties) + case "provisioningIssues": + err = unpopulate(val, "ProvisioningIssues", &n.ProvisioningIssues) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &p.Type) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &n.ProvisioningState) + delete(rawMsg, key) + case "resourceAssociation": + err = unpopulate(val, "ResourceAssociation", &n.ResourceAssociation) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", n, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnectionListResult. -func (p PrivateEndpointConnectionListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type Operation. +func (o Operation) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", p.NextLink) - populate(objectMap, "value", p.Value) + populate(objectMap, "display", o.Display) + populate(objectMap, "name", o.Name) + populate(objectMap, "origin", o.Origin) + populate(objectMap, "properties", o.Properties) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnectionListResult. -func (p *PrivateEndpointConnectionListResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type Operation. +func (o *Operation) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", o, err) } for key, val := range rawMsg { var err error switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &p.NextLink) + case "display": + err = unpopulate(val, "Display", &o.Display) delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &p.Value) + case "name": + err = unpopulate(val, "Name", &o.Name) + delete(rawMsg, key) + case "origin": + err = unpopulate(val, "Origin", &o.Origin) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &o.Properties) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", o, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnectionProperties. -func (p PrivateEndpointConnectionProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type OperationDisplay. +func (o OperationDisplay) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "privateEndpoint", p.PrivateEndpoint) - populate(objectMap, "privateLinkServiceConnectionState", p.PrivateLinkServiceConnectionState) - populate(objectMap, "provisioningState", p.ProvisioningState) + populate(objectMap, "description", o.Description) + populate(objectMap, "operation", o.Operation) + populate(objectMap, "provider", o.Provider) + populate(objectMap, "resource", o.Resource) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnectionProperties. -func (p *PrivateEndpointConnectionProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationDisplay. +func (o *OperationDisplay) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", o, err) } for key, val := range rawMsg { var err error switch key { - case "privateEndpoint": - err = unpopulate(val, "PrivateEndpoint", &p.PrivateEndpoint) + case "description": + err = unpopulate(val, "Description", &o.Description) delete(rawMsg, key) - case "privateLinkServiceConnectionState": - err = unpopulate(val, "PrivateLinkServiceConnectionState", &p.PrivateLinkServiceConnectionState) + case "operation": + err = unpopulate(val, "Operation", &o.Operation) delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &p.ProvisioningState) + case "provider": + err = unpopulate(val, "Provider", &o.Provider) + delete(rawMsg, key) + case "resource": + err = unpopulate(val, "Resource", &o.Resource) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", o, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnectionRequestStatus. -func (p PrivateEndpointConnectionRequestStatus) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type OperationListResult. +func (o OperationListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "privateEndpointConnectionName", p.PrivateEndpointConnectionName) - populate(objectMap, "privateLinkServiceId", p.PrivateLinkServiceID) - populate(objectMap, "status", p.Status) + populate(objectMap, "nextLink", o.NextLink) + populate(objectMap, "value", o.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnectionRequestStatus. -func (p *PrivateEndpointConnectionRequestStatus) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationListResult. +func (o *OperationListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", o, err) } for key, val := range rawMsg { var err error switch key { - case "privateEndpointConnectionName": - err = unpopulate(val, "PrivateEndpointConnectionName", &p.PrivateEndpointConnectionName) - delete(rawMsg, key) - case "privateLinkServiceId": - err = unpopulate(val, "PrivateLinkServiceID", &p.PrivateLinkServiceID) + case "nextLink": + err = unpopulate(val, "NextLink", &o.NextLink) delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &p.Status) + case "value": + err = unpopulate(val, "Value", &o.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", o, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointProperty. -func (p PrivateEndpointProperty) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type OutboundEnvironmentEndpoint. +func (o OutboundEnvironmentEndpoint) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", p.ID) + populate(objectMap, "category", o.Category) + populate(objectMap, "endpoints", o.Endpoints) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointProperty. -func (p *PrivateEndpointProperty) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type OutboundEnvironmentEndpoint. +func (o *OutboundEnvironmentEndpoint) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", o, err) } for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &p.ID) + case "category": + err = unpopulate(val, "Category", &o.Category) + delete(rawMsg, key) + case "endpoints": + err = unpopulate(val, "Endpoints", &o.Endpoints) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", o, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type PrivateLinkResource. -func (p PrivateLinkResource) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type OutboundEnvironmentEndpointCollection. +func (o OutboundEnvironmentEndpointCollection) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", p.ID) - populate(objectMap, "name", p.Name) - populate(objectMap, "properties", p.Properties) - populate(objectMap, "type", p.Type) + populate(objectMap, "nextLink", o.NextLink) + populate(objectMap, "value", o.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkResource. -func (p *PrivateLinkResource) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type OutboundEnvironmentEndpointCollection. +func (o *OutboundEnvironmentEndpointCollection) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &o.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &o.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OutboundFirewallRule. +func (o OutboundFirewallRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", o.ID) + populate(objectMap, "name", o.Name) + populate(objectMap, "properties", o.Properties) + populate(objectMap, "type", o.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OutboundFirewallRule. +func (o *OutboundFirewallRule) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) } for key, val := range rawMsg { var err error switch key { case "id": - err = unpopulate(val, "ID", &p.ID) + err = unpopulate(val, "ID", &o.ID) delete(rawMsg, key) case "name": - err = unpopulate(val, "Name", &p.Name) + err = unpopulate(val, "Name", &o.Name) delete(rawMsg, key) case "properties": - err = unpopulate(val, "Properties", &p.Properties) + err = unpopulate(val, "Properties", &o.Properties) delete(rawMsg, key) case "type": - err = unpopulate(val, "Type", &p.Type) + err = unpopulate(val, "Type", &o.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OutboundFirewallRuleListResult. +func (o OutboundFirewallRuleListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", o.NextLink) + populate(objectMap, "value", o.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OutboundFirewallRuleListResult. +func (o *OutboundFirewallRuleListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &o.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &o.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OutboundFirewallRuleProperties. +func (o OutboundFirewallRuleProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "provisioningState", o.ProvisioningState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OutboundFirewallRuleProperties. +func (o *OutboundFirewallRuleProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &o.ProvisioningState) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PartnerInfo. +func (p PartnerInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", p.ID) + populate(objectMap, "location", p.Location) + populate(objectMap, "replicationRole", p.ReplicationRole) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PartnerInfo. +func (p *PartnerInfo) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &p.Location) + delete(rawMsg, key) + case "replicationRole": + err = unpopulate(val, "ReplicationRole", &p.ReplicationRole) delete(rawMsg, key) } if err != nil { @@ -11497,16 +12783,47 @@ func (p *PrivateLinkResource) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type PrivateLinkResourceListResult. -func (p PrivateLinkResourceListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type PartnerRegionInfo. +func (p PartnerRegionInfo) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", p.NextLink) + populate(objectMap, "location", p.Location) + populate(objectMap, "replicationRole", p.ReplicationRole) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PartnerRegionInfo. +func (p *PartnerRegionInfo) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "location": + err = unpopulate(val, "Location", &p.Location) + delete(rawMsg, key) + case "replicationRole": + err = unpopulate(val, "ReplicationRole", &p.ReplicationRole) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PerformanceLevelCapability. +func (p PerformanceLevelCapability) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "unit", p.Unit) populate(objectMap, "value", p.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkResourceListResult. -func (p *PrivateLinkResourceListResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type PerformanceLevelCapability. +func (p *PerformanceLevelCapability) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", p, err) @@ -11514,8 +12831,8 @@ func (p *PrivateLinkResourceListResult) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &p.NextLink) + case "unit": + err = unpopulate(val, "Unit", &p.Unit) delete(rawMsg, key) case "value": err = unpopulate(val, "Value", &p.Value) @@ -11528,17 +12845,16 @@ func (p *PrivateLinkResourceListResult) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type PrivateLinkResourceProperties. -func (p PrivateLinkResourceProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type PhaseDetails. +func (p PhaseDetails) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "groupId", p.GroupID) - populate(objectMap, "requiredMembers", p.RequiredMembers) - populate(objectMap, "requiredZoneNames", p.RequiredZoneNames) + populate(objectMap, "phase", p.Phase) + populate(objectMap, "phaseInformation", p.PhaseInformation) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkResourceProperties. -func (p *PrivateLinkResourceProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type PhaseDetails. +func (p *PhaseDetails) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", p, err) @@ -11546,14 +12862,11 @@ func (p *PrivateLinkResourceProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "groupId": - err = unpopulate(val, "GroupID", &p.GroupID) + case "phase": + err = unpopulate(val, "Phase", &p.Phase) delete(rawMsg, key) - case "requiredMembers": - err = unpopulate(val, "RequiredMembers", &p.RequiredMembers) - delete(rawMsg, key) - case "requiredZoneNames": - err = unpopulate(val, "RequiredZoneNames", &p.RequiredZoneNames) + case "phaseInformation": + err = unpopulate(val, "PhaseInformation", &p.PhaseInformation) delete(rawMsg, key) } if err != nil { @@ -11563,17 +12876,18 @@ func (p *PrivateLinkResourceProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type PrivateLinkServiceConnectionStateProperty. -func (p PrivateLinkServiceConnectionStateProperty) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnection. +func (p PrivateEndpointConnection) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "actionsRequired", p.ActionsRequired) - populate(objectMap, "description", p.Description) - populate(objectMap, "status", p.Status) + populate(objectMap, "id", p.ID) + populate(objectMap, "name", p.Name) + populate(objectMap, "properties", p.Properties) + populate(objectMap, "type", p.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkServiceConnectionStateProperty. -func (p *PrivateLinkServiceConnectionStateProperty) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnection. +func (p *PrivateEndpointConnection) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", p, err) @@ -11581,311 +12895,1144 @@ func (p *PrivateLinkServiceConnectionStateProperty) UnmarshalJSON(data []byte) e for key, val := range rawMsg { var err error switch key { - case "actionsRequired": - err = unpopulate(val, "ActionsRequired", &p.ActionsRequired) + case "id": + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &p.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &p.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnectionListResult. +func (p PrivateEndpointConnectionListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", p.NextLink) + populate(objectMap, "value", p.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnectionListResult. +func (p *PrivateEndpointConnectionListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &p.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &p.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnectionProperties. +func (p PrivateEndpointConnectionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "groupIds", p.GroupIDs) + populate(objectMap, "privateEndpoint", p.PrivateEndpoint) + populate(objectMap, "privateLinkServiceConnectionState", p.PrivateLinkServiceConnectionState) + populate(objectMap, "provisioningState", p.ProvisioningState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnectionProperties. +func (p *PrivateEndpointConnectionProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "groupIds": + err = unpopulate(val, "GroupIDs", &p.GroupIDs) + delete(rawMsg, key) + case "privateEndpoint": + err = unpopulate(val, "PrivateEndpoint", &p.PrivateEndpoint) + delete(rawMsg, key) + case "privateLinkServiceConnectionState": + err = unpopulate(val, "PrivateLinkServiceConnectionState", &p.PrivateLinkServiceConnectionState) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &p.ProvisioningState) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnectionRequestStatus. +func (p PrivateEndpointConnectionRequestStatus) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "privateEndpointConnectionName", p.PrivateEndpointConnectionName) + populate(objectMap, "privateLinkServiceId", p.PrivateLinkServiceID) + populate(objectMap, "status", p.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnectionRequestStatus. +func (p *PrivateEndpointConnectionRequestStatus) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "privateEndpointConnectionName": + err = unpopulate(val, "PrivateEndpointConnectionName", &p.PrivateEndpointConnectionName) + delete(rawMsg, key) + case "privateLinkServiceId": + err = unpopulate(val, "PrivateLinkServiceID", &p.PrivateLinkServiceID) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &p.Status) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointProperty. +func (p PrivateEndpointProperty) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", p.ID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointProperty. +func (p *PrivateEndpointProperty) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateLinkResource. +func (p PrivateLinkResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", p.ID) + populate(objectMap, "name", p.Name) + populate(objectMap, "properties", p.Properties) + populate(objectMap, "type", p.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkResource. +func (p *PrivateLinkResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &p.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &p.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateLinkResourceListResult. +func (p PrivateLinkResourceListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", p.NextLink) + populate(objectMap, "value", p.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkResourceListResult. +func (p *PrivateLinkResourceListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &p.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &p.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateLinkResourceProperties. +func (p PrivateLinkResourceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "groupId", p.GroupID) + populate(objectMap, "requiredMembers", p.RequiredMembers) + populate(objectMap, "requiredZoneNames", p.RequiredZoneNames) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkResourceProperties. +func (p *PrivateLinkResourceProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "groupId": + err = unpopulate(val, "GroupID", &p.GroupID) + delete(rawMsg, key) + case "requiredMembers": + err = unpopulate(val, "RequiredMembers", &p.RequiredMembers) + delete(rawMsg, key) + case "requiredZoneNames": + err = unpopulate(val, "RequiredZoneNames", &p.RequiredZoneNames) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateLinkServiceConnectionStateProperty. +func (p PrivateLinkServiceConnectionStateProperty) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "actionsRequired", p.ActionsRequired) + populate(objectMap, "description", p.Description) + populate(objectMap, "status", p.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkServiceConnectionStateProperty. +func (p *PrivateLinkServiceConnectionStateProperty) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "actionsRequired": + err = unpopulate(val, "ActionsRequired", &p.ActionsRequired) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &p.Description) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &p.Status) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ProxyResource. +func (p ProxyResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", p.ID) + populate(objectMap, "name", p.Name) + populate(objectMap, "type", p.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ProxyResource. +func (p *ProxyResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &p.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ProxyResourceWithWritableName. +func (p ProxyResourceWithWritableName) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", p.ID) + populate(objectMap, "name", p.Name) + populate(objectMap, "type", p.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ProxyResourceWithWritableName. +func (p *ProxyResourceWithWritableName) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &p.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type QueryCheck. +func (q QueryCheck) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "columnNames", q.ColumnNames) + populate(objectMap, "expectedResult", q.ExpectedResult) + populate(objectMap, "query", q.Query) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type QueryCheck. +func (q *QueryCheck) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", q, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "columnNames": + err = unpopulate(val, "ColumnNames", &q.ColumnNames) + delete(rawMsg, key) + case "expectedResult": + err = unpopulate(val, "ExpectedResult", &q.ExpectedResult) + delete(rawMsg, key) + case "query": + err = unpopulate(val, "Query", &q.Query) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", q, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type QueryMetricInterval. +func (q QueryMetricInterval) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "executionCount", q.ExecutionCount) + populate(objectMap, "intervalStartTime", q.IntervalStartTime) + populate(objectMap, "intervalType", q.IntervalType) + populate(objectMap, "metrics", q.Metrics) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type QueryMetricInterval. +func (q *QueryMetricInterval) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", q, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "executionCount": + err = unpopulate(val, "ExecutionCount", &q.ExecutionCount) + delete(rawMsg, key) + case "intervalStartTime": + err = unpopulate(val, "IntervalStartTime", &q.IntervalStartTime) + delete(rawMsg, key) + case "intervalType": + err = unpopulate(val, "IntervalType", &q.IntervalType) + delete(rawMsg, key) + case "metrics": + err = unpopulate(val, "Metrics", &q.Metrics) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", q, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type QueryMetricProperties. +func (q QueryMetricProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "avg", q.Avg) + populate(objectMap, "displayName", q.DisplayName) + populate(objectMap, "max", q.Max) + populate(objectMap, "min", q.Min) + populate(objectMap, "name", q.Name) + populate(objectMap, "stdev", q.Stdev) + populate(objectMap, "sum", q.Sum) + populate(objectMap, "unit", q.Unit) + populate(objectMap, "value", q.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type QueryMetricProperties. +func (q *QueryMetricProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", q, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "avg": + err = unpopulate(val, "Avg", &q.Avg) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &q.DisplayName) + delete(rawMsg, key) + case "max": + err = unpopulate(val, "Max", &q.Max) + delete(rawMsg, key) + case "min": + err = unpopulate(val, "Min", &q.Min) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &q.Name) + delete(rawMsg, key) + case "stdev": + err = unpopulate(val, "Stdev", &q.Stdev) + delete(rawMsg, key) + case "sum": + err = unpopulate(val, "Sum", &q.Sum) + delete(rawMsg, key) + case "unit": + err = unpopulate(val, "Unit", &q.Unit) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &q.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", q, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type QueryProperties. +func (q QueryProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "queryText", q.QueryText) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type QueryProperties. +func (q *QueryProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", q, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "queryText": + err = unpopulate(val, "QueryText", &q.QueryText) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", q, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type QueryStatistics. +func (q QueryStatistics) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", q.ID) + populate(objectMap, "name", q.Name) + populate(objectMap, "properties", q.Properties) + populate(objectMap, "type", q.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type QueryStatistics. +func (q *QueryStatistics) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", q, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &q.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &q.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &q.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &q.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", q, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type QueryStatisticsProperties. +func (q QueryStatisticsProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "databaseName", q.DatabaseName) + populate(objectMap, "endTime", q.EndTime) + populate(objectMap, "intervals", q.Intervals) + populate(objectMap, "queryId", q.QueryID) + populate(objectMap, "startTime", q.StartTime) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type QueryStatisticsProperties. +func (q *QueryStatisticsProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", q, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "databaseName": + err = unpopulate(val, "DatabaseName", &q.DatabaseName) + delete(rawMsg, key) + case "endTime": + err = unpopulate(val, "EndTime", &q.EndTime) + delete(rawMsg, key) + case "intervals": + err = unpopulate(val, "Intervals", &q.Intervals) + delete(rawMsg, key) + case "queryId": + err = unpopulate(val, "QueryID", &q.QueryID) + delete(rawMsg, key) + case "startTime": + err = unpopulate(val, "StartTime", &q.StartTime) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", q, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ReadScaleCapability. +func (r ReadScaleCapability) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "maxNumberOfReplicas", r.MaxNumberOfReplicas) + populate(objectMap, "reason", r.Reason) + populate(objectMap, "status", r.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ReadScaleCapability. +func (r *ReadScaleCapability) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "maxNumberOfReplicas": + err = unpopulate(val, "MaxNumberOfReplicas", &r.MaxNumberOfReplicas) + delete(rawMsg, key) + case "reason": + err = unpopulate(val, "Reason", &r.Reason) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &r.Status) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RecommendedAction. +func (r RecommendedAction) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", r.ID) + populate(objectMap, "kind", r.Kind) + populate(objectMap, "location", r.Location) + populate(objectMap, "name", r.Name) + populate(objectMap, "properties", r.Properties) + populate(objectMap, "type", r.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RecommendedAction. +func (r *RecommendedAction) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &r.ID) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &r.Kind) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &r.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &r.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &r.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &r.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RecommendedActionErrorInfo. +func (r RecommendedActionErrorInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "errorCode", r.ErrorCode) + populate(objectMap, "isRetryable", r.IsRetryable) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RecommendedActionErrorInfo. +func (r *RecommendedActionErrorInfo) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "errorCode": + err = unpopulate(val, "ErrorCode", &r.ErrorCode) + delete(rawMsg, key) + case "isRetryable": + err = unpopulate(val, "IsRetryable", &r.IsRetryable) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RecommendedActionImpactRecord. +func (r RecommendedActionImpactRecord) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "absoluteValue", r.AbsoluteValue) + populate(objectMap, "changeValueAbsolute", r.ChangeValueAbsolute) + populate(objectMap, "changeValueRelative", r.ChangeValueRelative) + populate(objectMap, "dimensionName", r.DimensionName) + populate(objectMap, "unit", r.Unit) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RecommendedActionImpactRecord. +func (r *RecommendedActionImpactRecord) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "absoluteValue": + err = unpopulate(val, "AbsoluteValue", &r.AbsoluteValue) + delete(rawMsg, key) + case "changeValueAbsolute": + err = unpopulate(val, "ChangeValueAbsolute", &r.ChangeValueAbsolute) + delete(rawMsg, key) + case "changeValueRelative": + err = unpopulate(val, "ChangeValueRelative", &r.ChangeValueRelative) + delete(rawMsg, key) + case "dimensionName": + err = unpopulate(val, "DimensionName", &r.DimensionName) + delete(rawMsg, key) + case "unit": + err = unpopulate(val, "Unit", &r.Unit) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RecommendedActionImplementationInfo. +func (r RecommendedActionImplementationInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "method", r.Method) + populate(objectMap, "script", r.Script) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RecommendedActionImplementationInfo. +func (r *RecommendedActionImplementationInfo) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "method": + err = unpopulate(val, "Method", &r.Method) + delete(rawMsg, key) + case "script": + err = unpopulate(val, "Script", &r.Script) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RecommendedActionMetricInfo. +func (r RecommendedActionMetricInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "metricName", r.MetricName) + populateTimeRFC3339(objectMap, "startTime", r.StartTime) + populate(objectMap, "timeGrain", r.TimeGrain) + populate(objectMap, "unit", r.Unit) + populate(objectMap, "value", r.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RecommendedActionMetricInfo. +func (r *RecommendedActionMetricInfo) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "metricName": + err = unpopulate(val, "MetricName", &r.MetricName) + delete(rawMsg, key) + case "startTime": + err = unpopulateTimeRFC3339(val, "StartTime", &r.StartTime) + delete(rawMsg, key) + case "timeGrain": + err = unpopulate(val, "TimeGrain", &r.TimeGrain) + delete(rawMsg, key) + case "unit": + err = unpopulate(val, "Unit", &r.Unit) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &r.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RecommendedActionProperties. +func (r RecommendedActionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "details", r.Details) + populate(objectMap, "errorDetails", r.ErrorDetails) + populate(objectMap, "estimatedImpact", r.EstimatedImpact) + populate(objectMap, "executeActionDuration", r.ExecuteActionDuration) + populate(objectMap, "executeActionInitiatedBy", r.ExecuteActionInitiatedBy) + populateTimeRFC3339(objectMap, "executeActionInitiatedTime", r.ExecuteActionInitiatedTime) + populateTimeRFC3339(objectMap, "executeActionStartTime", r.ExecuteActionStartTime) + populate(objectMap, "implementationDetails", r.ImplementationDetails) + populate(objectMap, "isArchivedAction", r.IsArchivedAction) + populate(objectMap, "isExecutableAction", r.IsExecutableAction) + populate(objectMap, "isRevertableAction", r.IsRevertableAction) + populateTimeRFC3339(objectMap, "lastRefresh", r.LastRefresh) + populate(objectMap, "linkedObjects", r.LinkedObjects) + populate(objectMap, "observedImpact", r.ObservedImpact) + populate(objectMap, "recommendationReason", r.RecommendationReason) + populate(objectMap, "revertActionDuration", r.RevertActionDuration) + populate(objectMap, "revertActionInitiatedBy", r.RevertActionInitiatedBy) + populateTimeRFC3339(objectMap, "revertActionInitiatedTime", r.RevertActionInitiatedTime) + populateTimeRFC3339(objectMap, "revertActionStartTime", r.RevertActionStartTime) + populate(objectMap, "score", r.Score) + populate(objectMap, "state", r.State) + populate(objectMap, "timeSeries", r.TimeSeries) + populateTimeRFC3339(objectMap, "validSince", r.ValidSince) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RecommendedActionProperties. +func (r *RecommendedActionProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "details": + err = unpopulate(val, "Details", &r.Details) + delete(rawMsg, key) + case "errorDetails": + err = unpopulate(val, "ErrorDetails", &r.ErrorDetails) + delete(rawMsg, key) + case "estimatedImpact": + err = unpopulate(val, "EstimatedImpact", &r.EstimatedImpact) + delete(rawMsg, key) + case "executeActionDuration": + err = unpopulate(val, "ExecuteActionDuration", &r.ExecuteActionDuration) + delete(rawMsg, key) + case "executeActionInitiatedBy": + err = unpopulate(val, "ExecuteActionInitiatedBy", &r.ExecuteActionInitiatedBy) + delete(rawMsg, key) + case "executeActionInitiatedTime": + err = unpopulateTimeRFC3339(val, "ExecuteActionInitiatedTime", &r.ExecuteActionInitiatedTime) + delete(rawMsg, key) + case "executeActionStartTime": + err = unpopulateTimeRFC3339(val, "ExecuteActionStartTime", &r.ExecuteActionStartTime) + delete(rawMsg, key) + case "implementationDetails": + err = unpopulate(val, "ImplementationDetails", &r.ImplementationDetails) + delete(rawMsg, key) + case "isArchivedAction": + err = unpopulate(val, "IsArchivedAction", &r.IsArchivedAction) + delete(rawMsg, key) + case "isExecutableAction": + err = unpopulate(val, "IsExecutableAction", &r.IsExecutableAction) + delete(rawMsg, key) + case "isRevertableAction": + err = unpopulate(val, "IsRevertableAction", &r.IsRevertableAction) + delete(rawMsg, key) + case "lastRefresh": + err = unpopulateTimeRFC3339(val, "LastRefresh", &r.LastRefresh) + delete(rawMsg, key) + case "linkedObjects": + err = unpopulate(val, "LinkedObjects", &r.LinkedObjects) + delete(rawMsg, key) + case "observedImpact": + err = unpopulate(val, "ObservedImpact", &r.ObservedImpact) + delete(rawMsg, key) + case "recommendationReason": + err = unpopulate(val, "RecommendationReason", &r.RecommendationReason) + delete(rawMsg, key) + case "revertActionDuration": + err = unpopulate(val, "RevertActionDuration", &r.RevertActionDuration) + delete(rawMsg, key) + case "revertActionInitiatedBy": + err = unpopulate(val, "RevertActionInitiatedBy", &r.RevertActionInitiatedBy) + delete(rawMsg, key) + case "revertActionInitiatedTime": + err = unpopulateTimeRFC3339(val, "RevertActionInitiatedTime", &r.RevertActionInitiatedTime) + delete(rawMsg, key) + case "revertActionStartTime": + err = unpopulateTimeRFC3339(val, "RevertActionStartTime", &r.RevertActionStartTime) + delete(rawMsg, key) + case "score": + err = unpopulate(val, "Score", &r.Score) + delete(rawMsg, key) + case "state": + err = unpopulate(val, "State", &r.State) delete(rawMsg, key) - case "description": - err = unpopulate(val, "Description", &p.Description) + case "timeSeries": + err = unpopulate(val, "TimeSeries", &r.TimeSeries) delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &p.Status) + case "validSince": + err = unpopulateTimeRFC3339(val, "ValidSince", &r.ValidSince) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", r, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ProxyResource. -func (p ProxyResource) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type RecommendedActionStateInfo. +func (r RecommendedActionStateInfo) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", p.ID) - populate(objectMap, "name", p.Name) - populate(objectMap, "type", p.Type) + populate(objectMap, "actionInitiatedBy", r.ActionInitiatedBy) + populate(objectMap, "currentValue", r.CurrentValue) + populateTimeRFC3339(objectMap, "lastModified", r.LastModified) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ProxyResource. -func (p *ProxyResource) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type RecommendedActionStateInfo. +func (r *RecommendedActionStateInfo) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", r, err) } for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &p.ID) + case "actionInitiatedBy": + err = unpopulate(val, "ActionInitiatedBy", &r.ActionInitiatedBy) delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &p.Name) + case "currentValue": + err = unpopulate(val, "CurrentValue", &r.CurrentValue) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &p.Type) + case "lastModified": + err = unpopulateTimeRFC3339(val, "LastModified", &r.LastModified) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", r, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ProxyResourceWithWritableName. -func (p ProxyResourceWithWritableName) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type RecommendedSensitivityLabelUpdate. +func (r RecommendedSensitivityLabelUpdate) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", p.ID) - populate(objectMap, "name", p.Name) - populate(objectMap, "type", p.Type) + populate(objectMap, "id", r.ID) + populate(objectMap, "name", r.Name) + populate(objectMap, "properties", r.Properties) + populate(objectMap, "type", r.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ProxyResourceWithWritableName. -func (p *ProxyResourceWithWritableName) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type RecommendedSensitivityLabelUpdate. +func (r *RecommendedSensitivityLabelUpdate) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", r, err) } for key, val := range rawMsg { var err error switch key { case "id": - err = unpopulate(val, "ID", &p.ID) + err = unpopulate(val, "ID", &r.ID) delete(rawMsg, key) case "name": - err = unpopulate(val, "Name", &p.Name) + err = unpopulate(val, "Name", &r.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &r.Properties) delete(rawMsg, key) case "type": - err = unpopulate(val, "Type", &p.Type) + err = unpopulate(val, "Type", &r.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", r, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type QueryMetricInterval. -func (q QueryMetricInterval) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type RecommendedSensitivityLabelUpdateList. +func (r RecommendedSensitivityLabelUpdateList) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "executionCount", q.ExecutionCount) - populate(objectMap, "intervalStartTime", q.IntervalStartTime) - populate(objectMap, "intervalType", q.IntervalType) - populate(objectMap, "metrics", q.Metrics) + populate(objectMap, "operations", r.Operations) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type QueryMetricInterval. -func (q *QueryMetricInterval) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type RecommendedSensitivityLabelUpdateList. +func (r *RecommendedSensitivityLabelUpdateList) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", q, err) + return fmt.Errorf("unmarshalling type %T: %v", r, err) } for key, val := range rawMsg { var err error switch key { - case "executionCount": - err = unpopulate(val, "ExecutionCount", &q.ExecutionCount) - delete(rawMsg, key) - case "intervalStartTime": - err = unpopulate(val, "IntervalStartTime", &q.IntervalStartTime) - delete(rawMsg, key) - case "intervalType": - err = unpopulate(val, "IntervalType", &q.IntervalType) - delete(rawMsg, key) - case "metrics": - err = unpopulate(val, "Metrics", &q.Metrics) + case "operations": + err = unpopulate(val, "Operations", &r.Operations) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", q, err) + return fmt.Errorf("unmarshalling type %T: %v", r, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type QueryMetricProperties. -func (q QueryMetricProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type RecommendedSensitivityLabelUpdateProperties. +func (r RecommendedSensitivityLabelUpdateProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "avg", q.Avg) - populate(objectMap, "displayName", q.DisplayName) - populate(objectMap, "max", q.Max) - populate(objectMap, "min", q.Min) - populate(objectMap, "name", q.Name) - populate(objectMap, "stdev", q.Stdev) - populate(objectMap, "sum", q.Sum) - populate(objectMap, "unit", q.Unit) - populate(objectMap, "value", q.Value) + populate(objectMap, "column", r.Column) + populate(objectMap, "op", r.Op) + populate(objectMap, "schema", r.Schema) + populate(objectMap, "table", r.Table) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type QueryMetricProperties. -func (q *QueryMetricProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type RecommendedSensitivityLabelUpdateProperties. +func (r *RecommendedSensitivityLabelUpdateProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", q, err) + return fmt.Errorf("unmarshalling type %T: %v", r, err) } for key, val := range rawMsg { var err error switch key { - case "avg": - err = unpopulate(val, "Avg", &q.Avg) - delete(rawMsg, key) - case "displayName": - err = unpopulate(val, "DisplayName", &q.DisplayName) - delete(rawMsg, key) - case "max": - err = unpopulate(val, "Max", &q.Max) - delete(rawMsg, key) - case "min": - err = unpopulate(val, "Min", &q.Min) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &q.Name) - delete(rawMsg, key) - case "stdev": - err = unpopulate(val, "Stdev", &q.Stdev) - delete(rawMsg, key) - case "sum": - err = unpopulate(val, "Sum", &q.Sum) + case "column": + err = unpopulate(val, "Column", &r.Column) delete(rawMsg, key) - case "unit": - err = unpopulate(val, "Unit", &q.Unit) + case "op": + err = unpopulate(val, "Op", &r.Op) delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &q.Value) + case "schema": + err = unpopulate(val, "Schema", &r.Schema) delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", q, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type QueryProperties. -func (q QueryProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "queryText", q.QueryText) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type QueryProperties. -func (q *QueryProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", q, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "queryText": - err = unpopulate(val, "QueryText", &q.QueryText) + case "table": + err = unpopulate(val, "Table", &r.Table) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", q, err) + return fmt.Errorf("unmarshalling type %T: %v", r, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type QueryStatistics. -func (q QueryStatistics) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type RecoverableDatabase. +func (r RecoverableDatabase) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", q.ID) - populate(objectMap, "name", q.Name) - populate(objectMap, "properties", q.Properties) - populate(objectMap, "type", q.Type) + populate(objectMap, "id", r.ID) + populate(objectMap, "name", r.Name) + populate(objectMap, "properties", r.Properties) + populate(objectMap, "type", r.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type QueryStatistics. -func (q *QueryStatistics) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type RecoverableDatabase. +func (r *RecoverableDatabase) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", q, err) + return fmt.Errorf("unmarshalling type %T: %v", r, err) } for key, val := range rawMsg { var err error switch key { case "id": - err = unpopulate(val, "ID", &q.ID) + err = unpopulate(val, "ID", &r.ID) delete(rawMsg, key) case "name": - err = unpopulate(val, "Name", &q.Name) + err = unpopulate(val, "Name", &r.Name) delete(rawMsg, key) case "properties": - err = unpopulate(val, "Properties", &q.Properties) + err = unpopulate(val, "Properties", &r.Properties) delete(rawMsg, key) case "type": - err = unpopulate(val, "Type", &q.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", q, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type QueryStatisticsProperties. -func (q QueryStatisticsProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "databaseName", q.DatabaseName) - populate(objectMap, "endTime", q.EndTime) - populate(objectMap, "intervals", q.Intervals) - populate(objectMap, "queryId", q.QueryID) - populate(objectMap, "startTime", q.StartTime) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type QueryStatisticsProperties. -func (q *QueryStatisticsProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", q, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "databaseName": - err = unpopulate(val, "DatabaseName", &q.DatabaseName) - delete(rawMsg, key) - case "endTime": - err = unpopulate(val, "EndTime", &q.EndTime) - delete(rawMsg, key) - case "intervals": - err = unpopulate(val, "Intervals", &q.Intervals) - delete(rawMsg, key) - case "queryId": - err = unpopulate(val, "QueryID", &q.QueryID) - delete(rawMsg, key) - case "startTime": - err = unpopulate(val, "StartTime", &q.StartTime) + err = unpopulate(val, "Type", &r.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", q, err) + return fmt.Errorf("unmarshalling type %T: %v", r, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ReadScaleCapability. -func (r ReadScaleCapability) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type RecoverableDatabaseListResult. +func (r RecoverableDatabaseListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "maxNumberOfReplicas", r.MaxNumberOfReplicas) - populate(objectMap, "reason", r.Reason) - populate(objectMap, "status", r.Status) + populate(objectMap, "nextLink", r.NextLink) + populate(objectMap, "value", r.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ReadScaleCapability. -func (r *ReadScaleCapability) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type RecoverableDatabaseListResult. +func (r *RecoverableDatabaseListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", r, err) @@ -11893,14 +14040,11 @@ func (r *ReadScaleCapability) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "maxNumberOfReplicas": - err = unpopulate(val, "MaxNumberOfReplicas", &r.MaxNumberOfReplicas) - delete(rawMsg, key) - case "reason": - err = unpopulate(val, "Reason", &r.Reason) + case "nextLink": + err = unpopulate(val, "NextLink", &r.NextLink) delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &r.Status) + case "value": + err = unpopulate(val, "Value", &r.Value) delete(rawMsg, key) } if err != nil { @@ -11910,20 +14054,19 @@ func (r *ReadScaleCapability) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type RecommendedAction. -func (r RecommendedAction) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type RecoverableDatabaseProperties. +func (r RecoverableDatabaseProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", r.ID) - populate(objectMap, "kind", r.Kind) - populate(objectMap, "location", r.Location) - populate(objectMap, "name", r.Name) - populate(objectMap, "properties", r.Properties) - populate(objectMap, "type", r.Type) + populate(objectMap, "edition", r.Edition) + populate(objectMap, "elasticPoolName", r.ElasticPoolName) + populate(objectMap, "keys", r.Keys) + populateTimeRFC3339(objectMap, "lastAvailableBackupDate", r.LastAvailableBackupDate) + populate(objectMap, "serviceLevelObjective", r.ServiceLevelObjective) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type RecommendedAction. -func (r *RecommendedAction) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type RecoverableDatabaseProperties. +func (r *RecoverableDatabaseProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", r, err) @@ -11931,23 +14074,20 @@ func (r *RecommendedAction) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &r.ID) - delete(rawMsg, key) - case "kind": - err = unpopulate(val, "Kind", &r.Kind) + case "edition": + err = unpopulate(val, "Edition", &r.Edition) delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &r.Location) + case "elasticPoolName": + err = unpopulate(val, "ElasticPoolName", &r.ElasticPoolName) delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &r.Name) + case "keys": + err = unpopulate(val, "Keys", &r.Keys) delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &r.Properties) + case "lastAvailableBackupDate": + err = unpopulateTimeRFC3339(val, "LastAvailableBackupDate", &r.LastAvailableBackupDate) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &r.Type) + case "serviceLevelObjective": + err = unpopulate(val, "ServiceLevelObjective", &r.ServiceLevelObjective) delete(rawMsg, key) } if err != nil { @@ -11957,16 +14097,18 @@ func (r *RecommendedAction) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type RecommendedActionErrorInfo. -func (r RecommendedActionErrorInfo) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type RecoverableManagedDatabase. +func (r RecoverableManagedDatabase) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "errorCode", r.ErrorCode) - populate(objectMap, "isRetryable", r.IsRetryable) + populate(objectMap, "id", r.ID) + populate(objectMap, "name", r.Name) + populate(objectMap, "properties", r.Properties) + populate(objectMap, "type", r.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type RecommendedActionErrorInfo. -func (r *RecommendedActionErrorInfo) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type RecoverableManagedDatabase. +func (r *RecoverableManagedDatabase) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", r, err) @@ -11974,11 +14116,17 @@ func (r *RecommendedActionErrorInfo) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "errorCode": - err = unpopulate(val, "ErrorCode", &r.ErrorCode) + case "id": + err = unpopulate(val, "ID", &r.ID) delete(rawMsg, key) - case "isRetryable": - err = unpopulate(val, "IsRetryable", &r.IsRetryable) + case "name": + err = unpopulate(val, "Name", &r.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &r.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &r.Type) delete(rawMsg, key) } if err != nil { @@ -11988,19 +14136,16 @@ func (r *RecommendedActionErrorInfo) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type RecommendedActionImpactRecord. -func (r RecommendedActionImpactRecord) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type RecoverableManagedDatabaseListResult. +func (r RecoverableManagedDatabaseListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "absoluteValue", r.AbsoluteValue) - populate(objectMap, "changeValueAbsolute", r.ChangeValueAbsolute) - populate(objectMap, "changeValueRelative", r.ChangeValueRelative) - populate(objectMap, "dimensionName", r.DimensionName) - populate(objectMap, "unit", r.Unit) + populate(objectMap, "nextLink", r.NextLink) + populate(objectMap, "value", r.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type RecommendedActionImpactRecord. -func (r *RecommendedActionImpactRecord) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type RecoverableManagedDatabaseListResult. +func (r *RecoverableManagedDatabaseListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", r, err) @@ -12008,20 +14153,11 @@ func (r *RecommendedActionImpactRecord) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "absoluteValue": - err = unpopulate(val, "AbsoluteValue", &r.AbsoluteValue) - delete(rawMsg, key) - case "changeValueAbsolute": - err = unpopulate(val, "ChangeValueAbsolute", &r.ChangeValueAbsolute) - delete(rawMsg, key) - case "changeValueRelative": - err = unpopulate(val, "ChangeValueRelative", &r.ChangeValueRelative) - delete(rawMsg, key) - case "dimensionName": - err = unpopulate(val, "DimensionName", &r.DimensionName) + case "nextLink": + err = unpopulate(val, "NextLink", &r.NextLink) delete(rawMsg, key) - case "unit": - err = unpopulate(val, "Unit", &r.Unit) + case "value": + err = unpopulate(val, "Value", &r.Value) delete(rawMsg, key) } if err != nil { @@ -12031,16 +14167,15 @@ func (r *RecommendedActionImpactRecord) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type RecommendedActionImplementationInfo. -func (r RecommendedActionImplementationInfo) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type RecoverableManagedDatabaseProperties. +func (r RecoverableManagedDatabaseProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "method", r.Method) - populate(objectMap, "script", r.Script) + populate(objectMap, "lastAvailableBackupDate", r.LastAvailableBackupDate) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type RecommendedActionImplementationInfo. -func (r *RecommendedActionImplementationInfo) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type RecoverableManagedDatabaseProperties. +func (r *RecoverableManagedDatabaseProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", r, err) @@ -12048,11 +14183,8 @@ func (r *RecommendedActionImplementationInfo) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "method": - err = unpopulate(val, "Method", &r.Method) - delete(rawMsg, key) - case "script": - err = unpopulate(val, "Script", &r.Script) + case "lastAvailableBackupDate": + err = unpopulate(val, "LastAvailableBackupDate", &r.LastAvailableBackupDate) delete(rawMsg, key) } if err != nil { @@ -12062,19 +14194,18 @@ func (r *RecommendedActionImplementationInfo) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type RecommendedActionMetricInfo. -func (r RecommendedActionMetricInfo) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type RefreshExternalGovernanceStatusOperationResult. +func (r RefreshExternalGovernanceStatusOperationResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "metricName", r.MetricName) - populateTimeRFC3339(objectMap, "startTime", r.StartTime) - populate(objectMap, "timeGrain", r.TimeGrain) - populate(objectMap, "unit", r.Unit) - populate(objectMap, "value", r.Value) + populate(objectMap, "id", r.ID) + populate(objectMap, "name", r.Name) + populate(objectMap, "properties", r.Properties) + populate(objectMap, "type", r.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type RecommendedActionMetricInfo. -func (r *RecommendedActionMetricInfo) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type RefreshExternalGovernanceStatusOperationResult. +func (r *RefreshExternalGovernanceStatusOperationResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", r, err) @@ -12082,20 +14213,17 @@ func (r *RecommendedActionMetricInfo) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "metricName": - err = unpopulate(val, "MetricName", &r.MetricName) - delete(rawMsg, key) - case "startTime": - err = unpopulateTimeRFC3339(val, "StartTime", &r.StartTime) + case "id": + err = unpopulate(val, "ID", &r.ID) delete(rawMsg, key) - case "timeGrain": - err = unpopulate(val, "TimeGrain", &r.TimeGrain) + case "name": + err = unpopulate(val, "Name", &r.Name) delete(rawMsg, key) - case "unit": - err = unpopulate(val, "Unit", &r.Unit) + case "properties": + err = unpopulate(val, "Properties", &r.Properties) delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &r.Value) + case "type": + err = unpopulate(val, "Type", &r.Type) delete(rawMsg, key) } if err != nil { @@ -12105,37 +14233,20 @@ func (r *RecommendedActionMetricInfo) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type RecommendedActionProperties. -func (r RecommendedActionProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type RefreshExternalGovernanceStatusOperationResultProperties. +func (r RefreshExternalGovernanceStatusOperationResultProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "details", r.Details) - populate(objectMap, "errorDetails", r.ErrorDetails) - populate(objectMap, "estimatedImpact", r.EstimatedImpact) - populate(objectMap, "executeActionDuration", r.ExecuteActionDuration) - populate(objectMap, "executeActionInitiatedBy", r.ExecuteActionInitiatedBy) - populateTimeRFC3339(objectMap, "executeActionInitiatedTime", r.ExecuteActionInitiatedTime) - populateTimeRFC3339(objectMap, "executeActionStartTime", r.ExecuteActionStartTime) - populate(objectMap, "implementationDetails", r.ImplementationDetails) - populate(objectMap, "isArchivedAction", r.IsArchivedAction) - populate(objectMap, "isExecutableAction", r.IsExecutableAction) - populate(objectMap, "isRevertableAction", r.IsRevertableAction) - populateTimeRFC3339(objectMap, "lastRefresh", r.LastRefresh) - populate(objectMap, "linkedObjects", r.LinkedObjects) - populate(objectMap, "observedImpact", r.ObservedImpact) - populate(objectMap, "recommendationReason", r.RecommendationReason) - populate(objectMap, "revertActionDuration", r.RevertActionDuration) - populate(objectMap, "revertActionInitiatedBy", r.RevertActionInitiatedBy) - populateTimeRFC3339(objectMap, "revertActionInitiatedTime", r.RevertActionInitiatedTime) - populateTimeRFC3339(objectMap, "revertActionStartTime", r.RevertActionStartTime) - populate(objectMap, "score", r.Score) - populate(objectMap, "state", r.State) - populate(objectMap, "timeSeries", r.TimeSeries) - populateTimeRFC3339(objectMap, "validSince", r.ValidSince) + populate(objectMap, "errorMessage", r.ErrorMessage) + populate(objectMap, "queuedTime", r.QueuedTime) + populate(objectMap, "requestId", r.RequestID) + populate(objectMap, "requestType", r.RequestType) + populate(objectMap, "serverName", r.ServerName) + populate(objectMap, "status", r.Status) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type RecommendedActionProperties. -func (r *RecommendedActionProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type RefreshExternalGovernanceStatusOperationResultProperties. +func (r *RefreshExternalGovernanceStatusOperationResultProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", r, err) @@ -12143,74 +14254,23 @@ func (r *RecommendedActionProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "details": - err = unpopulate(val, "Details", &r.Details) - delete(rawMsg, key) - case "errorDetails": - err = unpopulate(val, "ErrorDetails", &r.ErrorDetails) - delete(rawMsg, key) - case "estimatedImpact": - err = unpopulate(val, "EstimatedImpact", &r.EstimatedImpact) - delete(rawMsg, key) - case "executeActionDuration": - err = unpopulate(val, "ExecuteActionDuration", &r.ExecuteActionDuration) - delete(rawMsg, key) - case "executeActionInitiatedBy": - err = unpopulate(val, "ExecuteActionInitiatedBy", &r.ExecuteActionInitiatedBy) - delete(rawMsg, key) - case "executeActionInitiatedTime": - err = unpopulateTimeRFC3339(val, "ExecuteActionInitiatedTime", &r.ExecuteActionInitiatedTime) - delete(rawMsg, key) - case "executeActionStartTime": - err = unpopulateTimeRFC3339(val, "ExecuteActionStartTime", &r.ExecuteActionStartTime) - delete(rawMsg, key) - case "implementationDetails": - err = unpopulate(val, "ImplementationDetails", &r.ImplementationDetails) - delete(rawMsg, key) - case "isArchivedAction": - err = unpopulate(val, "IsArchivedAction", &r.IsArchivedAction) - delete(rawMsg, key) - case "isExecutableAction": - err = unpopulate(val, "IsExecutableAction", &r.IsExecutableAction) - delete(rawMsg, key) - case "isRevertableAction": - err = unpopulate(val, "IsRevertableAction", &r.IsRevertableAction) - delete(rawMsg, key) - case "lastRefresh": - err = unpopulateTimeRFC3339(val, "LastRefresh", &r.LastRefresh) - delete(rawMsg, key) - case "linkedObjects": - err = unpopulate(val, "LinkedObjects", &r.LinkedObjects) - delete(rawMsg, key) - case "observedImpact": - err = unpopulate(val, "ObservedImpact", &r.ObservedImpact) - delete(rawMsg, key) - case "recommendationReason": - err = unpopulate(val, "RecommendationReason", &r.RecommendationReason) - delete(rawMsg, key) - case "revertActionDuration": - err = unpopulate(val, "RevertActionDuration", &r.RevertActionDuration) - delete(rawMsg, key) - case "revertActionInitiatedBy": - err = unpopulate(val, "RevertActionInitiatedBy", &r.RevertActionInitiatedBy) - delete(rawMsg, key) - case "revertActionInitiatedTime": - err = unpopulateTimeRFC3339(val, "RevertActionInitiatedTime", &r.RevertActionInitiatedTime) + case "errorMessage": + err = unpopulate(val, "ErrorMessage", &r.ErrorMessage) delete(rawMsg, key) - case "revertActionStartTime": - err = unpopulateTimeRFC3339(val, "RevertActionStartTime", &r.RevertActionStartTime) + case "queuedTime": + err = unpopulate(val, "QueuedTime", &r.QueuedTime) delete(rawMsg, key) - case "score": - err = unpopulate(val, "Score", &r.Score) + case "requestId": + err = unpopulate(val, "RequestID", &r.RequestID) delete(rawMsg, key) - case "state": - err = unpopulate(val, "State", &r.State) + case "requestType": + err = unpopulate(val, "RequestType", &r.RequestType) delete(rawMsg, key) - case "timeSeries": - err = unpopulate(val, "TimeSeries", &r.TimeSeries) + case "serverName": + err = unpopulate(val, "ServerName", &r.ServerName) delete(rawMsg, key) - case "validSince": - err = unpopulateTimeRFC3339(val, "ValidSince", &r.ValidSince) + case "status": + err = unpopulate(val, "Status", &r.Status) delete(rawMsg, key) } if err != nil { @@ -12220,17 +14280,18 @@ func (r *RecommendedActionProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type RecommendedActionStateInfo. -func (r RecommendedActionStateInfo) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type Remediation. +func (r Remediation) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "actionInitiatedBy", r.ActionInitiatedBy) - populate(objectMap, "currentValue", r.CurrentValue) - populateTimeRFC3339(objectMap, "lastModified", r.LastModified) + populate(objectMap, "automated", r.Automated) + populate(objectMap, "description", r.Description) + populate(objectMap, "portalLink", r.PortalLink) + populate(objectMap, "scripts", r.Scripts) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type RecommendedActionStateInfo. -func (r *RecommendedActionStateInfo) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type Remediation. +func (r *Remediation) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", r, err) @@ -12238,14 +14299,17 @@ func (r *RecommendedActionStateInfo) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "actionInitiatedBy": - err = unpopulate(val, "ActionInitiatedBy", &r.ActionInitiatedBy) + case "automated": + err = unpopulate(val, "Automated", &r.Automated) delete(rawMsg, key) - case "currentValue": - err = unpopulate(val, "CurrentValue", &r.CurrentValue) + case "description": + err = unpopulate(val, "Description", &r.Description) delete(rawMsg, key) - case "lastModified": - err = unpopulateTimeRFC3339(val, "LastModified", &r.LastModified) + case "portalLink": + err = unpopulate(val, "PortalLink", &r.PortalLink) + delete(rawMsg, key) + case "scripts": + err = unpopulate(val, "Scripts", &r.Scripts) delete(rawMsg, key) } if err != nil { @@ -12255,8 +14319,8 @@ func (r *RecommendedActionStateInfo) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type RecommendedSensitivityLabelUpdate. -func (r RecommendedSensitivityLabelUpdate) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ReplicationLink. +func (r ReplicationLink) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", r.ID) populate(objectMap, "name", r.Name) @@ -12265,8 +14329,8 @@ func (r RecommendedSensitivityLabelUpdate) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type RecommendedSensitivityLabelUpdate. -func (r *RecommendedSensitivityLabelUpdate) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ReplicationLink. +func (r *ReplicationLink) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", r, err) @@ -12294,15 +14358,16 @@ func (r *RecommendedSensitivityLabelUpdate) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type RecommendedSensitivityLabelUpdateList. -func (r RecommendedSensitivityLabelUpdateList) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ReplicationLinkListResult. +func (r ReplicationLinkListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "operations", r.Operations) + populate(objectMap, "nextLink", r.NextLink) + populate(objectMap, "value", r.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type RecommendedSensitivityLabelUpdateList. -func (r *RecommendedSensitivityLabelUpdateList) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ReplicationLinkListResult. +func (r *ReplicationLinkListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", r, err) @@ -12310,8 +14375,11 @@ func (r *RecommendedSensitivityLabelUpdateList) UnmarshalJSON(data []byte) error for key, val := range rawMsg { var err error switch key { - case "operations": - err = unpopulate(val, "Operations", &r.Operations) + case "nextLink": + err = unpopulate(val, "NextLink", &r.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &r.Value) delete(rawMsg, key) } if err != nil { @@ -12321,18 +14389,26 @@ func (r *RecommendedSensitivityLabelUpdateList) UnmarshalJSON(data []byte) error return nil } -// MarshalJSON implements the json.Marshaller interface for type RecommendedSensitivityLabelUpdateProperties. -func (r RecommendedSensitivityLabelUpdateProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ReplicationLinkProperties. +func (r ReplicationLinkProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "column", r.Column) - populate(objectMap, "op", r.Op) - populate(objectMap, "schema", r.Schema) - populate(objectMap, "table", r.Table) + populate(objectMap, "isTerminationAllowed", r.IsTerminationAllowed) + populate(objectMap, "linkType", r.LinkType) + populate(objectMap, "partnerDatabase", r.PartnerDatabase) + populate(objectMap, "partnerDatabaseId", r.PartnerDatabaseID) + populate(objectMap, "partnerLocation", r.PartnerLocation) + populate(objectMap, "partnerRole", r.PartnerRole) + populate(objectMap, "partnerServer", r.PartnerServer) + populate(objectMap, "percentComplete", r.PercentComplete) + populate(objectMap, "replicationMode", r.ReplicationMode) + populate(objectMap, "replicationState", r.ReplicationState) + populate(objectMap, "role", r.Role) + populateTimeRFC3339(objectMap, "startTime", r.StartTime) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type RecommendedSensitivityLabelUpdateProperties. -func (r *RecommendedSensitivityLabelUpdateProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ReplicationLinkProperties. +func (r *ReplicationLinkProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", r, err) @@ -12340,17 +14416,41 @@ func (r *RecommendedSensitivityLabelUpdateProperties) UnmarshalJSON(data []byte) for key, val := range rawMsg { var err error switch key { - case "column": - err = unpopulate(val, "Column", &r.Column) + case "isTerminationAllowed": + err = unpopulate(val, "IsTerminationAllowed", &r.IsTerminationAllowed) delete(rawMsg, key) - case "op": - err = unpopulate(val, "Op", &r.Op) + case "linkType": + err = unpopulate(val, "LinkType", &r.LinkType) delete(rawMsg, key) - case "schema": - err = unpopulate(val, "Schema", &r.Schema) + case "partnerDatabase": + err = unpopulate(val, "PartnerDatabase", &r.PartnerDatabase) delete(rawMsg, key) - case "table": - err = unpopulate(val, "Table", &r.Table) + case "partnerDatabaseId": + err = unpopulate(val, "PartnerDatabaseID", &r.PartnerDatabaseID) + delete(rawMsg, key) + case "partnerLocation": + err = unpopulate(val, "PartnerLocation", &r.PartnerLocation) + delete(rawMsg, key) + case "partnerRole": + err = unpopulate(val, "PartnerRole", &r.PartnerRole) + delete(rawMsg, key) + case "partnerServer": + err = unpopulate(val, "PartnerServer", &r.PartnerServer) + delete(rawMsg, key) + case "percentComplete": + err = unpopulate(val, "PercentComplete", &r.PercentComplete) + delete(rawMsg, key) + case "replicationMode": + err = unpopulate(val, "ReplicationMode", &r.ReplicationMode) + delete(rawMsg, key) + case "replicationState": + err = unpopulate(val, "ReplicationState", &r.ReplicationState) + delete(rawMsg, key) + case "role": + err = unpopulate(val, "Role", &r.Role) + delete(rawMsg, key) + case "startTime": + err = unpopulateTimeRFC3339(val, "StartTime", &r.StartTime) delete(rawMsg, key) } if err != nil { @@ -12360,18 +14460,17 @@ func (r *RecommendedSensitivityLabelUpdateProperties) UnmarshalJSON(data []byte) return nil } -// MarshalJSON implements the json.Marshaller interface for type RecoverableDatabase. -func (r RecoverableDatabase) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type Resource. +func (r Resource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", r.ID) populate(objectMap, "name", r.Name) - populate(objectMap, "properties", r.Properties) populate(objectMap, "type", r.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type RecoverableDatabase. -func (r *RecoverableDatabase) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type Resource. +func (r *Resource) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", r, err) @@ -12385,9 +14484,6 @@ func (r *RecoverableDatabase) UnmarshalJSON(data []byte) error { case "name": err = unpopulate(val, "Name", &r.Name) delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &r.Properties) - delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &r.Type) delete(rawMsg, key) @@ -12399,15 +14495,18 @@ func (r *RecoverableDatabase) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type RecoverableDatabaseListResult. -func (r RecoverableDatabaseListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ResourceIdentity. +func (r ResourceIdentity) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "value", r.Value) + populate(objectMap, "principalId", r.PrincipalID) + populate(objectMap, "tenantId", r.TenantID) + populate(objectMap, "type", r.Type) + populate(objectMap, "userAssignedIdentities", r.UserAssignedIdentities) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type RecoverableDatabaseListResult. -func (r *RecoverableDatabaseListResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceIdentity. +func (r *ResourceIdentity) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", r, err) @@ -12415,8 +14514,17 @@ func (r *RecoverableDatabaseListResult) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "value": - err = unpopulate(val, "Value", &r.Value) + case "principalId": + err = unpopulate(val, "PrincipalID", &r.PrincipalID) + delete(rawMsg, key) + case "tenantId": + err = unpopulate(val, "TenantID", &r.TenantID) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &r.Type) + delete(rawMsg, key) + case "userAssignedIdentities": + err = unpopulate(val, "UserAssignedIdentities", &r.UserAssignedIdentities) delete(rawMsg, key) } if err != nil { @@ -12426,18 +14534,15 @@ func (r *RecoverableDatabaseListResult) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type RecoverableDatabaseProperties. -func (r RecoverableDatabaseProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ResourceMoveDefinition. +func (r ResourceMoveDefinition) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "edition", r.Edition) - populate(objectMap, "elasticPoolName", r.ElasticPoolName) - populateTimeRFC3339(objectMap, "lastAvailableBackupDate", r.LastAvailableBackupDate) - populate(objectMap, "serviceLevelObjective", r.ServiceLevelObjective) + populate(objectMap, "id", r.ID) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type RecoverableDatabaseProperties. -func (r *RecoverableDatabaseProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceMoveDefinition. +func (r *ResourceMoveDefinition) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", r, err) @@ -12445,17 +14550,43 @@ func (r *RecoverableDatabaseProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "edition": - err = unpopulate(val, "Edition", &r.Edition) + case "id": + err = unpopulate(val, "ID", &r.ID) delete(rawMsg, key) - case "elasticPoolName": - err = unpopulate(val, "ElasticPoolName", &r.ElasticPoolName) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ResourceWithWritableName. +func (r ResourceWithWritableName) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", r.ID) + populate(objectMap, "name", r.Name) + populate(objectMap, "type", r.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceWithWritableName. +func (r *ResourceWithWritableName) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &r.ID) delete(rawMsg, key) - case "lastAvailableBackupDate": - err = unpopulateTimeRFC3339(val, "LastAvailableBackupDate", &r.LastAvailableBackupDate) + case "name": + err = unpopulate(val, "Name", &r.Name) delete(rawMsg, key) - case "serviceLevelObjective": - err = unpopulate(val, "ServiceLevelObjective", &r.ServiceLevelObjective) + case "type": + err = unpopulate(val, "Type", &r.Type) delete(rawMsg, key) } if err != nil { @@ -12465,18 +14596,21 @@ func (r *RecoverableDatabaseProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type RecoverableManagedDatabase. -func (r RecoverableManagedDatabase) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type RestorableDroppedDatabase. +func (r RestorableDroppedDatabase) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", r.ID) + populate(objectMap, "location", r.Location) populate(objectMap, "name", r.Name) populate(objectMap, "properties", r.Properties) + populate(objectMap, "sku", r.SKU) + populate(objectMap, "tags", r.Tags) populate(objectMap, "type", r.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type RecoverableManagedDatabase. -func (r *RecoverableManagedDatabase) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type RestorableDroppedDatabase. +func (r *RestorableDroppedDatabase) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", r, err) @@ -12487,12 +14621,21 @@ func (r *RecoverableManagedDatabase) UnmarshalJSON(data []byte) error { case "id": err = unpopulate(val, "ID", &r.ID) delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &r.Location) + delete(rawMsg, key) case "name": err = unpopulate(val, "Name", &r.Name) delete(rawMsg, key) case "properties": err = unpopulate(val, "Properties", &r.Properties) delete(rawMsg, key) + case "sku": + err = unpopulate(val, "SKU", &r.SKU) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &r.Tags) + delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &r.Type) delete(rawMsg, key) @@ -12504,16 +14647,16 @@ func (r *RecoverableManagedDatabase) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type RecoverableManagedDatabaseListResult. -func (r RecoverableManagedDatabaseListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type RestorableDroppedDatabaseListResult. +func (r RestorableDroppedDatabaseListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "nextLink", r.NextLink) populate(objectMap, "value", r.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type RecoverableManagedDatabaseListResult. -func (r *RecoverableManagedDatabaseListResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type RestorableDroppedDatabaseListResult. +func (r *RestorableDroppedDatabaseListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", r, err) @@ -12535,15 +14678,21 @@ func (r *RecoverableManagedDatabaseListResult) UnmarshalJSON(data []byte) error return nil } -// MarshalJSON implements the json.Marshaller interface for type RecoverableManagedDatabaseProperties. -func (r RecoverableManagedDatabaseProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type RestorableDroppedDatabaseProperties. +func (r RestorableDroppedDatabaseProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "lastAvailableBackupDate", r.LastAvailableBackupDate) + populate(objectMap, "backupStorageRedundancy", r.BackupStorageRedundancy) + populateTimeRFC3339(objectMap, "creationDate", r.CreationDate) + populate(objectMap, "databaseName", r.DatabaseName) + populateTimeRFC3339(objectMap, "deletionDate", r.DeletionDate) + populateTimeRFC3339(objectMap, "earliestRestoreDate", r.EarliestRestoreDate) + populate(objectMap, "keys", r.Keys) + populate(objectMap, "maxSizeBytes", r.MaxSizeBytes) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type RecoverableManagedDatabaseProperties. -func (r *RecoverableManagedDatabaseProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type RestorableDroppedDatabaseProperties. +func (r *RestorableDroppedDatabaseProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", r, err) @@ -12551,8 +14700,26 @@ func (r *RecoverableManagedDatabaseProperties) UnmarshalJSON(data []byte) error for key, val := range rawMsg { var err error switch key { - case "lastAvailableBackupDate": - err = unpopulate(val, "LastAvailableBackupDate", &r.LastAvailableBackupDate) + case "backupStorageRedundancy": + err = unpopulate(val, "BackupStorageRedundancy", &r.BackupStorageRedundancy) + delete(rawMsg, key) + case "creationDate": + err = unpopulateTimeRFC3339(val, "CreationDate", &r.CreationDate) + delete(rawMsg, key) + case "databaseName": + err = unpopulate(val, "DatabaseName", &r.DatabaseName) + delete(rawMsg, key) + case "deletionDate": + err = unpopulateTimeRFC3339(val, "DeletionDate", &r.DeletionDate) + delete(rawMsg, key) + case "earliestRestoreDate": + err = unpopulateTimeRFC3339(val, "EarliestRestoreDate", &r.EarliestRestoreDate) + delete(rawMsg, key) + case "keys": + err = unpopulate(val, "Keys", &r.Keys) + delete(rawMsg, key) + case "maxSizeBytes": + err = unpopulate(val, "MaxSizeBytes", &r.MaxSizeBytes) delete(rawMsg, key) } if err != nil { @@ -12562,18 +14729,20 @@ func (r *RecoverableManagedDatabaseProperties) UnmarshalJSON(data []byte) error return nil } -// MarshalJSON implements the json.Marshaller interface for type ReplicationLink. -func (r ReplicationLink) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type RestorableDroppedManagedDatabase. +func (r RestorableDroppedManagedDatabase) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", r.ID) + populate(objectMap, "location", r.Location) populate(objectMap, "name", r.Name) populate(objectMap, "properties", r.Properties) + populate(objectMap, "tags", r.Tags) populate(objectMap, "type", r.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ReplicationLink. -func (r *ReplicationLink) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type RestorableDroppedManagedDatabase. +func (r *RestorableDroppedManagedDatabase) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", r, err) @@ -12584,12 +14753,18 @@ func (r *ReplicationLink) UnmarshalJSON(data []byte) error { case "id": err = unpopulate(val, "ID", &r.ID) delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &r.Location) + delete(rawMsg, key) case "name": err = unpopulate(val, "Name", &r.Name) delete(rawMsg, key) case "properties": err = unpopulate(val, "Properties", &r.Properties) delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &r.Tags) + delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &r.Type) delete(rawMsg, key) @@ -12601,16 +14776,16 @@ func (r *ReplicationLink) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ReplicationLinkListResult. -func (r ReplicationLinkListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type RestorableDroppedManagedDatabaseListResult. +func (r RestorableDroppedManagedDatabaseListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "nextLink", r.NextLink) populate(objectMap, "value", r.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ReplicationLinkListResult. -func (r *ReplicationLinkListResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type RestorableDroppedManagedDatabaseListResult. +func (r *RestorableDroppedManagedDatabaseListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", r, err) @@ -12632,25 +14807,18 @@ func (r *ReplicationLinkListResult) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ReplicationLinkProperties. -func (r ReplicationLinkProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type RestorableDroppedManagedDatabaseProperties. +func (r RestorableDroppedManagedDatabaseProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "isTerminationAllowed", r.IsTerminationAllowed) - populate(objectMap, "linkType", r.LinkType) - populate(objectMap, "partnerDatabase", r.PartnerDatabase) - populate(objectMap, "partnerLocation", r.PartnerLocation) - populate(objectMap, "partnerRole", r.PartnerRole) - populate(objectMap, "partnerServer", r.PartnerServer) - populate(objectMap, "percentComplete", r.PercentComplete) - populate(objectMap, "replicationMode", r.ReplicationMode) - populate(objectMap, "replicationState", r.ReplicationState) - populate(objectMap, "role", r.Role) - populateTimeRFC3339(objectMap, "startTime", r.StartTime) + populateTimeRFC3339(objectMap, "creationDate", r.CreationDate) + populate(objectMap, "databaseName", r.DatabaseName) + populateTimeRFC3339(objectMap, "deletionDate", r.DeletionDate) + populateTimeRFC3339(objectMap, "earliestRestoreDate", r.EarliestRestoreDate) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ReplicationLinkProperties. -func (r *ReplicationLinkProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type RestorableDroppedManagedDatabaseProperties. +func (r *RestorableDroppedManagedDatabaseProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", r, err) @@ -12658,38 +14826,17 @@ func (r *ReplicationLinkProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "isTerminationAllowed": - err = unpopulate(val, "IsTerminationAllowed", &r.IsTerminationAllowed) - delete(rawMsg, key) - case "linkType": - err = unpopulate(val, "LinkType", &r.LinkType) - delete(rawMsg, key) - case "partnerDatabase": - err = unpopulate(val, "PartnerDatabase", &r.PartnerDatabase) - delete(rawMsg, key) - case "partnerLocation": - err = unpopulate(val, "PartnerLocation", &r.PartnerLocation) - delete(rawMsg, key) - case "partnerRole": - err = unpopulate(val, "PartnerRole", &r.PartnerRole) - delete(rawMsg, key) - case "partnerServer": - err = unpopulate(val, "PartnerServer", &r.PartnerServer) - delete(rawMsg, key) - case "percentComplete": - err = unpopulate(val, "PercentComplete", &r.PercentComplete) - delete(rawMsg, key) - case "replicationMode": - err = unpopulate(val, "ReplicationMode", &r.ReplicationMode) + case "creationDate": + err = unpopulateTimeRFC3339(val, "CreationDate", &r.CreationDate) delete(rawMsg, key) - case "replicationState": - err = unpopulate(val, "ReplicationState", &r.ReplicationState) + case "databaseName": + err = unpopulate(val, "DatabaseName", &r.DatabaseName) delete(rawMsg, key) - case "role": - err = unpopulate(val, "Role", &r.Role) + case "deletionDate": + err = unpopulateTimeRFC3339(val, "DeletionDate", &r.DeletionDate) delete(rawMsg, key) - case "startTime": - err = unpopulateTimeRFC3339(val, "StartTime", &r.StartTime) + case "earliestRestoreDate": + err = unpopulateTimeRFC3339(val, "EarliestRestoreDate", &r.EarliestRestoreDate) delete(rawMsg, key) } if err != nil { @@ -12699,17 +14846,19 @@ func (r *ReplicationLinkProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type Resource. -func (r Resource) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type RestorePoint. +func (r RestorePoint) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", r.ID) + populate(objectMap, "location", r.Location) populate(objectMap, "name", r.Name) + populate(objectMap, "properties", r.Properties) populate(objectMap, "type", r.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type Resource. -func (r *Resource) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type RestorePoint. +func (r *RestorePoint) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", r, err) @@ -12720,9 +14869,15 @@ func (r *Resource) UnmarshalJSON(data []byte) error { case "id": err = unpopulate(val, "ID", &r.ID) delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &r.Location) + delete(rawMsg, key) case "name": err = unpopulate(val, "Name", &r.Name) delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &r.Properties) + delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &r.Type) delete(rawMsg, key) @@ -12734,18 +14889,16 @@ func (r *Resource) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ResourceIdentity. -func (r ResourceIdentity) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type RestorePointListResult. +func (r RestorePointListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "principalId", r.PrincipalID) - populate(objectMap, "tenantId", r.TenantID) - populate(objectMap, "type", r.Type) - populate(objectMap, "userAssignedIdentities", r.UserAssignedIdentities) + populate(objectMap, "nextLink", r.NextLink) + populate(objectMap, "value", r.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceIdentity. -func (r *ResourceIdentity) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type RestorePointListResult. +func (r *RestorePointListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", r, err) @@ -12753,17 +14906,11 @@ func (r *ResourceIdentity) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "principalId": - err = unpopulate(val, "PrincipalID", &r.PrincipalID) - delete(rawMsg, key) - case "tenantId": - err = unpopulate(val, "TenantID", &r.TenantID) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &r.Type) + case "nextLink": + err = unpopulate(val, "NextLink", &r.NextLink) delete(rawMsg, key) - case "userAssignedIdentities": - err = unpopulate(val, "UserAssignedIdentities", &r.UserAssignedIdentities) + case "value": + err = unpopulate(val, "Value", &r.Value) delete(rawMsg, key) } if err != nil { @@ -12773,15 +14920,18 @@ func (r *ResourceIdentity) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ResourceMoveDefinition. -func (r ResourceMoveDefinition) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type RestorePointProperties. +func (r RestorePointProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", r.ID) + populateTimeRFC3339(objectMap, "earliestRestoreDate", r.EarliestRestoreDate) + populateTimeRFC3339(objectMap, "restorePointCreationDate", r.RestorePointCreationDate) + populate(objectMap, "restorePointLabel", r.RestorePointLabel) + populate(objectMap, "restorePointType", r.RestorePointType) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceMoveDefinition. -func (r *ResourceMoveDefinition) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type RestorePointProperties. +func (r *RestorePointProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", r, err) @@ -12789,8 +14939,17 @@ func (r *ResourceMoveDefinition) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &r.ID) + case "earliestRestoreDate": + err = unpopulateTimeRFC3339(val, "EarliestRestoreDate", &r.EarliestRestoreDate) + delete(rawMsg, key) + case "restorePointCreationDate": + err = unpopulateTimeRFC3339(val, "RestorePointCreationDate", &r.RestorePointCreationDate) + delete(rawMsg, key) + case "restorePointLabel": + err = unpopulate(val, "RestorePointLabel", &r.RestorePointLabel) + delete(rawMsg, key) + case "restorePointType": + err = unpopulate(val, "RestorePointType", &r.RestorePointType) delete(rawMsg, key) } if err != nil { @@ -12800,413 +14959,422 @@ func (r *ResourceMoveDefinition) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ResourceWithWritableName. -func (r ResourceWithWritableName) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type SKU. +func (s SKU) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", r.ID) - populate(objectMap, "name", r.Name) - populate(objectMap, "type", r.Type) + populate(objectMap, "capacity", s.Capacity) + populate(objectMap, "family", s.Family) + populate(objectMap, "name", s.Name) + populate(objectMap, "size", s.Size) + populate(objectMap, "tier", s.Tier) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceWithWritableName. -func (r *ResourceWithWritableName) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type SKU. +func (s *SKU) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &r.ID) + case "capacity": + err = unpopulate(val, "Capacity", &s.Capacity) + delete(rawMsg, key) + case "family": + err = unpopulate(val, "Family", &s.Family) delete(rawMsg, key) case "name": - err = unpopulate(val, "Name", &r.Name) + err = unpopulate(val, "Name", &s.Name) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &r.Type) + case "size": + err = unpopulate(val, "Size", &s.Size) + delete(rawMsg, key) + case "tier": + err = unpopulate(val, "Tier", &s.Tier) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type RestorableDroppedDatabase. -func (r RestorableDroppedDatabase) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ScheduleItem. +func (s ScheduleItem) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", r.ID) - populate(objectMap, "location", r.Location) - populate(objectMap, "name", r.Name) - populate(objectMap, "properties", r.Properties) - populate(objectMap, "sku", r.SKU) - populate(objectMap, "tags", r.Tags) - populate(objectMap, "type", r.Type) + populate(objectMap, "startDay", s.StartDay) + populate(objectMap, "startTime", s.StartTime) + populate(objectMap, "stopDay", s.StopDay) + populate(objectMap, "stopTime", s.StopTime) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type RestorableDroppedDatabase. -func (r *RestorableDroppedDatabase) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ScheduleItem. +func (s *ScheduleItem) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &r.ID) - delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &r.Location) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &r.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &r.Properties) + case "startDay": + err = unpopulate(val, "StartDay", &s.StartDay) delete(rawMsg, key) - case "sku": - err = unpopulate(val, "SKU", &r.SKU) + case "startTime": + err = unpopulate(val, "StartTime", &s.StartTime) delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &r.Tags) + case "stopDay": + err = unpopulate(val, "StopDay", &s.StopDay) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &r.Type) + case "stopTime": + err = unpopulate(val, "StopTime", &s.StopTime) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type RestorableDroppedDatabaseListResult. -func (r RestorableDroppedDatabaseListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type SecurityAlertPolicyProperties. +func (s SecurityAlertPolicyProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", r.NextLink) - populate(objectMap, "value", r.Value) + populateTimeRFC3339(objectMap, "creationTime", s.CreationTime) + populate(objectMap, "disabledAlerts", s.DisabledAlerts) + populate(objectMap, "emailAccountAdmins", s.EmailAccountAdmins) + populate(objectMap, "emailAddresses", s.EmailAddresses) + populate(objectMap, "retentionDays", s.RetentionDays) + populate(objectMap, "state", s.State) + populate(objectMap, "storageAccountAccessKey", s.StorageAccountAccessKey) + populate(objectMap, "storageEndpoint", s.StorageEndpoint) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type RestorableDroppedDatabaseListResult. -func (r *RestorableDroppedDatabaseListResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type SecurityAlertPolicyProperties. +func (s *SecurityAlertPolicyProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } for key, val := range rawMsg { var err error switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &r.NextLink) + case "creationTime": + err = unpopulateTimeRFC3339(val, "CreationTime", &s.CreationTime) delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &r.Value) + case "disabledAlerts": + err = unpopulate(val, "DisabledAlerts", &s.DisabledAlerts) + delete(rawMsg, key) + case "emailAccountAdmins": + err = unpopulate(val, "EmailAccountAdmins", &s.EmailAccountAdmins) + delete(rawMsg, key) + case "emailAddresses": + err = unpopulate(val, "EmailAddresses", &s.EmailAddresses) + delete(rawMsg, key) + case "retentionDays": + err = unpopulate(val, "RetentionDays", &s.RetentionDays) + delete(rawMsg, key) + case "state": + err = unpopulate(val, "State", &s.State) + delete(rawMsg, key) + case "storageAccountAccessKey": + err = unpopulate(val, "StorageAccountAccessKey", &s.StorageAccountAccessKey) + delete(rawMsg, key) + case "storageEndpoint": + err = unpopulate(val, "StorageEndpoint", &s.StorageEndpoint) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type RestorableDroppedDatabaseProperties. -func (r RestorableDroppedDatabaseProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type SecurityAlertsPolicyProperties. +func (s SecurityAlertsPolicyProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "backupStorageRedundancy", r.BackupStorageRedundancy) - populateTimeRFC3339(objectMap, "creationDate", r.CreationDate) - populate(objectMap, "databaseName", r.DatabaseName) - populateTimeRFC3339(objectMap, "deletionDate", r.DeletionDate) - populateTimeRFC3339(objectMap, "earliestRestoreDate", r.EarliestRestoreDate) - populate(objectMap, "maxSizeBytes", r.MaxSizeBytes) + populateTimeRFC3339(objectMap, "creationTime", s.CreationTime) + populate(objectMap, "disabledAlerts", s.DisabledAlerts) + populate(objectMap, "emailAccountAdmins", s.EmailAccountAdmins) + populate(objectMap, "emailAddresses", s.EmailAddresses) + populate(objectMap, "retentionDays", s.RetentionDays) + populate(objectMap, "state", s.State) + populate(objectMap, "storageAccountAccessKey", s.StorageAccountAccessKey) + populate(objectMap, "storageEndpoint", s.StorageEndpoint) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type RestorableDroppedDatabaseProperties. -func (r *RestorableDroppedDatabaseProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type SecurityAlertsPolicyProperties. +func (s *SecurityAlertsPolicyProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } for key, val := range rawMsg { var err error switch key { - case "backupStorageRedundancy": - err = unpopulate(val, "BackupStorageRedundancy", &r.BackupStorageRedundancy) + case "creationTime": + err = unpopulateTimeRFC3339(val, "CreationTime", &s.CreationTime) delete(rawMsg, key) - case "creationDate": - err = unpopulateTimeRFC3339(val, "CreationDate", &r.CreationDate) + case "disabledAlerts": + err = unpopulate(val, "DisabledAlerts", &s.DisabledAlerts) delete(rawMsg, key) - case "databaseName": - err = unpopulate(val, "DatabaseName", &r.DatabaseName) + case "emailAccountAdmins": + err = unpopulate(val, "EmailAccountAdmins", &s.EmailAccountAdmins) delete(rawMsg, key) - case "deletionDate": - err = unpopulateTimeRFC3339(val, "DeletionDate", &r.DeletionDate) + case "emailAddresses": + err = unpopulate(val, "EmailAddresses", &s.EmailAddresses) delete(rawMsg, key) - case "earliestRestoreDate": - err = unpopulateTimeRFC3339(val, "EarliestRestoreDate", &r.EarliestRestoreDate) + case "retentionDays": + err = unpopulate(val, "RetentionDays", &s.RetentionDays) delete(rawMsg, key) - case "maxSizeBytes": - err = unpopulate(val, "MaxSizeBytes", &r.MaxSizeBytes) + case "state": + err = unpopulate(val, "State", &s.State) + delete(rawMsg, key) + case "storageAccountAccessKey": + err = unpopulate(val, "StorageAccountAccessKey", &s.StorageAccountAccessKey) + delete(rawMsg, key) + case "storageEndpoint": + err = unpopulate(val, "StorageEndpoint", &s.StorageEndpoint) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type RestorableDroppedManagedDatabase. -func (r RestorableDroppedManagedDatabase) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type SecurityEvent. +func (s SecurityEvent) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", r.ID) - populate(objectMap, "location", r.Location) - populate(objectMap, "name", r.Name) - populate(objectMap, "properties", r.Properties) - populate(objectMap, "tags", r.Tags) - populate(objectMap, "type", r.Type) + populate(objectMap, "id", s.ID) + populate(objectMap, "name", s.Name) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "type", s.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type RestorableDroppedManagedDatabase. -func (r *RestorableDroppedManagedDatabase) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type SecurityEvent. +func (s *SecurityEvent) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } for key, val := range rawMsg { var err error switch key { case "id": - err = unpopulate(val, "ID", &r.ID) - delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &r.Location) + err = unpopulate(val, "ID", &s.ID) delete(rawMsg, key) case "name": - err = unpopulate(val, "Name", &r.Name) + err = unpopulate(val, "Name", &s.Name) delete(rawMsg, key) case "properties": - err = unpopulate(val, "Properties", &r.Properties) - delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &r.Tags) + err = unpopulate(val, "Properties", &s.Properties) delete(rawMsg, key) case "type": - err = unpopulate(val, "Type", &r.Type) + err = unpopulate(val, "Type", &s.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type RestorableDroppedManagedDatabaseListResult. -func (r RestorableDroppedManagedDatabaseListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type SecurityEventCollection. +func (s SecurityEventCollection) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", r.NextLink) - populate(objectMap, "value", r.Value) + populate(objectMap, "nextLink", s.NextLink) + populate(objectMap, "value", s.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type RestorableDroppedManagedDatabaseListResult. -func (r *RestorableDroppedManagedDatabaseListResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type SecurityEventCollection. +func (s *SecurityEventCollection) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } for key, val := range rawMsg { var err error switch key { case "nextLink": - err = unpopulate(val, "NextLink", &r.NextLink) + err = unpopulate(val, "NextLink", &s.NextLink) delete(rawMsg, key) case "value": - err = unpopulate(val, "Value", &r.Value) + err = unpopulate(val, "Value", &s.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type RestorableDroppedManagedDatabaseProperties. -func (r RestorableDroppedManagedDatabaseProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type SecurityEventProperties. +func (s SecurityEventProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populateTimeRFC3339(objectMap, "creationDate", r.CreationDate) - populate(objectMap, "databaseName", r.DatabaseName) - populateTimeRFC3339(objectMap, "deletionDate", r.DeletionDate) - populateTimeRFC3339(objectMap, "earliestRestoreDate", r.EarliestRestoreDate) + populate(objectMap, "applicationName", s.ApplicationName) + populate(objectMap, "clientIp", s.ClientIP) + populate(objectMap, "database", s.Database) + populateTimeRFC3339(objectMap, "eventTime", s.EventTime) + populate(objectMap, "principalName", s.PrincipalName) + populate(objectMap, "securityEventSqlInjectionAdditionalProperties", s.SecurityEventSQLInjectionAdditionalProperties) + populate(objectMap, "securityEventType", s.SecurityEventType) + populate(objectMap, "server", s.Server) + populate(objectMap, "subscription", s.Subscription) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type RestorableDroppedManagedDatabaseProperties. -func (r *RestorableDroppedManagedDatabaseProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type SecurityEventProperties. +func (s *SecurityEventProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } for key, val := range rawMsg { var err error switch key { - case "creationDate": - err = unpopulateTimeRFC3339(val, "CreationDate", &r.CreationDate) + case "applicationName": + err = unpopulate(val, "ApplicationName", &s.ApplicationName) delete(rawMsg, key) - case "databaseName": - err = unpopulate(val, "DatabaseName", &r.DatabaseName) + case "clientIp": + err = unpopulate(val, "ClientIP", &s.ClientIP) delete(rawMsg, key) - case "deletionDate": - err = unpopulateTimeRFC3339(val, "DeletionDate", &r.DeletionDate) + case "database": + err = unpopulate(val, "Database", &s.Database) delete(rawMsg, key) - case "earliestRestoreDate": - err = unpopulateTimeRFC3339(val, "EarliestRestoreDate", &r.EarliestRestoreDate) + case "eventTime": + err = unpopulateTimeRFC3339(val, "EventTime", &s.EventTime) delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type RestorePoint. -func (r RestorePoint) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "id", r.ID) - populate(objectMap, "location", r.Location) - populate(objectMap, "name", r.Name) - populate(objectMap, "properties", r.Properties) - populate(objectMap, "type", r.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RestorePoint. -func (r *RestorePoint) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &r.ID) + case "principalName": + err = unpopulate(val, "PrincipalName", &s.PrincipalName) delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &r.Location) + case "securityEventSqlInjectionAdditionalProperties": + err = unpopulate(val, "SecurityEventSQLInjectionAdditionalProperties", &s.SecurityEventSQLInjectionAdditionalProperties) delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &r.Name) + case "securityEventType": + err = unpopulate(val, "SecurityEventType", &s.SecurityEventType) delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &r.Properties) + case "server": + err = unpopulate(val, "Server", &s.Server) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &r.Type) + case "subscription": + err = unpopulate(val, "Subscription", &s.Subscription) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type RestorePointListResult. -func (r RestorePointListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type SecurityEventSQLInjectionAdditionalProperties. +func (s SecurityEventSQLInjectionAdditionalProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", r.NextLink) - populate(objectMap, "value", r.Value) + populate(objectMap, "errorCode", s.ErrorCode) + populate(objectMap, "errorMessage", s.ErrorMessage) + populate(objectMap, "errorSeverity", s.ErrorSeverity) + populate(objectMap, "statement", s.Statement) + populate(objectMap, "statementHighlightLength", s.StatementHighlightLength) + populate(objectMap, "statementHighlightOffset", s.StatementHighlightOffset) + populate(objectMap, "threatId", s.ThreatID) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type RestorePointListResult. -func (r *RestorePointListResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type SecurityEventSQLInjectionAdditionalProperties. +func (s *SecurityEventSQLInjectionAdditionalProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } for key, val := range rawMsg { var err error switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &r.NextLink) + case "errorCode": + err = unpopulate(val, "ErrorCode", &s.ErrorCode) + delete(rawMsg, key) + case "errorMessage": + err = unpopulate(val, "ErrorMessage", &s.ErrorMessage) delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &r.Value) + case "errorSeverity": + err = unpopulate(val, "ErrorSeverity", &s.ErrorSeverity) + delete(rawMsg, key) + case "statement": + err = unpopulate(val, "Statement", &s.Statement) + delete(rawMsg, key) + case "statementHighlightLength": + err = unpopulate(val, "StatementHighlightLength", &s.StatementHighlightLength) + delete(rawMsg, key) + case "statementHighlightOffset": + err = unpopulate(val, "StatementHighlightOffset", &s.StatementHighlightOffset) + delete(rawMsg, key) + case "threatId": + err = unpopulate(val, "ThreatID", &s.ThreatID) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type RestorePointProperties. -func (r RestorePointProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type SecurityEventsFilterParameters. +func (s SecurityEventsFilterParameters) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populateTimeRFC3339(objectMap, "earliestRestoreDate", r.EarliestRestoreDate) - populateTimeRFC3339(objectMap, "restorePointCreationDate", r.RestorePointCreationDate) - populate(objectMap, "restorePointLabel", r.RestorePointLabel) - populate(objectMap, "restorePointType", r.RestorePointType) + populateTimeRFC3339(objectMap, "eventTime", s.EventTime) + populate(objectMap, "showServerRecords", s.ShowServerRecords) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type RestorePointProperties. -func (r *RestorePointProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type SecurityEventsFilterParameters. +func (s *SecurityEventsFilterParameters) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } for key, val := range rawMsg { var err error switch key { - case "earliestRestoreDate": - err = unpopulateTimeRFC3339(val, "EarliestRestoreDate", &r.EarliestRestoreDate) - delete(rawMsg, key) - case "restorePointCreationDate": - err = unpopulateTimeRFC3339(val, "RestorePointCreationDate", &r.RestorePointCreationDate) - delete(rawMsg, key) - case "restorePointLabel": - err = unpopulate(val, "RestorePointLabel", &r.RestorePointLabel) + case "eventTime": + err = unpopulateTimeRFC3339(val, "EventTime", &s.EventTime) delete(rawMsg, key) - case "restorePointType": - err = unpopulate(val, "RestorePointType", &r.RestorePointType) + case "showServerRecords": + err = unpopulate(val, "ShowServerRecords", &s.ShowServerRecords) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type SKU. -func (s SKU) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type SensitivityLabel. +func (s SensitivityLabel) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "capacity", s.Capacity) - populate(objectMap, "family", s.Family) + populate(objectMap, "id", s.ID) + populate(objectMap, "managedBy", s.ManagedBy) populate(objectMap, "name", s.Name) - populate(objectMap, "size", s.Size) - populate(objectMap, "tier", s.Tier) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "type", s.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type SKU. -func (s *SKU) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type SensitivityLabel. +func (s *SensitivityLabel) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -13214,20 +15382,20 @@ func (s *SKU) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "capacity": - err = unpopulate(val, "Capacity", &s.Capacity) + case "id": + err = unpopulate(val, "ID", &s.ID) delete(rawMsg, key) - case "family": - err = unpopulate(val, "Family", &s.Family) + case "managedBy": + err = unpopulate(val, "ManagedBy", &s.ManagedBy) delete(rawMsg, key) case "name": err = unpopulate(val, "Name", &s.Name) delete(rawMsg, key) - case "size": - err = unpopulate(val, "Size", &s.Size) + case "properties": + err = unpopulate(val, "Properties", &s.Properties) delete(rawMsg, key) - case "tier": - err = unpopulate(val, "Tier", &s.Tier) + case "type": + err = unpopulate(val, "Type", &s.Type) delete(rawMsg, key) } if err != nil { @@ -13237,22 +15405,16 @@ func (s *SKU) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type SecurityAlertPolicyProperties. -func (s SecurityAlertPolicyProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type SensitivityLabelListResult. +func (s SensitivityLabelListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populateTimeRFC3339(objectMap, "creationTime", s.CreationTime) - populate(objectMap, "disabledAlerts", s.DisabledAlerts) - populate(objectMap, "emailAccountAdmins", s.EmailAccountAdmins) - populate(objectMap, "emailAddresses", s.EmailAddresses) - populate(objectMap, "retentionDays", s.RetentionDays) - populate(objectMap, "state", s.State) - populate(objectMap, "storageAccountAccessKey", s.StorageAccountAccessKey) - populate(objectMap, "storageEndpoint", s.StorageEndpoint) + populate(objectMap, "nextLink", s.NextLink) + populate(objectMap, "value", s.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type SecurityAlertPolicyProperties. -func (s *SecurityAlertPolicyProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type SensitivityLabelListResult. +func (s *SensitivityLabelListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -13260,29 +15422,11 @@ func (s *SecurityAlertPolicyProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "creationTime": - err = unpopulateTimeRFC3339(val, "CreationTime", &s.CreationTime) - delete(rawMsg, key) - case "disabledAlerts": - err = unpopulate(val, "DisabledAlerts", &s.DisabledAlerts) - delete(rawMsg, key) - case "emailAccountAdmins": - err = unpopulate(val, "EmailAccountAdmins", &s.EmailAccountAdmins) - delete(rawMsg, key) - case "emailAddresses": - err = unpopulate(val, "EmailAddresses", &s.EmailAddresses) - delete(rawMsg, key) - case "retentionDays": - err = unpopulate(val, "RetentionDays", &s.RetentionDays) - delete(rawMsg, key) - case "state": - err = unpopulate(val, "State", &s.State) - delete(rawMsg, key) - case "storageAccountAccessKey": - err = unpopulate(val, "StorageAccountAccessKey", &s.StorageAccountAccessKey) + case "nextLink": + err = unpopulate(val, "NextLink", &s.NextLink) delete(rawMsg, key) - case "storageEndpoint": - err = unpopulate(val, "StorageEndpoint", &s.StorageEndpoint) + case "value": + err = unpopulate(val, "Value", &s.Value) delete(rawMsg, key) } if err != nil { @@ -13292,22 +15436,23 @@ func (s *SecurityAlertPolicyProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type SecurityAlertsPolicyProperties. -func (s SecurityAlertsPolicyProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type SensitivityLabelProperties. +func (s SensitivityLabelProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populateTimeRFC3339(objectMap, "creationTime", s.CreationTime) - populate(objectMap, "disabledAlerts", s.DisabledAlerts) - populate(objectMap, "emailAccountAdmins", s.EmailAccountAdmins) - populate(objectMap, "emailAddresses", s.EmailAddresses) - populate(objectMap, "retentionDays", s.RetentionDays) - populate(objectMap, "state", s.State) - populate(objectMap, "storageAccountAccessKey", s.StorageAccountAccessKey) - populate(objectMap, "storageEndpoint", s.StorageEndpoint) + populate(objectMap, "columnName", s.ColumnName) + populate(objectMap, "informationType", s.InformationType) + populate(objectMap, "informationTypeId", s.InformationTypeID) + populate(objectMap, "isDisabled", s.IsDisabled) + populate(objectMap, "labelId", s.LabelID) + populate(objectMap, "labelName", s.LabelName) + populate(objectMap, "rank", s.Rank) + populate(objectMap, "schemaName", s.SchemaName) + populate(objectMap, "tableName", s.TableName) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type SecurityAlertsPolicyProperties. -func (s *SecurityAlertsPolicyProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type SensitivityLabelProperties. +func (s *SensitivityLabelProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -13315,29 +15460,32 @@ func (s *SecurityAlertsPolicyProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "creationTime": - err = unpopulateTimeRFC3339(val, "CreationTime", &s.CreationTime) + case "columnName": + err = unpopulate(val, "ColumnName", &s.ColumnName) delete(rawMsg, key) - case "disabledAlerts": - err = unpopulate(val, "DisabledAlerts", &s.DisabledAlerts) + case "informationType": + err = unpopulate(val, "InformationType", &s.InformationType) delete(rawMsg, key) - case "emailAccountAdmins": - err = unpopulate(val, "EmailAccountAdmins", &s.EmailAccountAdmins) + case "informationTypeId": + err = unpopulate(val, "InformationTypeID", &s.InformationTypeID) delete(rawMsg, key) - case "emailAddresses": - err = unpopulate(val, "EmailAddresses", &s.EmailAddresses) + case "isDisabled": + err = unpopulate(val, "IsDisabled", &s.IsDisabled) delete(rawMsg, key) - case "retentionDays": - err = unpopulate(val, "RetentionDays", &s.RetentionDays) + case "labelId": + err = unpopulate(val, "LabelID", &s.LabelID) delete(rawMsg, key) - case "state": - err = unpopulate(val, "State", &s.State) + case "labelName": + err = unpopulate(val, "LabelName", &s.LabelName) delete(rawMsg, key) - case "storageAccountAccessKey": - err = unpopulate(val, "StorageAccountAccessKey", &s.StorageAccountAccessKey) + case "rank": + err = unpopulate(val, "Rank", &s.Rank) delete(rawMsg, key) - case "storageEndpoint": - err = unpopulate(val, "StorageEndpoint", &s.StorageEndpoint) + case "schemaName": + err = unpopulate(val, "SchemaName", &s.SchemaName) + delete(rawMsg, key) + case "tableName": + err = unpopulate(val, "TableName", &s.TableName) delete(rawMsg, key) } if err != nil { @@ -13347,8 +15495,8 @@ func (s *SecurityAlertsPolicyProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type SecurityEvent. -func (s SecurityEvent) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type SensitivityLabelUpdate. +func (s SensitivityLabelUpdate) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", s.ID) populate(objectMap, "name", s.Name) @@ -13357,8 +15505,8 @@ func (s SecurityEvent) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type SecurityEvent. -func (s *SecurityEvent) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type SensitivityLabelUpdate. +func (s *SensitivityLabelUpdate) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -13386,16 +15534,15 @@ func (s *SecurityEvent) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type SecurityEventCollection. -func (s SecurityEventCollection) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type SensitivityLabelUpdateList. +func (s SensitivityLabelUpdateList) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", s.NextLink) - populate(objectMap, "value", s.Value) + populate(objectMap, "operations", s.Operations) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type SecurityEventCollection. -func (s *SecurityEventCollection) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type SensitivityLabelUpdateList. +func (s *SensitivityLabelUpdateList) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -13403,11 +15550,8 @@ func (s *SecurityEventCollection) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &s.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &s.Value) + case "operations": + err = unpopulate(val, "Operations", &s.Operations) delete(rawMsg, key) } if err != nil { @@ -13417,56 +15561,40 @@ func (s *SecurityEventCollection) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type SecurityEventProperties. -func (s SecurityEventProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type SensitivityLabelUpdateProperties. +func (s SensitivityLabelUpdateProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "applicationName", s.ApplicationName) - populate(objectMap, "clientIp", s.ClientIP) - populate(objectMap, "database", s.Database) - populateTimeRFC3339(objectMap, "eventTime", s.EventTime) - populate(objectMap, "principalName", s.PrincipalName) - populate(objectMap, "securityEventSqlInjectionAdditionalProperties", s.SecurityEventSQLInjectionAdditionalProperties) - populate(objectMap, "securityEventType", s.SecurityEventType) - populate(objectMap, "server", s.Server) - populate(objectMap, "subscription", s.Subscription) + populate(objectMap, "column", s.Column) + populate(objectMap, "op", s.Op) + populate(objectMap, "schema", s.Schema) + populate(objectMap, "sensitivityLabel", s.SensitivityLabel) + populate(objectMap, "table", s.Table) return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type SecurityEventProperties. -func (s *SecurityEventProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "applicationName": - err = unpopulate(val, "ApplicationName", &s.ApplicationName) - delete(rawMsg, key) - case "clientIp": - err = unpopulate(val, "ClientIP", &s.ClientIP) - delete(rawMsg, key) - case "database": - err = unpopulate(val, "Database", &s.Database) - delete(rawMsg, key) - case "eventTime": - err = unpopulateTimeRFC3339(val, "EventTime", &s.EventTime) - delete(rawMsg, key) - case "principalName": - err = unpopulate(val, "PrincipalName", &s.PrincipalName) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SensitivityLabelUpdateProperties. +func (s *SensitivityLabelUpdateProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "column": + err = unpopulate(val, "Column", &s.Column) delete(rawMsg, key) - case "securityEventSqlInjectionAdditionalProperties": - err = unpopulate(val, "SecurityEventSQLInjectionAdditionalProperties", &s.SecurityEventSQLInjectionAdditionalProperties) + case "op": + err = unpopulate(val, "Op", &s.Op) delete(rawMsg, key) - case "securityEventType": - err = unpopulate(val, "SecurityEventType", &s.SecurityEventType) + case "schema": + err = unpopulate(val, "Schema", &s.Schema) delete(rawMsg, key) - case "server": - err = unpopulate(val, "Server", &s.Server) + case "sensitivityLabel": + err = unpopulate(val, "SensitivityLabel", &s.SensitivityLabel) delete(rawMsg, key) - case "subscription": - err = unpopulate(val, "Subscription", &s.Subscription) + case "table": + err = unpopulate(val, "Table", &s.Table) delete(rawMsg, key) } if err != nil { @@ -13476,21 +15604,22 @@ func (s *SecurityEventProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type SecurityEventSQLInjectionAdditionalProperties. -func (s SecurityEventSQLInjectionAdditionalProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type Server. +func (s Server) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "errorCode", s.ErrorCode) - populate(objectMap, "errorMessage", s.ErrorMessage) - populate(objectMap, "errorSeverity", s.ErrorSeverity) - populate(objectMap, "statement", s.Statement) - populate(objectMap, "statementHighlightLength", s.StatementHighlightLength) - populate(objectMap, "statementHighlightOffset", s.StatementHighlightOffset) - populate(objectMap, "threatId", s.ThreatID) + populate(objectMap, "id", s.ID) + populate(objectMap, "identity", s.Identity) + populate(objectMap, "kind", s.Kind) + populate(objectMap, "location", s.Location) + populate(objectMap, "name", s.Name) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "tags", s.Tags) + populate(objectMap, "type", s.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type SecurityEventSQLInjectionAdditionalProperties. -func (s *SecurityEventSQLInjectionAdditionalProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type Server. +func (s *Server) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -13498,26 +15627,29 @@ func (s *SecurityEventSQLInjectionAdditionalProperties) UnmarshalJSON(data []byt for key, val := range rawMsg { var err error switch key { - case "errorCode": - err = unpopulate(val, "ErrorCode", &s.ErrorCode) + case "id": + err = unpopulate(val, "ID", &s.ID) delete(rawMsg, key) - case "errorMessage": - err = unpopulate(val, "ErrorMessage", &s.ErrorMessage) + case "identity": + err = unpopulate(val, "Identity", &s.Identity) delete(rawMsg, key) - case "errorSeverity": - err = unpopulate(val, "ErrorSeverity", &s.ErrorSeverity) + case "kind": + err = unpopulate(val, "Kind", &s.Kind) delete(rawMsg, key) - case "statement": - err = unpopulate(val, "Statement", &s.Statement) + case "location": + err = unpopulate(val, "Location", &s.Location) delete(rawMsg, key) - case "statementHighlightLength": - err = unpopulate(val, "StatementHighlightLength", &s.StatementHighlightLength) + case "name": + err = unpopulate(val, "Name", &s.Name) delete(rawMsg, key) - case "statementHighlightOffset": - err = unpopulate(val, "StatementHighlightOffset", &s.StatementHighlightOffset) + case "properties": + err = unpopulate(val, "Properties", &s.Properties) delete(rawMsg, key) - case "threatId": - err = unpopulate(val, "ThreatID", &s.ThreatID) + case "tags": + err = unpopulate(val, "Tags", &s.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &s.Type) delete(rawMsg, key) } if err != nil { @@ -13527,16 +15659,19 @@ func (s *SecurityEventSQLInjectionAdditionalProperties) UnmarshalJSON(data []byt return nil } -// MarshalJSON implements the json.Marshaller interface for type SecurityEventsFilterParameters. -func (s SecurityEventsFilterParameters) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ServerAdvancedThreatProtection. +func (s ServerAdvancedThreatProtection) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populateTimeRFC3339(objectMap, "eventTime", s.EventTime) - populate(objectMap, "showServerRecords", s.ShowServerRecords) + populate(objectMap, "id", s.ID) + populate(objectMap, "name", s.Name) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "systemData", s.SystemData) + populate(objectMap, "type", s.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type SecurityEventsFilterParameters. -func (s *SecurityEventsFilterParameters) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ServerAdvancedThreatProtection. +func (s *ServerAdvancedThreatProtection) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -13544,11 +15679,20 @@ func (s *SecurityEventsFilterParameters) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "eventTime": - err = unpopulateTimeRFC3339(val, "EventTime", &s.EventTime) + case "id": + err = unpopulate(val, "ID", &s.ID) delete(rawMsg, key) - case "showServerRecords": - err = unpopulate(val, "ShowServerRecords", &s.ShowServerRecords) + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &s.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &s.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &s.Type) delete(rawMsg, key) } if err != nil { @@ -13558,19 +15702,18 @@ func (s *SecurityEventsFilterParameters) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type SensitivityLabel. -func (s SensitivityLabel) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ServerAutomaticTuning. +func (s ServerAutomaticTuning) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", s.ID) - populate(objectMap, "managedBy", s.ManagedBy) populate(objectMap, "name", s.Name) populate(objectMap, "properties", s.Properties) populate(objectMap, "type", s.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type SensitivityLabel. -func (s *SensitivityLabel) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ServerAutomaticTuning. +func (s *ServerAutomaticTuning) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -13581,9 +15724,6 @@ func (s *SensitivityLabel) UnmarshalJSON(data []byte) error { case "id": err = unpopulate(val, "ID", &s.ID) delete(rawMsg, key) - case "managedBy": - err = unpopulate(val, "ManagedBy", &s.ManagedBy) - delete(rawMsg, key) case "name": err = unpopulate(val, "Name", &s.Name) delete(rawMsg, key) @@ -13601,16 +15741,18 @@ func (s *SensitivityLabel) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type SensitivityLabelListResult. -func (s SensitivityLabelListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ServerAzureADAdministrator. +func (s ServerAzureADAdministrator) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", s.NextLink) - populate(objectMap, "value", s.Value) + populate(objectMap, "id", s.ID) + populate(objectMap, "name", s.Name) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "type", s.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type SensitivityLabelListResult. -func (s *SensitivityLabelListResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ServerAzureADAdministrator. +func (s *ServerAzureADAdministrator) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -13618,11 +15760,17 @@ func (s *SensitivityLabelListResult) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &s.NextLink) + case "id": + err = unpopulate(val, "ID", &s.ID) delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &s.Value) + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &s.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &s.Type) delete(rawMsg, key) } if err != nil { @@ -13632,23 +15780,18 @@ func (s *SensitivityLabelListResult) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type SensitivityLabelProperties. -func (s SensitivityLabelProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ServerAzureADOnlyAuthentication. +func (s ServerAzureADOnlyAuthentication) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "columnName", s.ColumnName) - populate(objectMap, "informationType", s.InformationType) - populate(objectMap, "informationTypeId", s.InformationTypeID) - populate(objectMap, "isDisabled", s.IsDisabled) - populate(objectMap, "labelId", s.LabelID) - populate(objectMap, "labelName", s.LabelName) - populate(objectMap, "rank", s.Rank) - populate(objectMap, "schemaName", s.SchemaName) - populate(objectMap, "tableName", s.TableName) + populate(objectMap, "id", s.ID) + populate(objectMap, "name", s.Name) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "type", s.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type SensitivityLabelProperties. -func (s *SensitivityLabelProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ServerAzureADOnlyAuthentication. +func (s *ServerAzureADOnlyAuthentication) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -13656,32 +15799,17 @@ func (s *SensitivityLabelProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "columnName": - err = unpopulate(val, "ColumnName", &s.ColumnName) - delete(rawMsg, key) - case "informationType": - err = unpopulate(val, "InformationType", &s.InformationType) - delete(rawMsg, key) - case "informationTypeId": - err = unpopulate(val, "InformationTypeID", &s.InformationTypeID) - delete(rawMsg, key) - case "isDisabled": - err = unpopulate(val, "IsDisabled", &s.IsDisabled) - delete(rawMsg, key) - case "labelId": - err = unpopulate(val, "LabelID", &s.LabelID) - delete(rawMsg, key) - case "labelName": - err = unpopulate(val, "LabelName", &s.LabelName) + case "id": + err = unpopulate(val, "ID", &s.ID) delete(rawMsg, key) - case "rank": - err = unpopulate(val, "Rank", &s.Rank) + case "name": + err = unpopulate(val, "Name", &s.Name) delete(rawMsg, key) - case "schemaName": - err = unpopulate(val, "SchemaName", &s.SchemaName) + case "properties": + err = unpopulate(val, "Properties", &s.Properties) delete(rawMsg, key) - case "tableName": - err = unpopulate(val, "TableName", &s.TableName) + case "type": + err = unpopulate(val, "Type", &s.Type) delete(rawMsg, key) } if err != nil { @@ -13691,8 +15819,8 @@ func (s *SensitivityLabelProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type SensitivityLabelUpdate. -func (s SensitivityLabelUpdate) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ServerBlobAuditingPolicy. +func (s ServerBlobAuditingPolicy) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", s.ID) populate(objectMap, "name", s.Name) @@ -13701,8 +15829,8 @@ func (s SensitivityLabelUpdate) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type SensitivityLabelUpdate. -func (s *SensitivityLabelUpdate) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ServerBlobAuditingPolicy. +func (s *ServerBlobAuditingPolicy) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -13730,15 +15858,16 @@ func (s *SensitivityLabelUpdate) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type SensitivityLabelUpdateList. -func (s SensitivityLabelUpdateList) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ServerBlobAuditingPolicyListResult. +func (s ServerBlobAuditingPolicyListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "operations", s.Operations) + populate(objectMap, "nextLink", s.NextLink) + populate(objectMap, "value", s.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type SensitivityLabelUpdateList. -func (s *SensitivityLabelUpdateList) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ServerBlobAuditingPolicyListResult. +func (s *ServerBlobAuditingPolicyListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -13746,8 +15875,11 @@ func (s *SensitivityLabelUpdateList) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "operations": - err = unpopulate(val, "Operations", &s.Operations) + case "nextLink": + err = unpopulate(val, "NextLink", &s.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &s.Value) delete(rawMsg, key) } if err != nil { @@ -13757,19 +15889,25 @@ func (s *SensitivityLabelUpdateList) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type SensitivityLabelUpdateProperties. -func (s SensitivityLabelUpdateProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ServerBlobAuditingPolicyProperties. +func (s ServerBlobAuditingPolicyProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "column", s.Column) - populate(objectMap, "op", s.Op) - populate(objectMap, "schema", s.Schema) - populate(objectMap, "sensitivityLabel", s.SensitivityLabel) - populate(objectMap, "table", s.Table) + populate(objectMap, "auditActionsAndGroups", s.AuditActionsAndGroups) + populate(objectMap, "isAzureMonitorTargetEnabled", s.IsAzureMonitorTargetEnabled) + populate(objectMap, "isDevopsAuditEnabled", s.IsDevopsAuditEnabled) + populate(objectMap, "isManagedIdentityInUse", s.IsManagedIdentityInUse) + populate(objectMap, "isStorageSecondaryKeyInUse", s.IsStorageSecondaryKeyInUse) + populate(objectMap, "queueDelayMs", s.QueueDelayMs) + populate(objectMap, "retentionDays", s.RetentionDays) + populate(objectMap, "state", s.State) + populate(objectMap, "storageAccountAccessKey", s.StorageAccountAccessKey) + populate(objectMap, "storageAccountSubscriptionId", s.StorageAccountSubscriptionID) + populate(objectMap, "storageEndpoint", s.StorageEndpoint) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type SensitivityLabelUpdateProperties. -func (s *SensitivityLabelUpdateProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ServerBlobAuditingPolicyProperties. +func (s *ServerBlobAuditingPolicyProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -13777,20 +15915,38 @@ func (s *SensitivityLabelUpdateProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "column": - err = unpopulate(val, "Column", &s.Column) + case "auditActionsAndGroups": + err = unpopulate(val, "AuditActionsAndGroups", &s.AuditActionsAndGroups) delete(rawMsg, key) - case "op": - err = unpopulate(val, "Op", &s.Op) + case "isAzureMonitorTargetEnabled": + err = unpopulate(val, "IsAzureMonitorTargetEnabled", &s.IsAzureMonitorTargetEnabled) delete(rawMsg, key) - case "schema": - err = unpopulate(val, "Schema", &s.Schema) + case "isDevopsAuditEnabled": + err = unpopulate(val, "IsDevopsAuditEnabled", &s.IsDevopsAuditEnabled) delete(rawMsg, key) - case "sensitivityLabel": - err = unpopulate(val, "SensitivityLabel", &s.SensitivityLabel) + case "isManagedIdentityInUse": + err = unpopulate(val, "IsManagedIdentityInUse", &s.IsManagedIdentityInUse) delete(rawMsg, key) - case "table": - err = unpopulate(val, "Table", &s.Table) + case "isStorageSecondaryKeyInUse": + err = unpopulate(val, "IsStorageSecondaryKeyInUse", &s.IsStorageSecondaryKeyInUse) + delete(rawMsg, key) + case "queueDelayMs": + err = unpopulate(val, "QueueDelayMs", &s.QueueDelayMs) + delete(rawMsg, key) + case "retentionDays": + err = unpopulate(val, "RetentionDays", &s.RetentionDays) + delete(rawMsg, key) + case "state": + err = unpopulate(val, "State", &s.State) + delete(rawMsg, key) + case "storageAccountAccessKey": + err = unpopulate(val, "StorageAccountAccessKey", &s.StorageAccountAccessKey) + delete(rawMsg, key) + case "storageAccountSubscriptionId": + err = unpopulate(val, "StorageAccountSubscriptionID", &s.StorageAccountSubscriptionID) + delete(rawMsg, key) + case "storageEndpoint": + err = unpopulate(val, "StorageEndpoint", &s.StorageEndpoint) delete(rawMsg, key) } if err != nil { @@ -13800,22 +15956,18 @@ func (s *SensitivityLabelUpdateProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type Server. -func (s Server) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ServerConfigurationOption. +func (s ServerConfigurationOption) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", s.ID) - populate(objectMap, "identity", s.Identity) - populate(objectMap, "kind", s.Kind) - populate(objectMap, "location", s.Location) populate(objectMap, "name", s.Name) populate(objectMap, "properties", s.Properties) - populate(objectMap, "tags", s.Tags) populate(objectMap, "type", s.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type Server. -func (s *Server) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ServerConfigurationOption. +func (s *ServerConfigurationOption) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -13826,24 +15978,12 @@ func (s *Server) UnmarshalJSON(data []byte) error { case "id": err = unpopulate(val, "ID", &s.ID) delete(rawMsg, key) - case "identity": - err = unpopulate(val, "Identity", &s.Identity) - delete(rawMsg, key) - case "kind": - err = unpopulate(val, "Kind", &s.Kind) - delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &s.Location) - delete(rawMsg, key) case "name": err = unpopulate(val, "Name", &s.Name) delete(rawMsg, key) case "properties": err = unpopulate(val, "Properties", &s.Properties) delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &s.Tags) - delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &s.Type) delete(rawMsg, key) @@ -13855,19 +15995,16 @@ func (s *Server) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ServerAdvancedThreatProtection. -func (s ServerAdvancedThreatProtection) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ServerConfigurationOptionListResult. +func (s ServerConfigurationOptionListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", s.ID) - populate(objectMap, "name", s.Name) - populate(objectMap, "properties", s.Properties) - populate(objectMap, "systemData", s.SystemData) - populate(objectMap, "type", s.Type) + populate(objectMap, "nextLink", s.NextLink) + populate(objectMap, "value", s.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ServerAdvancedThreatProtection. -func (s *ServerAdvancedThreatProtection) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ServerConfigurationOptionListResult. +func (s *ServerConfigurationOptionListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -13875,20 +16012,11 @@ func (s *ServerAdvancedThreatProtection) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &s.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &s.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &s.Properties) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &s.SystemData) + case "nextLink": + err = unpopulate(val, "NextLink", &s.NextLink) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &s.Type) + case "value": + err = unpopulate(val, "Value", &s.Value) delete(rawMsg, key) } if err != nil { @@ -13898,18 +16026,16 @@ func (s *ServerAdvancedThreatProtection) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ServerAutomaticTuning. -func (s ServerAutomaticTuning) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ServerConfigurationOptionProperties. +func (s ServerConfigurationOptionProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", s.ID) - populate(objectMap, "name", s.Name) - populate(objectMap, "properties", s.Properties) - populate(objectMap, "type", s.Type) + populate(objectMap, "provisioningState", s.ProvisioningState) + populate(objectMap, "serverConfigurationOptionValue", s.ServerConfigurationOptionValue) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ServerAutomaticTuning. -func (s *ServerAutomaticTuning) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ServerConfigurationOptionProperties. +func (s *ServerConfigurationOptionProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -13917,17 +16043,11 @@ func (s *ServerAutomaticTuning) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &s.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &s.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &s.Properties) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &s.ProvisioningState) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &s.Type) + case "serverConfigurationOptionValue": + err = unpopulate(val, "ServerConfigurationOptionValue", &s.ServerConfigurationOptionValue) delete(rawMsg, key) } if err != nil { @@ -13937,18 +16057,20 @@ func (s *ServerAutomaticTuning) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ServerAzureADAdministrator. -func (s ServerAzureADAdministrator) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ServerConnectionPolicy. +func (s ServerConnectionPolicy) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", s.ID) + populate(objectMap, "kind", s.Kind) + populate(objectMap, "location", s.Location) populate(objectMap, "name", s.Name) populate(objectMap, "properties", s.Properties) populate(objectMap, "type", s.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ServerAzureADAdministrator. -func (s *ServerAzureADAdministrator) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ServerConnectionPolicy. +func (s *ServerConnectionPolicy) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -13959,6 +16081,12 @@ func (s *ServerAzureADAdministrator) UnmarshalJSON(data []byte) error { case "id": err = unpopulate(val, "ID", &s.ID) delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &s.Kind) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &s.Location) + delete(rawMsg, key) case "name": err = unpopulate(val, "Name", &s.Name) delete(rawMsg, key) @@ -13976,18 +16104,16 @@ func (s *ServerAzureADAdministrator) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ServerAzureADOnlyAuthentication. -func (s ServerAzureADOnlyAuthentication) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ServerConnectionPolicyListResult. +func (s ServerConnectionPolicyListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", s.ID) - populate(objectMap, "name", s.Name) - populate(objectMap, "properties", s.Properties) - populate(objectMap, "type", s.Type) + populate(objectMap, "nextLink", s.NextLink) + populate(objectMap, "value", s.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ServerAzureADOnlyAuthentication. -func (s *ServerAzureADOnlyAuthentication) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ServerConnectionPolicyListResult. +func (s *ServerConnectionPolicyListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -13995,17 +16121,38 @@ func (s *ServerAzureADOnlyAuthentication) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &s.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &s.Name) + case "nextLink": + err = unpopulate(val, "NextLink", &s.NextLink) delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &s.Properties) + case "value": + err = unpopulate(val, "Value", &s.Value) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &s.Type) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ServerConnectionPolicyProperties. +func (s ServerConnectionPolicyProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "connectionType", s.ConnectionType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ServerConnectionPolicyProperties. +func (s *ServerConnectionPolicyProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "connectionType": + err = unpopulate(val, "ConnectionType", &s.ConnectionType) delete(rawMsg, key) } if err != nil { @@ -14015,8 +16162,8 @@ func (s *ServerAzureADOnlyAuthentication) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ServerBlobAuditingPolicy. -func (s ServerBlobAuditingPolicy) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ServerDNSAlias. +func (s ServerDNSAlias) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", s.ID) populate(objectMap, "name", s.Name) @@ -14025,8 +16172,8 @@ func (s ServerBlobAuditingPolicy) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ServerBlobAuditingPolicy. -func (s *ServerBlobAuditingPolicy) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ServerDNSAlias. +func (s *ServerDNSAlias) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -14054,16 +16201,15 @@ func (s *ServerBlobAuditingPolicy) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ServerBlobAuditingPolicyListResult. -func (s ServerBlobAuditingPolicyListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ServerDNSAliasAcquisition. +func (s ServerDNSAliasAcquisition) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", s.NextLink) - populate(objectMap, "value", s.Value) + populate(objectMap, "oldServerDnsAliasId", s.OldServerDNSAliasID) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ServerBlobAuditingPolicyListResult. -func (s *ServerBlobAuditingPolicyListResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ServerDNSAliasAcquisition. +func (s *ServerDNSAliasAcquisition) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -14071,11 +16217,8 @@ func (s *ServerBlobAuditingPolicyListResult) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &s.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &s.Value) + case "oldServerDnsAliasId": + err = unpopulate(val, "OldServerDNSAliasID", &s.OldServerDNSAliasID) delete(rawMsg, key) } if err != nil { @@ -14085,64 +16228,28 @@ func (s *ServerBlobAuditingPolicyListResult) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ServerBlobAuditingPolicyProperties. -func (s ServerBlobAuditingPolicyProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ServerDNSAliasListResult. +func (s ServerDNSAliasListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "auditActionsAndGroups", s.AuditActionsAndGroups) - populate(objectMap, "isAzureMonitorTargetEnabled", s.IsAzureMonitorTargetEnabled) - populate(objectMap, "isDevopsAuditEnabled", s.IsDevopsAuditEnabled) - populate(objectMap, "isManagedIdentityInUse", s.IsManagedIdentityInUse) - populate(objectMap, "isStorageSecondaryKeyInUse", s.IsStorageSecondaryKeyInUse) - populate(objectMap, "queueDelayMs", s.QueueDelayMs) - populate(objectMap, "retentionDays", s.RetentionDays) - populate(objectMap, "state", s.State) - populate(objectMap, "storageAccountAccessKey", s.StorageAccountAccessKey) - populate(objectMap, "storageAccountSubscriptionId", s.StorageAccountSubscriptionID) - populate(objectMap, "storageEndpoint", s.StorageEndpoint) + populate(objectMap, "nextLink", s.NextLink) + populate(objectMap, "value", s.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ServerBlobAuditingPolicyProperties. -func (s *ServerBlobAuditingPolicyProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "auditActionsAndGroups": - err = unpopulate(val, "AuditActionsAndGroups", &s.AuditActionsAndGroups) - delete(rawMsg, key) - case "isAzureMonitorTargetEnabled": - err = unpopulate(val, "IsAzureMonitorTargetEnabled", &s.IsAzureMonitorTargetEnabled) - delete(rawMsg, key) - case "isDevopsAuditEnabled": - err = unpopulate(val, "IsDevopsAuditEnabled", &s.IsDevopsAuditEnabled) - delete(rawMsg, key) - case "isManagedIdentityInUse": - err = unpopulate(val, "IsManagedIdentityInUse", &s.IsManagedIdentityInUse) - delete(rawMsg, key) - case "isStorageSecondaryKeyInUse": - err = unpopulate(val, "IsStorageSecondaryKeyInUse", &s.IsStorageSecondaryKeyInUse) - delete(rawMsg, key) - case "queueDelayMs": - err = unpopulate(val, "QueueDelayMs", &s.QueueDelayMs) - delete(rawMsg, key) - case "retentionDays": - err = unpopulate(val, "RetentionDays", &s.RetentionDays) - delete(rawMsg, key) - case "state": - err = unpopulate(val, "State", &s.State) - delete(rawMsg, key) - case "storageAccountAccessKey": - err = unpopulate(val, "StorageAccountAccessKey", &s.StorageAccountAccessKey) - delete(rawMsg, key) - case "storageAccountSubscriptionId": - err = unpopulate(val, "StorageAccountSubscriptionID", &s.StorageAccountSubscriptionID) +// UnmarshalJSON implements the json.Unmarshaller interface for type ServerDNSAliasListResult. +func (s *ServerDNSAliasListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &s.NextLink) delete(rawMsg, key) - case "storageEndpoint": - err = unpopulate(val, "StorageEndpoint", &s.StorageEndpoint) + case "value": + err = unpopulate(val, "Value", &s.Value) delete(rawMsg, key) } if err != nil { @@ -14152,20 +16259,15 @@ func (s *ServerBlobAuditingPolicyProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ServerCommunicationLink. -func (s ServerCommunicationLink) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ServerDNSAliasProperties. +func (s ServerDNSAliasProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", s.ID) - populate(objectMap, "kind", s.Kind) - populate(objectMap, "location", s.Location) - populate(objectMap, "name", s.Name) - populate(objectMap, "properties", s.Properties) - populate(objectMap, "type", s.Type) + populate(objectMap, "azureDnsRecord", s.AzureDNSRecord) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ServerCommunicationLink. -func (s *ServerCommunicationLink) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ServerDNSAliasProperties. +func (s *ServerDNSAliasProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -14173,23 +16275,8 @@ func (s *ServerCommunicationLink) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &s.ID) - delete(rawMsg, key) - case "kind": - err = unpopulate(val, "Kind", &s.Kind) - delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &s.Location) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &s.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &s.Properties) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &s.Type) + case "azureDnsRecord": + err = unpopulate(val, "AzureDNSRecord", &s.AzureDNSRecord) delete(rawMsg, key) } if err != nil { @@ -14199,15 +16286,16 @@ func (s *ServerCommunicationLink) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ServerCommunicationLinkListResult. -func (s ServerCommunicationLinkListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ServerDevOpsAuditSettingsListResult. +func (s ServerDevOpsAuditSettingsListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "nextLink", s.NextLink) populate(objectMap, "value", s.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ServerCommunicationLinkListResult. -func (s *ServerCommunicationLinkListResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ServerDevOpsAuditSettingsListResult. +func (s *ServerDevOpsAuditSettingsListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -14215,6 +16303,9 @@ func (s *ServerCommunicationLinkListResult) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &s.NextLink) + delete(rawMsg, key) case "value": err = unpopulate(val, "Value", &s.Value) delete(rawMsg, key) @@ -14226,16 +16317,20 @@ func (s *ServerCommunicationLinkListResult) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ServerCommunicationLinkProperties. -func (s ServerCommunicationLinkProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ServerDevOpsAuditSettingsProperties. +func (s ServerDevOpsAuditSettingsProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "partnerServer", s.PartnerServer) + populate(objectMap, "isAzureMonitorTargetEnabled", s.IsAzureMonitorTargetEnabled) + populate(objectMap, "isManagedIdentityInUse", s.IsManagedIdentityInUse) populate(objectMap, "state", s.State) + populate(objectMap, "storageAccountAccessKey", s.StorageAccountAccessKey) + populate(objectMap, "storageAccountSubscriptionId", s.StorageAccountSubscriptionID) + populate(objectMap, "storageEndpoint", s.StorageEndpoint) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ServerCommunicationLinkProperties. -func (s *ServerCommunicationLinkProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ServerDevOpsAuditSettingsProperties. +func (s *ServerDevOpsAuditSettingsProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -14243,12 +16338,24 @@ func (s *ServerCommunicationLinkProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "partnerServer": - err = unpopulate(val, "PartnerServer", &s.PartnerServer) + case "isAzureMonitorTargetEnabled": + err = unpopulate(val, "IsAzureMonitorTargetEnabled", &s.IsAzureMonitorTargetEnabled) + delete(rawMsg, key) + case "isManagedIdentityInUse": + err = unpopulate(val, "IsManagedIdentityInUse", &s.IsManagedIdentityInUse) delete(rawMsg, key) case "state": err = unpopulate(val, "State", &s.State) delete(rawMsg, key) + case "storageAccountAccessKey": + err = unpopulate(val, "StorageAccountAccessKey", &s.StorageAccountAccessKey) + delete(rawMsg, key) + case "storageAccountSubscriptionId": + err = unpopulate(val, "StorageAccountSubscriptionID", &s.StorageAccountSubscriptionID) + delete(rawMsg, key) + case "storageEndpoint": + err = unpopulate(val, "StorageEndpoint", &s.StorageEndpoint) + delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -14257,20 +16364,19 @@ func (s *ServerCommunicationLinkProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ServerConnectionPolicy. -func (s ServerConnectionPolicy) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ServerDevOpsAuditingSettings. +func (s ServerDevOpsAuditingSettings) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", s.ID) - populate(objectMap, "kind", s.Kind) - populate(objectMap, "location", s.Location) populate(objectMap, "name", s.Name) populate(objectMap, "properties", s.Properties) + populate(objectMap, "systemData", s.SystemData) populate(objectMap, "type", s.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ServerConnectionPolicy. -func (s *ServerConnectionPolicy) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ServerDevOpsAuditingSettings. +func (s *ServerDevOpsAuditingSettings) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -14281,18 +16387,15 @@ func (s *ServerConnectionPolicy) UnmarshalJSON(data []byte) error { case "id": err = unpopulate(val, "ID", &s.ID) delete(rawMsg, key) - case "kind": - err = unpopulate(val, "Kind", &s.Kind) - delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &s.Location) - delete(rawMsg, key) case "name": err = unpopulate(val, "Name", &s.Name) delete(rawMsg, key) case "properties": err = unpopulate(val, "Properties", &s.Properties) delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &s.SystemData) + delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &s.Type) delete(rawMsg, key) @@ -14304,16 +16407,20 @@ func (s *ServerConnectionPolicy) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ServerConnectionPolicyListResult. -func (s ServerConnectionPolicyListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ServerExternalAdministrator. +func (s ServerExternalAdministrator) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", s.NextLink) - populate(objectMap, "value", s.Value) + populate(objectMap, "administratorType", s.AdministratorType) + populate(objectMap, "azureADOnlyAuthentication", s.AzureADOnlyAuthentication) + populate(objectMap, "login", s.Login) + populate(objectMap, "principalType", s.PrincipalType) + populate(objectMap, "sid", s.Sid) + populate(objectMap, "tenantId", s.TenantID) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ServerConnectionPolicyListResult. -func (s *ServerConnectionPolicyListResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ServerExternalAdministrator. +func (s *ServerExternalAdministrator) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -14321,11 +16428,23 @@ func (s *ServerConnectionPolicyListResult) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &s.NextLink) + case "administratorType": + err = unpopulate(val, "AdministratorType", &s.AdministratorType) delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &s.Value) + case "azureADOnlyAuthentication": + err = unpopulate(val, "AzureADOnlyAuthentication", &s.AzureADOnlyAuthentication) + delete(rawMsg, key) + case "login": + err = unpopulate(val, "Login", &s.Login) + delete(rawMsg, key) + case "principalType": + err = unpopulate(val, "PrincipalType", &s.PrincipalType) + delete(rawMsg, key) + case "sid": + err = unpopulate(val, "Sid", &s.Sid) + delete(rawMsg, key) + case "tenantId": + err = unpopulate(val, "TenantID", &s.TenantID) delete(rawMsg, key) } if err != nil { @@ -14335,15 +16454,16 @@ func (s *ServerConnectionPolicyListResult) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ServerConnectionPolicyProperties. -func (s ServerConnectionPolicyProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ServerFirewallRuleProperties. +func (s ServerFirewallRuleProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "connectionType", s.ConnectionType) + populate(objectMap, "endIpAddress", s.EndIPAddress) + populate(objectMap, "startIpAddress", s.StartIPAddress) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ServerConnectionPolicyProperties. -func (s *ServerConnectionPolicyProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ServerFirewallRuleProperties. +func (s *ServerFirewallRuleProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -14351,8 +16471,11 @@ func (s *ServerConnectionPolicyProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "connectionType": - err = unpopulate(val, "ConnectionType", &s.ConnectionType) + case "endIpAddress": + err = unpopulate(val, "EndIPAddress", &s.EndIPAddress) + delete(rawMsg, key) + case "startIpAddress": + err = unpopulate(val, "StartIPAddress", &s.StartIPAddress) delete(rawMsg, key) } if err != nil { @@ -14362,18 +16485,15 @@ func (s *ServerConnectionPolicyProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ServerDNSAlias. -func (s ServerDNSAlias) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ServerInfo. +func (s ServerInfo) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", s.ID) - populate(objectMap, "name", s.Name) - populate(objectMap, "properties", s.Properties) - populate(objectMap, "type", s.Type) + populate(objectMap, "serverId", s.ServerID) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ServerDNSAlias. -func (s *ServerDNSAlias) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ServerInfo. +func (s *ServerInfo) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -14381,17 +16501,8 @@ func (s *ServerDNSAlias) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &s.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &s.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &s.Properties) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &s.Type) + case "serverId": + err = unpopulate(val, "ServerID", &s.ServerID) delete(rawMsg, key) } if err != nil { @@ -14401,15 +16512,20 @@ func (s *ServerDNSAlias) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ServerDNSAliasAcquisition. -func (s ServerDNSAliasAcquisition) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ServerKey. +func (s ServerKey) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "oldServerDnsAliasId", s.OldServerDNSAliasID) + populate(objectMap, "id", s.ID) + populate(objectMap, "kind", s.Kind) + populate(objectMap, "location", s.Location) + populate(objectMap, "name", s.Name) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "type", s.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ServerDNSAliasAcquisition. -func (s *ServerDNSAliasAcquisition) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ServerKey. +func (s *ServerKey) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -14417,8 +16533,23 @@ func (s *ServerDNSAliasAcquisition) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "oldServerDnsAliasId": - err = unpopulate(val, "OldServerDNSAliasID", &s.OldServerDNSAliasID) + case "id": + err = unpopulate(val, "ID", &s.ID) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &s.Kind) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &s.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &s.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &s.Type) delete(rawMsg, key) } if err != nil { @@ -14428,16 +16559,16 @@ func (s *ServerDNSAliasAcquisition) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ServerDNSAliasListResult. -func (s ServerDNSAliasListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ServerKeyListResult. +func (s ServerKeyListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "nextLink", s.NextLink) populate(objectMap, "value", s.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ServerDNSAliasListResult. -func (s *ServerDNSAliasListResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ServerKeyListResult. +func (s *ServerKeyListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -14459,15 +16590,20 @@ func (s *ServerDNSAliasListResult) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ServerDNSAliasProperties. -func (s ServerDNSAliasProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ServerKeyProperties. +func (s ServerKeyProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "azureDnsRecord", s.AzureDNSRecord) + populate(objectMap, "autoRotationEnabled", s.AutoRotationEnabled) + populateTimeRFC3339(objectMap, "creationDate", s.CreationDate) + populate(objectMap, "serverKeyType", s.ServerKeyType) + populate(objectMap, "subregion", s.Subregion) + populate(objectMap, "thumbprint", s.Thumbprint) + populate(objectMap, "uri", s.URI) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ServerDNSAliasProperties. -func (s *ServerDNSAliasProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ServerKeyProperties. +func (s *ServerKeyProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -14475,8 +16611,23 @@ func (s *ServerDNSAliasProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "azureDnsRecord": - err = unpopulate(val, "AzureDNSRecord", &s.AzureDNSRecord) + case "autoRotationEnabled": + err = unpopulate(val, "AutoRotationEnabled", &s.AutoRotationEnabled) + delete(rawMsg, key) + case "creationDate": + err = unpopulateTimeRFC3339(val, "CreationDate", &s.CreationDate) + delete(rawMsg, key) + case "serverKeyType": + err = unpopulate(val, "ServerKeyType", &s.ServerKeyType) + delete(rawMsg, key) + case "subregion": + err = unpopulate(val, "Subregion", &s.Subregion) + delete(rawMsg, key) + case "thumbprint": + err = unpopulate(val, "Thumbprint", &s.Thumbprint) + delete(rawMsg, key) + case "uri": + err = unpopulate(val, "URI", &s.URI) delete(rawMsg, key) } if err != nil { @@ -14486,16 +16637,16 @@ func (s *ServerDNSAliasProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ServerDevOpsAuditSettingsListResult. -func (s ServerDevOpsAuditSettingsListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ServerListResult. +func (s ServerListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "nextLink", s.NextLink) populate(objectMap, "value", s.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ServerDevOpsAuditSettingsListResult. -func (s *ServerDevOpsAuditSettingsListResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ServerListResult. +func (s *ServerListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -14517,19 +16668,18 @@ func (s *ServerDevOpsAuditSettingsListResult) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ServerDevOpsAuditSettingsProperties. -func (s ServerDevOpsAuditSettingsProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ServerOperation. +func (s ServerOperation) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "isAzureMonitorTargetEnabled", s.IsAzureMonitorTargetEnabled) - populate(objectMap, "state", s.State) - populate(objectMap, "storageAccountAccessKey", s.StorageAccountAccessKey) - populate(objectMap, "storageAccountSubscriptionId", s.StorageAccountSubscriptionID) - populate(objectMap, "storageEndpoint", s.StorageEndpoint) + populate(objectMap, "id", s.ID) + populate(objectMap, "name", s.Name) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "type", s.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ServerDevOpsAuditSettingsProperties. -func (s *ServerDevOpsAuditSettingsProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ServerOperation. +func (s *ServerOperation) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -14537,20 +16687,17 @@ func (s *ServerDevOpsAuditSettingsProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "isAzureMonitorTargetEnabled": - err = unpopulate(val, "IsAzureMonitorTargetEnabled", &s.IsAzureMonitorTargetEnabled) - delete(rawMsg, key) - case "state": - err = unpopulate(val, "State", &s.State) + case "id": + err = unpopulate(val, "ID", &s.ID) delete(rawMsg, key) - case "storageAccountAccessKey": - err = unpopulate(val, "StorageAccountAccessKey", &s.StorageAccountAccessKey) + case "name": + err = unpopulate(val, "Name", &s.Name) delete(rawMsg, key) - case "storageAccountSubscriptionId": - err = unpopulate(val, "StorageAccountSubscriptionID", &s.StorageAccountSubscriptionID) + case "properties": + err = unpopulate(val, "Properties", &s.Properties) delete(rawMsg, key) - case "storageEndpoint": - err = unpopulate(val, "StorageEndpoint", &s.StorageEndpoint) + case "type": + err = unpopulate(val, "Type", &s.Type) delete(rawMsg, key) } if err != nil { @@ -14560,19 +16707,16 @@ func (s *ServerDevOpsAuditSettingsProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ServerDevOpsAuditingSettings. -func (s ServerDevOpsAuditingSettings) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ServerOperationListResult. +func (s ServerOperationListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", s.ID) - populate(objectMap, "name", s.Name) - populate(objectMap, "properties", s.Properties) - populate(objectMap, "systemData", s.SystemData) - populate(objectMap, "type", s.Type) + populate(objectMap, "nextLink", s.NextLink) + populate(objectMap, "value", s.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ServerDevOpsAuditingSettings. -func (s *ServerDevOpsAuditingSettings) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ServerOperationListResult. +func (s *ServerOperationListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -14580,20 +16724,11 @@ func (s *ServerDevOpsAuditingSettings) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &s.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &s.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &s.Properties) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &s.SystemData) + case "nextLink": + err = unpopulate(val, "NextLink", &s.NextLink) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &s.Type) + case "value": + err = unpopulate(val, "Value", &s.Value) delete(rawMsg, key) } if err != nil { @@ -14603,20 +16738,27 @@ func (s *ServerDevOpsAuditingSettings) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ServerExternalAdministrator. -func (s ServerExternalAdministrator) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ServerOperationProperties. +func (s ServerOperationProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "administratorType", s.AdministratorType) - populate(objectMap, "azureADOnlyAuthentication", s.AzureADOnlyAuthentication) - populate(objectMap, "login", s.Login) - populate(objectMap, "principalType", s.PrincipalType) - populate(objectMap, "sid", s.Sid) - populate(objectMap, "tenantId", s.TenantID) + populate(objectMap, "description", s.Description) + populate(objectMap, "errorCode", s.ErrorCode) + populate(objectMap, "errorDescription", s.ErrorDescription) + populate(objectMap, "errorSeverity", s.ErrorSeverity) + populateTimeRFC3339(objectMap, "estimatedCompletionTime", s.EstimatedCompletionTime) + populate(objectMap, "isCancellable", s.IsCancellable) + populate(objectMap, "isUserError", s.IsUserError) + populate(objectMap, "operation", s.Operation) + populate(objectMap, "operationFriendlyName", s.OperationFriendlyName) + populate(objectMap, "percentComplete", s.PercentComplete) + populate(objectMap, "serverName", s.ServerName) + populateTimeRFC3339(objectMap, "startTime", s.StartTime) + populate(objectMap, "state", s.State) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ServerExternalAdministrator. -func (s *ServerExternalAdministrator) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ServerOperationProperties. +func (s *ServerOperationProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -14624,23 +16766,44 @@ func (s *ServerExternalAdministrator) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "administratorType": - err = unpopulate(val, "AdministratorType", &s.AdministratorType) + case "description": + err = unpopulate(val, "Description", &s.Description) delete(rawMsg, key) - case "azureADOnlyAuthentication": - err = unpopulate(val, "AzureADOnlyAuthentication", &s.AzureADOnlyAuthentication) + case "errorCode": + err = unpopulate(val, "ErrorCode", &s.ErrorCode) delete(rawMsg, key) - case "login": - err = unpopulate(val, "Login", &s.Login) + case "errorDescription": + err = unpopulate(val, "ErrorDescription", &s.ErrorDescription) delete(rawMsg, key) - case "principalType": - err = unpopulate(val, "PrincipalType", &s.PrincipalType) + case "errorSeverity": + err = unpopulate(val, "ErrorSeverity", &s.ErrorSeverity) delete(rawMsg, key) - case "sid": - err = unpopulate(val, "Sid", &s.Sid) + case "estimatedCompletionTime": + err = unpopulateTimeRFC3339(val, "EstimatedCompletionTime", &s.EstimatedCompletionTime) delete(rawMsg, key) - case "tenantId": - err = unpopulate(val, "TenantID", &s.TenantID) + case "isCancellable": + err = unpopulate(val, "IsCancellable", &s.IsCancellable) + delete(rawMsg, key) + case "isUserError": + err = unpopulate(val, "IsUserError", &s.IsUserError) + delete(rawMsg, key) + case "operation": + err = unpopulate(val, "Operation", &s.Operation) + delete(rawMsg, key) + case "operationFriendlyName": + err = unpopulate(val, "OperationFriendlyName", &s.OperationFriendlyName) + delete(rawMsg, key) + case "percentComplete": + err = unpopulate(val, "PercentComplete", &s.PercentComplete) + delete(rawMsg, key) + case "serverName": + err = unpopulate(val, "ServerName", &s.ServerName) + delete(rawMsg, key) + case "startTime": + err = unpopulateTimeRFC3339(val, "StartTime", &s.StartTime) + delete(rawMsg, key) + case "state": + err = unpopulate(val, "State", &s.State) delete(rawMsg, key) } if err != nil { @@ -14650,16 +16813,16 @@ func (s *ServerExternalAdministrator) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ServerFirewallRuleProperties. -func (s ServerFirewallRuleProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ServerPrivateEndpointConnection. +func (s ServerPrivateEndpointConnection) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "endIpAddress", s.EndIPAddress) - populate(objectMap, "startIpAddress", s.StartIPAddress) + populate(objectMap, "id", s.ID) + populate(objectMap, "properties", s.Properties) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ServerFirewallRuleProperties. -func (s *ServerFirewallRuleProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ServerPrivateEndpointConnection. +func (s *ServerPrivateEndpointConnection) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -14667,11 +16830,11 @@ func (s *ServerFirewallRuleProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "endIpAddress": - err = unpopulate(val, "EndIPAddress", &s.EndIPAddress) + case "id": + err = unpopulate(val, "ID", &s.ID) delete(rawMsg, key) - case "startIpAddress": - err = unpopulate(val, "StartIPAddress", &s.StartIPAddress) + case "properties": + err = unpopulate(val, "Properties", &s.Properties) delete(rawMsg, key) } if err != nil { @@ -14681,15 +16844,29 @@ func (s *ServerFirewallRuleProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ServerInfo. -func (s ServerInfo) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ServerProperties. +func (s ServerProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "serverId", s.ServerID) + populate(objectMap, "administratorLogin", s.AdministratorLogin) + populate(objectMap, "administratorLoginPassword", s.AdministratorLoginPassword) + populate(objectMap, "administrators", s.Administrators) + populate(objectMap, "externalGovernanceStatus", s.ExternalGovernanceStatus) + populate(objectMap, "federatedClientId", s.FederatedClientID) + populate(objectMap, "fullyQualifiedDomainName", s.FullyQualifiedDomainName) + populate(objectMap, "keyId", s.KeyID) + populate(objectMap, "minimalTlsVersion", s.MinimalTLSVersion) + populate(objectMap, "primaryUserAssignedIdentityId", s.PrimaryUserAssignedIdentityID) + populate(objectMap, "privateEndpointConnections", s.PrivateEndpointConnections) + populate(objectMap, "publicNetworkAccess", s.PublicNetworkAccess) + populate(objectMap, "restrictOutboundNetworkAccess", s.RestrictOutboundNetworkAccess) + populate(objectMap, "state", s.State) + populate(objectMap, "version", s.Version) + populate(objectMap, "workspaceFeature", s.WorkspaceFeature) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ServerInfo. -func (s *ServerInfo) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ServerProperties. +func (s *ServerProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -14697,8 +16874,50 @@ func (s *ServerInfo) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "serverId": - err = unpopulate(val, "ServerID", &s.ServerID) + case "administratorLogin": + err = unpopulate(val, "AdministratorLogin", &s.AdministratorLogin) + delete(rawMsg, key) + case "administratorLoginPassword": + err = unpopulate(val, "AdministratorLoginPassword", &s.AdministratorLoginPassword) + delete(rawMsg, key) + case "administrators": + err = unpopulate(val, "Administrators", &s.Administrators) + delete(rawMsg, key) + case "externalGovernanceStatus": + err = unpopulate(val, "ExternalGovernanceStatus", &s.ExternalGovernanceStatus) + delete(rawMsg, key) + case "federatedClientId": + err = unpopulate(val, "FederatedClientID", &s.FederatedClientID) + delete(rawMsg, key) + case "fullyQualifiedDomainName": + err = unpopulate(val, "FullyQualifiedDomainName", &s.FullyQualifiedDomainName) + delete(rawMsg, key) + case "keyId": + err = unpopulate(val, "KeyID", &s.KeyID) + delete(rawMsg, key) + case "minimalTlsVersion": + err = unpopulate(val, "MinimalTLSVersion", &s.MinimalTLSVersion) + delete(rawMsg, key) + case "primaryUserAssignedIdentityId": + err = unpopulate(val, "PrimaryUserAssignedIdentityID", &s.PrimaryUserAssignedIdentityID) + delete(rawMsg, key) + case "privateEndpointConnections": + err = unpopulate(val, "PrivateEndpointConnections", &s.PrivateEndpointConnections) + delete(rawMsg, key) + case "publicNetworkAccess": + err = unpopulate(val, "PublicNetworkAccess", &s.PublicNetworkAccess) + delete(rawMsg, key) + case "restrictOutboundNetworkAccess": + err = unpopulate(val, "RestrictOutboundNetworkAccess", &s.RestrictOutboundNetworkAccess) + delete(rawMsg, key) + case "state": + err = unpopulate(val, "State", &s.State) + delete(rawMsg, key) + case "version": + err = unpopulate(val, "Version", &s.Version) + delete(rawMsg, key) + case "workspaceFeature": + err = unpopulate(val, "WorkspaceFeature", &s.WorkspaceFeature) delete(rawMsg, key) } if err != nil { @@ -14708,20 +16927,19 @@ func (s *ServerInfo) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ServerKey. -func (s ServerKey) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ServerSecurityAlertPolicy. +func (s ServerSecurityAlertPolicy) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", s.ID) - populate(objectMap, "kind", s.Kind) - populate(objectMap, "location", s.Location) populate(objectMap, "name", s.Name) populate(objectMap, "properties", s.Properties) + populate(objectMap, "systemData", s.SystemData) populate(objectMap, "type", s.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ServerKey. -func (s *ServerKey) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ServerSecurityAlertPolicy. +func (s *ServerSecurityAlertPolicy) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -14732,18 +16950,15 @@ func (s *ServerKey) UnmarshalJSON(data []byte) error { case "id": err = unpopulate(val, "ID", &s.ID) delete(rawMsg, key) - case "kind": - err = unpopulate(val, "Kind", &s.Kind) - delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &s.Location) - delete(rawMsg, key) case "name": err = unpopulate(val, "Name", &s.Name) delete(rawMsg, key) case "properties": err = unpopulate(val, "Properties", &s.Properties) delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &s.SystemData) + delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &s.Type) delete(rawMsg, key) @@ -14755,16 +16970,18 @@ func (s *ServerKey) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ServerKeyListResult. -func (s ServerKeyListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ServerTrustCertificate. +func (s ServerTrustCertificate) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", s.NextLink) - populate(objectMap, "value", s.Value) + populate(objectMap, "id", s.ID) + populate(objectMap, "name", s.Name) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "type", s.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ServerKeyListResult. -func (s *ServerKeyListResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ServerTrustCertificate. +func (s *ServerTrustCertificate) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -14772,11 +16989,17 @@ func (s *ServerKeyListResult) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &s.NextLink) + case "id": + err = unpopulate(val, "ID", &s.ID) delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &s.Value) + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &s.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &s.Type) delete(rawMsg, key) } if err != nil { @@ -14786,20 +17009,17 @@ func (s *ServerKeyListResult) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ServerKeyProperties. -func (s ServerKeyProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ServerTrustCertificateProperties. +func (s ServerTrustCertificateProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "autoRotationEnabled", s.AutoRotationEnabled) - populateTimeRFC3339(objectMap, "creationDate", s.CreationDate) - populate(objectMap, "serverKeyType", s.ServerKeyType) - populate(objectMap, "subregion", s.Subregion) + populate(objectMap, "certificateName", s.CertificateName) + populate(objectMap, "publicBlob", s.PublicBlob) populate(objectMap, "thumbprint", s.Thumbprint) - populate(objectMap, "uri", s.URI) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ServerKeyProperties. -func (s *ServerKeyProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ServerTrustCertificateProperties. +func (s *ServerTrustCertificateProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -14807,24 +17027,15 @@ func (s *ServerKeyProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "autoRotationEnabled": - err = unpopulate(val, "AutoRotationEnabled", &s.AutoRotationEnabled) - delete(rawMsg, key) - case "creationDate": - err = unpopulateTimeRFC3339(val, "CreationDate", &s.CreationDate) - delete(rawMsg, key) - case "serverKeyType": - err = unpopulate(val, "ServerKeyType", &s.ServerKeyType) + case "certificateName": + err = unpopulate(val, "CertificateName", &s.CertificateName) delete(rawMsg, key) - case "subregion": - err = unpopulate(val, "Subregion", &s.Subregion) + case "publicBlob": + err = unpopulate(val, "PublicBlob", &s.PublicBlob) delete(rawMsg, key) case "thumbprint": err = unpopulate(val, "Thumbprint", &s.Thumbprint) delete(rawMsg, key) - case "uri": - err = unpopulate(val, "URI", &s.URI) - delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -14833,16 +17044,16 @@ func (s *ServerKeyProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ServerListResult. -func (s ServerListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ServerTrustCertificatesListResult. +func (s ServerTrustCertificatesListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "nextLink", s.NextLink) populate(objectMap, "value", s.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ServerListResult. -func (s *ServerListResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ServerTrustCertificatesListResult. +func (s *ServerTrustCertificatesListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -14864,8 +17075,8 @@ func (s *ServerListResult) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ServerOperation. -func (s ServerOperation) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ServerTrustGroup. +func (s ServerTrustGroup) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", s.ID) populate(objectMap, "name", s.Name) @@ -14874,8 +17085,8 @@ func (s ServerOperation) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ServerOperation. -func (s *ServerOperation) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ServerTrustGroup. +func (s *ServerTrustGroup) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -14903,16 +17114,16 @@ func (s *ServerOperation) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ServerOperationListResult. -func (s ServerOperationListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ServerTrustGroupListResult. +func (s ServerTrustGroupListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "nextLink", s.NextLink) populate(objectMap, "value", s.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ServerOperationListResult. -func (s *ServerOperationListResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ServerTrustGroupListResult. +func (s *ServerTrustGroupListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -14934,27 +17145,16 @@ func (s *ServerOperationListResult) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ServerOperationProperties. -func (s ServerOperationProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ServerTrustGroupProperties. +func (s ServerTrustGroupProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "description", s.Description) - populate(objectMap, "errorCode", s.ErrorCode) - populate(objectMap, "errorDescription", s.ErrorDescription) - populate(objectMap, "errorSeverity", s.ErrorSeverity) - populateTimeRFC3339(objectMap, "estimatedCompletionTime", s.EstimatedCompletionTime) - populate(objectMap, "isCancellable", s.IsCancellable) - populate(objectMap, "isUserError", s.IsUserError) - populate(objectMap, "operation", s.Operation) - populate(objectMap, "operationFriendlyName", s.OperationFriendlyName) - populate(objectMap, "percentComplete", s.PercentComplete) - populate(objectMap, "serverName", s.ServerName) - populateTimeRFC3339(objectMap, "startTime", s.StartTime) - populate(objectMap, "state", s.State) + populate(objectMap, "groupMembers", s.GroupMembers) + populate(objectMap, "trustScopes", s.TrustScopes) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ServerOperationProperties. -func (s *ServerOperationProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ServerTrustGroupProperties. +func (s *ServerTrustGroupProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -14962,44 +17162,46 @@ func (s *ServerOperationProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "description": - err = unpopulate(val, "Description", &s.Description) - delete(rawMsg, key) - case "errorCode": - err = unpopulate(val, "ErrorCode", &s.ErrorCode) - delete(rawMsg, key) - case "errorDescription": - err = unpopulate(val, "ErrorDescription", &s.ErrorDescription) - delete(rawMsg, key) - case "errorSeverity": - err = unpopulate(val, "ErrorSeverity", &s.ErrorSeverity) - delete(rawMsg, key) - case "estimatedCompletionTime": - err = unpopulateTimeRFC3339(val, "EstimatedCompletionTime", &s.EstimatedCompletionTime) - delete(rawMsg, key) - case "isCancellable": - err = unpopulate(val, "IsCancellable", &s.IsCancellable) - delete(rawMsg, key) - case "isUserError": - err = unpopulate(val, "IsUserError", &s.IsUserError) - delete(rawMsg, key) - case "operation": - err = unpopulate(val, "Operation", &s.Operation) - delete(rawMsg, key) - case "operationFriendlyName": - err = unpopulate(val, "OperationFriendlyName", &s.OperationFriendlyName) + case "groupMembers": + err = unpopulate(val, "GroupMembers", &s.GroupMembers) delete(rawMsg, key) - case "percentComplete": - err = unpopulate(val, "PercentComplete", &s.PercentComplete) + case "trustScopes": + err = unpopulate(val, "TrustScopes", &s.TrustScopes) delete(rawMsg, key) - case "serverName": - err = unpopulate(val, "ServerName", &s.ServerName) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ServerUpdate. +func (s ServerUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "identity", s.Identity) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "tags", s.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ServerUpdate. +func (s *ServerUpdate) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "identity": + err = unpopulate(val, "Identity", &s.Identity) delete(rawMsg, key) - case "startTime": - err = unpopulateTimeRFC3339(val, "StartTime", &s.StartTime) + case "properties": + err = unpopulate(val, "Properties", &s.Properties) delete(rawMsg, key) - case "state": - err = unpopulate(val, "State", &s.State) + case "tags": + err = unpopulate(val, "Tags", &s.Tags) delete(rawMsg, key) } if err != nil { @@ -15009,16 +17211,18 @@ func (s *ServerOperationProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ServerPrivateEndpointConnection. -func (s ServerPrivateEndpointConnection) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ServerUsage. +func (s ServerUsage) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", s.ID) + populate(objectMap, "name", s.Name) populate(objectMap, "properties", s.Properties) + populate(objectMap, "type", s.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ServerPrivateEndpointConnection. -func (s *ServerPrivateEndpointConnection) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ServerUsage. +func (s *ServerUsage) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -15029,9 +17233,15 @@ func (s *ServerPrivateEndpointConnection) UnmarshalJSON(data []byte) error { case "id": err = unpopulate(val, "ID", &s.ID) delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) case "properties": err = unpopulate(val, "Properties", &s.Properties) delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &s.Type) + delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -15040,28 +17250,16 @@ func (s *ServerPrivateEndpointConnection) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ServerProperties. -func (s ServerProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ServerUsageListResult. +func (s ServerUsageListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "administratorLogin", s.AdministratorLogin) - populate(objectMap, "administratorLoginPassword", s.AdministratorLoginPassword) - populate(objectMap, "administrators", s.Administrators) - populate(objectMap, "federatedClientId", s.FederatedClientID) - populate(objectMap, "fullyQualifiedDomainName", s.FullyQualifiedDomainName) - populate(objectMap, "keyId", s.KeyID) - populate(objectMap, "minimalTlsVersion", s.MinimalTLSVersion) - populate(objectMap, "primaryUserAssignedIdentityId", s.PrimaryUserAssignedIdentityID) - populate(objectMap, "privateEndpointConnections", s.PrivateEndpointConnections) - populate(objectMap, "publicNetworkAccess", s.PublicNetworkAccess) - populate(objectMap, "restrictOutboundNetworkAccess", s.RestrictOutboundNetworkAccess) - populate(objectMap, "state", s.State) - populate(objectMap, "version", s.Version) - populate(objectMap, "workspaceFeature", s.WorkspaceFeature) + populate(objectMap, "nextLink", s.NextLink) + populate(objectMap, "value", s.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ServerProperties. -func (s *ServerProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ServerUsageListResult. +func (s *ServerUsageListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -15069,47 +17267,11 @@ func (s *ServerProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "administratorLogin": - err = unpopulate(val, "AdministratorLogin", &s.AdministratorLogin) - delete(rawMsg, key) - case "administratorLoginPassword": - err = unpopulate(val, "AdministratorLoginPassword", &s.AdministratorLoginPassword) - delete(rawMsg, key) - case "administrators": - err = unpopulate(val, "Administrators", &s.Administrators) - delete(rawMsg, key) - case "federatedClientId": - err = unpopulate(val, "FederatedClientID", &s.FederatedClientID) - delete(rawMsg, key) - case "fullyQualifiedDomainName": - err = unpopulate(val, "FullyQualifiedDomainName", &s.FullyQualifiedDomainName) - delete(rawMsg, key) - case "keyId": - err = unpopulate(val, "KeyID", &s.KeyID) - delete(rawMsg, key) - case "minimalTlsVersion": - err = unpopulate(val, "MinimalTLSVersion", &s.MinimalTLSVersion) - delete(rawMsg, key) - case "primaryUserAssignedIdentityId": - err = unpopulate(val, "PrimaryUserAssignedIdentityID", &s.PrimaryUserAssignedIdentityID) - delete(rawMsg, key) - case "privateEndpointConnections": - err = unpopulate(val, "PrivateEndpointConnections", &s.PrivateEndpointConnections) - delete(rawMsg, key) - case "publicNetworkAccess": - err = unpopulate(val, "PublicNetworkAccess", &s.PublicNetworkAccess) - delete(rawMsg, key) - case "restrictOutboundNetworkAccess": - err = unpopulate(val, "RestrictOutboundNetworkAccess", &s.RestrictOutboundNetworkAccess) - delete(rawMsg, key) - case "state": - err = unpopulate(val, "State", &s.State) - delete(rawMsg, key) - case "version": - err = unpopulate(val, "Version", &s.Version) + case "nextLink": + err = unpopulate(val, "NextLink", &s.NextLink) delete(rawMsg, key) - case "workspaceFeature": - err = unpopulate(val, "WorkspaceFeature", &s.WorkspaceFeature) + case "value": + err = unpopulate(val, "Value", &s.Value) delete(rawMsg, key) } if err != nil { @@ -15119,19 +17281,18 @@ func (s *ServerProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ServerSecurityAlertPolicy. -func (s ServerSecurityAlertPolicy) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ServerUsageProperties. +func (s ServerUsageProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", s.ID) - populate(objectMap, "name", s.Name) - populate(objectMap, "properties", s.Properties) - populate(objectMap, "systemData", s.SystemData) - populate(objectMap, "type", s.Type) + populate(objectMap, "currentValue", s.CurrentValue) + populate(objectMap, "displayName", s.DisplayName) + populate(objectMap, "limit", s.Limit) + populate(objectMap, "unit", s.Unit) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ServerSecurityAlertPolicy. -func (s *ServerSecurityAlertPolicy) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ServerUsageProperties. +func (s *ServerUsageProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -15139,20 +17300,17 @@ func (s *ServerSecurityAlertPolicy) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &s.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &s.Name) + case "currentValue": + err = unpopulate(val, "CurrentValue", &s.CurrentValue) delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &s.Properties) + case "displayName": + err = unpopulate(val, "DisplayName", &s.DisplayName) delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &s.SystemData) + case "limit": + err = unpopulate(val, "Limit", &s.Limit) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &s.Type) + case "unit": + err = unpopulate(val, "Unit", &s.Unit) delete(rawMsg, key) } if err != nil { @@ -15162,18 +17320,19 @@ func (s *ServerSecurityAlertPolicy) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ServerTrustCertificate. -func (s ServerTrustCertificate) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ServerVersionCapability. +func (s ServerVersionCapability) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", s.ID) populate(objectMap, "name", s.Name) - populate(objectMap, "properties", s.Properties) - populate(objectMap, "type", s.Type) + populate(objectMap, "reason", s.Reason) + populate(objectMap, "status", s.Status) + populate(objectMap, "supportedEditions", s.SupportedEditions) + populate(objectMap, "supportedElasticPoolEditions", s.SupportedElasticPoolEditions) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ServerTrustCertificate. -func (s *ServerTrustCertificate) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ServerVersionCapability. +func (s *ServerVersionCapability) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -15181,17 +17340,20 @@ func (s *ServerTrustCertificate) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &s.ID) - delete(rawMsg, key) case "name": err = unpopulate(val, "Name", &s.Name) delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &s.Properties) + case "reason": + err = unpopulate(val, "Reason", &s.Reason) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &s.Type) + case "status": + err = unpopulate(val, "Status", &s.Status) + delete(rawMsg, key) + case "supportedEditions": + err = unpopulate(val, "SupportedEditions", &s.SupportedEditions) + delete(rawMsg, key) + case "supportedElasticPoolEditions": + err = unpopulate(val, "SupportedElasticPoolEditions", &s.SupportedElasticPoolEditions) delete(rawMsg, key) } if err != nil { @@ -15201,17 +17363,18 @@ func (s *ServerTrustCertificate) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ServerTrustCertificateProperties. -func (s ServerTrustCertificateProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ServerVulnerabilityAssessment. +func (s ServerVulnerabilityAssessment) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "certificateName", s.CertificateName) - populate(objectMap, "publicBlob", s.PublicBlob) - populate(objectMap, "thumbprint", s.Thumbprint) + populate(objectMap, "id", s.ID) + populate(objectMap, "name", s.Name) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "type", s.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ServerTrustCertificateProperties. -func (s *ServerTrustCertificateProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ServerVulnerabilityAssessment. +func (s *ServerVulnerabilityAssessment) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -15219,14 +17382,17 @@ func (s *ServerTrustCertificateProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "certificateName": - err = unpopulate(val, "CertificateName", &s.CertificateName) + case "id": + err = unpopulate(val, "ID", &s.ID) delete(rawMsg, key) - case "publicBlob": - err = unpopulate(val, "PublicBlob", &s.PublicBlob) + case "name": + err = unpopulate(val, "Name", &s.Name) delete(rawMsg, key) - case "thumbprint": - err = unpopulate(val, "Thumbprint", &s.Thumbprint) + case "properties": + err = unpopulate(val, "Properties", &s.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &s.Type) delete(rawMsg, key) } if err != nil { @@ -15236,16 +17402,16 @@ func (s *ServerTrustCertificateProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ServerTrustCertificatesListResult. -func (s ServerTrustCertificatesListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ServerVulnerabilityAssessmentListResult. +func (s ServerVulnerabilityAssessmentListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "nextLink", s.NextLink) populate(objectMap, "value", s.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ServerTrustCertificatesListResult. -func (s *ServerTrustCertificatesListResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ServerVulnerabilityAssessmentListResult. +func (s *ServerVulnerabilityAssessmentListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -15267,18 +17433,18 @@ func (s *ServerTrustCertificatesListResult) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ServerTrustGroup. -func (s ServerTrustGroup) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ServerVulnerabilityAssessmentProperties. +func (s ServerVulnerabilityAssessmentProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", s.ID) - populate(objectMap, "name", s.Name) - populate(objectMap, "properties", s.Properties) - populate(objectMap, "type", s.Type) + populate(objectMap, "recurringScans", s.RecurringScans) + populate(objectMap, "storageAccountAccessKey", s.StorageAccountAccessKey) + populate(objectMap, "storageContainerPath", s.StorageContainerPath) + populate(objectMap, "storageContainerSasKey", s.StorageContainerSasKey) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ServerTrustGroup. -func (s *ServerTrustGroup) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ServerVulnerabilityAssessmentProperties. +func (s *ServerVulnerabilityAssessmentProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -15286,17 +17452,17 @@ func (s *ServerTrustGroup) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &s.ID) + case "recurringScans": + err = unpopulate(val, "RecurringScans", &s.RecurringScans) delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &s.Name) + case "storageAccountAccessKey": + err = unpopulate(val, "StorageAccountAccessKey", &s.StorageAccountAccessKey) delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &s.Properties) + case "storageContainerPath": + err = unpopulate(val, "StorageContainerPath", &s.StorageContainerPath) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &s.Type) + case "storageContainerSasKey": + err = unpopulate(val, "StorageContainerSasKey", &s.StorageContainerSasKey) delete(rawMsg, key) } if err != nil { @@ -15306,16 +17472,29 @@ func (s *ServerTrustGroup) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ServerTrustGroupListResult. -func (s ServerTrustGroupListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ServiceObjectiveCapability. +func (s ServiceObjectiveCapability) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", s.NextLink) - populate(objectMap, "value", s.Value) + populate(objectMap, "computeModel", s.ComputeModel) + populate(objectMap, "id", s.ID) + populate(objectMap, "includedMaxSize", s.IncludedMaxSize) + populate(objectMap, "name", s.Name) + populate(objectMap, "performanceLevel", s.PerformanceLevel) + populate(objectMap, "reason", s.Reason) + populate(objectMap, "sku", s.SKU) + populate(objectMap, "status", s.Status) + populate(objectMap, "supportedAutoPauseDelay", s.SupportedAutoPauseDelay) + populate(objectMap, "supportedLicenseTypes", s.SupportedLicenseTypes) + populate(objectMap, "supportedMaintenanceConfigurations", s.SupportedMaintenanceConfigurations) + populate(objectMap, "supportedMaxSizes", s.SupportedMaxSizes) + populate(objectMap, "supportedMinCapacities", s.SupportedMinCapacities) + populate(objectMap, "zonePinning", s.ZonePinning) + populate(objectMap, "zoneRedundant", s.ZoneRedundant) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ServerTrustGroupListResult. -func (s *ServerTrustGroupListResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ServiceObjectiveCapability. +func (s *ServiceObjectiveCapability) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -15323,11 +17502,50 @@ func (s *ServerTrustGroupListResult) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &s.NextLink) + case "computeModel": + err = unpopulate(val, "ComputeModel", &s.ComputeModel) delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &s.Value) + case "id": + err = unpopulate(val, "ID", &s.ID) + delete(rawMsg, key) + case "includedMaxSize": + err = unpopulate(val, "IncludedMaxSize", &s.IncludedMaxSize) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "performanceLevel": + err = unpopulate(val, "PerformanceLevel", &s.PerformanceLevel) + delete(rawMsg, key) + case "reason": + err = unpopulate(val, "Reason", &s.Reason) + delete(rawMsg, key) + case "sku": + err = unpopulate(val, "SKU", &s.SKU) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &s.Status) + delete(rawMsg, key) + case "supportedAutoPauseDelay": + err = unpopulate(val, "SupportedAutoPauseDelay", &s.SupportedAutoPauseDelay) + delete(rawMsg, key) + case "supportedLicenseTypes": + err = unpopulate(val, "SupportedLicenseTypes", &s.SupportedLicenseTypes) + delete(rawMsg, key) + case "supportedMaintenanceConfigurations": + err = unpopulate(val, "SupportedMaintenanceConfigurations", &s.SupportedMaintenanceConfigurations) + delete(rawMsg, key) + case "supportedMaxSizes": + err = unpopulate(val, "SupportedMaxSizes", &s.SupportedMaxSizes) + delete(rawMsg, key) + case "supportedMinCapacities": + err = unpopulate(val, "SupportedMinCapacities", &s.SupportedMinCapacities) + delete(rawMsg, key) + case "zonePinning": + err = unpopulate(val, "ZonePinning", &s.ZonePinning) + delete(rawMsg, key) + case "zoneRedundant": + err = unpopulate(val, "ZoneRedundant", &s.ZoneRedundant) delete(rawMsg, key) } if err != nil { @@ -15337,16 +17555,18 @@ func (s *ServerTrustGroupListResult) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ServerTrustGroupProperties. -func (s ServerTrustGroupProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ServicePrincipal. +func (s ServicePrincipal) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "groupMembers", s.GroupMembers) - populate(objectMap, "trustScopes", s.TrustScopes) + populate(objectMap, "clientId", s.ClientID) + populate(objectMap, "principalId", s.PrincipalID) + populate(objectMap, "tenantId", s.TenantID) + populate(objectMap, "type", s.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ServerTrustGroupProperties. -func (s *ServerTrustGroupProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ServicePrincipal. +func (s *ServicePrincipal) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -15354,11 +17574,17 @@ func (s *ServerTrustGroupProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "groupMembers": - err = unpopulate(val, "GroupMembers", &s.GroupMembers) + case "clientId": + err = unpopulate(val, "ClientID", &s.ClientID) delete(rawMsg, key) - case "trustScopes": - err = unpopulate(val, "TrustScopes", &s.TrustScopes) + case "principalId": + err = unpopulate(val, "PrincipalID", &s.PrincipalID) + delete(rawMsg, key) + case "tenantId": + err = unpopulate(val, "TenantID", &s.TenantID) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &s.Type) delete(rawMsg, key) } if err != nil { @@ -15368,17 +17594,19 @@ func (s *ServerTrustGroupProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ServerUpdate. -func (s ServerUpdate) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type StartStopManagedInstanceSchedule. +func (s StartStopManagedInstanceSchedule) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "identity", s.Identity) + populate(objectMap, "id", s.ID) + populate(objectMap, "name", s.Name) populate(objectMap, "properties", s.Properties) - populate(objectMap, "tags", s.Tags) + populate(objectMap, "systemData", s.SystemData) + populate(objectMap, "type", s.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ServerUpdate. -func (s *ServerUpdate) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type StartStopManagedInstanceSchedule. +func (s *StartStopManagedInstanceSchedule) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -15386,14 +17614,20 @@ func (s *ServerUpdate) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "identity": - err = unpopulate(val, "Identity", &s.Identity) + case "id": + err = unpopulate(val, "ID", &s.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &s.Name) delete(rawMsg, key) case "properties": err = unpopulate(val, "Properties", &s.Properties) delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &s.Tags) + case "systemData": + err = unpopulate(val, "SystemData", &s.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &s.Type) delete(rawMsg, key) } if err != nil { @@ -15403,21 +17637,16 @@ func (s *ServerUpdate) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ServerUsage. -func (s ServerUsage) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type StartStopManagedInstanceScheduleListResult. +func (s StartStopManagedInstanceScheduleListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "currentValue", s.CurrentValue) - populate(objectMap, "displayName", s.DisplayName) - populate(objectMap, "limit", s.Limit) - populate(objectMap, "name", s.Name) - populateTimeRFC3339(objectMap, "nextResetTime", s.NextResetTime) - populate(objectMap, "resourceName", s.ResourceName) - populate(objectMap, "unit", s.Unit) + populate(objectMap, "nextLink", s.NextLink) + populate(objectMap, "value", s.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ServerUsage. -func (s *ServerUsage) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type StartStopManagedInstanceScheduleListResult. +func (s *StartStopManagedInstanceScheduleListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -15425,26 +17654,11 @@ func (s *ServerUsage) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "currentValue": - err = unpopulate(val, "CurrentValue", &s.CurrentValue) - delete(rawMsg, key) - case "displayName": - err = unpopulate(val, "DisplayName", &s.DisplayName) - delete(rawMsg, key) - case "limit": - err = unpopulate(val, "Limit", &s.Limit) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &s.Name) - delete(rawMsg, key) - case "nextResetTime": - err = unpopulateTimeRFC3339(val, "NextResetTime", &s.NextResetTime) - delete(rawMsg, key) - case "resourceName": - err = unpopulate(val, "ResourceName", &s.ResourceName) + case "nextLink": + err = unpopulate(val, "NextLink", &s.NextLink) delete(rawMsg, key) - case "unit": - err = unpopulate(val, "Unit", &s.Unit) + case "value": + err = unpopulate(val, "Value", &s.Value) delete(rawMsg, key) } if err != nil { @@ -15454,15 +17668,19 @@ func (s *ServerUsage) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ServerUsageListResult. -func (s ServerUsageListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type StartStopManagedInstanceScheduleProperties. +func (s StartStopManagedInstanceScheduleProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "value", s.Value) + populate(objectMap, "description", s.Description) + populate(objectMap, "nextExecutionTime", s.NextExecutionTime) + populate(objectMap, "nextRunAction", s.NextRunAction) + populate(objectMap, "scheduleList", s.ScheduleList) + populate(objectMap, "timeZoneId", s.TimeZoneID) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ServerUsageListResult. -func (s *ServerUsageListResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type StartStopManagedInstanceScheduleProperties. +func (s *StartStopManagedInstanceScheduleProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -15470,8 +17688,20 @@ func (s *ServerUsageListResult) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "value": - err = unpopulate(val, "Value", &s.Value) + case "description": + err = unpopulate(val, "Description", &s.Description) + delete(rawMsg, key) + case "nextExecutionTime": + err = unpopulate(val, "NextExecutionTime", &s.NextExecutionTime) + delete(rawMsg, key) + case "nextRunAction": + err = unpopulate(val, "NextRunAction", &s.NextRunAction) + delete(rawMsg, key) + case "scheduleList": + err = unpopulate(val, "ScheduleList", &s.ScheduleList) + delete(rawMsg, key) + case "timeZoneId": + err = unpopulate(val, "TimeZoneID", &s.TimeZoneID) delete(rawMsg, key) } if err != nil { @@ -15481,19 +17711,17 @@ func (s *ServerUsageListResult) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ServerVersionCapability. -func (s ServerVersionCapability) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type StorageCapability. +func (s StorageCapability) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "name", s.Name) populate(objectMap, "reason", s.Reason) populate(objectMap, "status", s.Status) - populate(objectMap, "supportedEditions", s.SupportedEditions) - populate(objectMap, "supportedElasticPoolEditions", s.SupportedElasticPoolEditions) + populate(objectMap, "storageAccountType", s.StorageAccountType) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ServerVersionCapability. -func (s *ServerVersionCapability) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type StorageCapability. +func (s *StorageCapability) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -15501,20 +17729,14 @@ func (s *ServerVersionCapability) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "name": - err = unpopulate(val, "Name", &s.Name) - delete(rawMsg, key) case "reason": err = unpopulate(val, "Reason", &s.Reason) delete(rawMsg, key) case "status": err = unpopulate(val, "Status", &s.Status) delete(rawMsg, key) - case "supportedEditions": - err = unpopulate(val, "SupportedEditions", &s.SupportedEditions) - delete(rawMsg, key) - case "supportedElasticPoolEditions": - err = unpopulate(val, "SupportedElasticPoolEditions", &s.SupportedElasticPoolEditions) + case "storageAccountType": + err = unpopulate(val, "StorageAccountType", &s.StorageAccountType) delete(rawMsg, key) } if err != nil { @@ -15524,8 +17746,8 @@ func (s *ServerVersionCapability) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ServerVulnerabilityAssessment. -func (s ServerVulnerabilityAssessment) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type SubscriptionUsage. +func (s SubscriptionUsage) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", s.ID) populate(objectMap, "name", s.Name) @@ -15534,8 +17756,8 @@ func (s ServerVulnerabilityAssessment) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ServerVulnerabilityAssessment. -func (s *ServerVulnerabilityAssessment) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type SubscriptionUsage. +func (s *SubscriptionUsage) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -15563,16 +17785,16 @@ func (s *ServerVulnerabilityAssessment) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ServerVulnerabilityAssessmentListResult. -func (s ServerVulnerabilityAssessmentListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type SubscriptionUsageListResult. +func (s SubscriptionUsageListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "nextLink", s.NextLink) populate(objectMap, "value", s.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ServerVulnerabilityAssessmentListResult. -func (s *ServerVulnerabilityAssessmentListResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type SubscriptionUsageListResult. +func (s *SubscriptionUsageListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -15594,18 +17816,18 @@ func (s *ServerVulnerabilityAssessmentListResult) UnmarshalJSON(data []byte) err return nil } -// MarshalJSON implements the json.Marshaller interface for type ServerVulnerabilityAssessmentProperties. -func (s ServerVulnerabilityAssessmentProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type SubscriptionUsageProperties. +func (s SubscriptionUsageProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "recurringScans", s.RecurringScans) - populate(objectMap, "storageAccountAccessKey", s.StorageAccountAccessKey) - populate(objectMap, "storageContainerPath", s.StorageContainerPath) - populate(objectMap, "storageContainerSasKey", s.StorageContainerSasKey) + populate(objectMap, "currentValue", s.CurrentValue) + populate(objectMap, "displayName", s.DisplayName) + populate(objectMap, "limit", s.Limit) + populate(objectMap, "unit", s.Unit) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ServerVulnerabilityAssessmentProperties. -func (s *ServerVulnerabilityAssessmentProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type SubscriptionUsageProperties. +func (s *SubscriptionUsageProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -15613,17 +17835,17 @@ func (s *ServerVulnerabilityAssessmentProperties) UnmarshalJSON(data []byte) err for key, val := range rawMsg { var err error switch key { - case "recurringScans": - err = unpopulate(val, "RecurringScans", &s.RecurringScans) + case "currentValue": + err = unpopulate(val, "CurrentValue", &s.CurrentValue) delete(rawMsg, key) - case "storageAccountAccessKey": - err = unpopulate(val, "StorageAccountAccessKey", &s.StorageAccountAccessKey) + case "displayName": + err = unpopulate(val, "DisplayName", &s.DisplayName) delete(rawMsg, key) - case "storageContainerPath": - err = unpopulate(val, "StorageContainerPath", &s.StorageContainerPath) + case "limit": + err = unpopulate(val, "Limit", &s.Limit) delete(rawMsg, key) - case "storageContainerSasKey": - err = unpopulate(val, "StorageContainerSasKey", &s.StorageContainerSasKey) + case "unit": + err = unpopulate(val, "Unit", &s.Unit) delete(rawMsg, key) } if err != nil { @@ -15633,8 +17855,8 @@ func (s *ServerVulnerabilityAssessmentProperties) UnmarshalJSON(data []byte) err return nil } -// MarshalJSON implements the json.Marshaller interface for type ServiceObjective. -func (s ServiceObjective) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type SynapseLinkWorkspace. +func (s SynapseLinkWorkspace) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", s.ID) populate(objectMap, "name", s.Name) @@ -15643,8 +17865,8 @@ func (s ServiceObjective) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ServiceObjective. -func (s *ServiceObjective) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type SynapseLinkWorkspace. +func (s *SynapseLinkWorkspace) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -15672,28 +17894,16 @@ func (s *ServiceObjective) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ServiceObjectiveCapability. -func (s ServiceObjectiveCapability) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type SynapseLinkWorkspaceInfoProperties. +func (s SynapseLinkWorkspaceInfoProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "computeModel", s.ComputeModel) - populate(objectMap, "id", s.ID) - populate(objectMap, "includedMaxSize", s.IncludedMaxSize) - populate(objectMap, "name", s.Name) - populate(objectMap, "performanceLevel", s.PerformanceLevel) - populate(objectMap, "reason", s.Reason) - populate(objectMap, "sku", s.SKU) - populate(objectMap, "status", s.Status) - populate(objectMap, "supportedAutoPauseDelay", s.SupportedAutoPauseDelay) - populate(objectMap, "supportedLicenseTypes", s.SupportedLicenseTypes) - populate(objectMap, "supportedMaintenanceConfigurations", s.SupportedMaintenanceConfigurations) - populate(objectMap, "supportedMaxSizes", s.SupportedMaxSizes) - populate(objectMap, "supportedMinCapacities", s.SupportedMinCapacities) - populate(objectMap, "zoneRedundant", s.ZoneRedundant) + populate(objectMap, "linkConnectionName", s.LinkConnectionName) + populate(objectMap, "workspaceId", s.WorkspaceID) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ServiceObjectiveCapability. -func (s *ServiceObjectiveCapability) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type SynapseLinkWorkspaceInfoProperties. +func (s *SynapseLinkWorkspaceInfoProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -15701,47 +17911,11 @@ func (s *ServiceObjectiveCapability) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "computeModel": - err = unpopulate(val, "ComputeModel", &s.ComputeModel) - delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &s.ID) - delete(rawMsg, key) - case "includedMaxSize": - err = unpopulate(val, "IncludedMaxSize", &s.IncludedMaxSize) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &s.Name) - delete(rawMsg, key) - case "performanceLevel": - err = unpopulate(val, "PerformanceLevel", &s.PerformanceLevel) - delete(rawMsg, key) - case "reason": - err = unpopulate(val, "Reason", &s.Reason) - delete(rawMsg, key) - case "sku": - err = unpopulate(val, "SKU", &s.SKU) - delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &s.Status) - delete(rawMsg, key) - case "supportedAutoPauseDelay": - err = unpopulate(val, "SupportedAutoPauseDelay", &s.SupportedAutoPauseDelay) - delete(rawMsg, key) - case "supportedLicenseTypes": - err = unpopulate(val, "SupportedLicenseTypes", &s.SupportedLicenseTypes) - delete(rawMsg, key) - case "supportedMaintenanceConfigurations": - err = unpopulate(val, "SupportedMaintenanceConfigurations", &s.SupportedMaintenanceConfigurations) - delete(rawMsg, key) - case "supportedMaxSizes": - err = unpopulate(val, "SupportedMaxSizes", &s.SupportedMaxSizes) + case "linkConnectionName": + err = unpopulate(val, "LinkConnectionName", &s.LinkConnectionName) delete(rawMsg, key) - case "supportedMinCapacities": - err = unpopulate(val, "SupportedMinCapacities", &s.SupportedMinCapacities) - delete(rawMsg, key) - case "zoneRedundant": - err = unpopulate(val, "ZoneRedundant", &s.ZoneRedundant) + case "workspaceId": + err = unpopulate(val, "WorkspaceID", &s.WorkspaceID) delete(rawMsg, key) } if err != nil { @@ -15751,15 +17925,16 @@ func (s *ServiceObjectiveCapability) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ServiceObjectiveListResult. -func (s ServiceObjectiveListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type SynapseLinkWorkspaceListResult. +func (s SynapseLinkWorkspaceListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "nextLink", s.NextLink) populate(objectMap, "value", s.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ServiceObjectiveListResult. -func (s *ServiceObjectiveListResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type SynapseLinkWorkspaceListResult. +func (s *SynapseLinkWorkspaceListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -15767,6 +17942,9 @@ func (s *ServiceObjectiveListResult) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &s.NextLink) + delete(rawMsg, key) case "value": err = unpopulate(val, "Value", &s.Value) delete(rawMsg, key) @@ -15778,19 +17956,15 @@ func (s *ServiceObjectiveListResult) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ServiceObjectiveProperties. -func (s ServiceObjectiveProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type SynapseLinkWorkspaceProperties. +func (s SynapseLinkWorkspaceProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "description", s.Description) - populate(objectMap, "enabled", s.Enabled) - populate(objectMap, "isDefault", s.IsDefault) - populate(objectMap, "isSystem", s.IsSystem) - populate(objectMap, "serviceObjectiveName", s.ServiceObjectiveName) + populate(objectMap, "workspaces", s.Workspaces) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ServiceObjectiveProperties. -func (s *ServiceObjectiveProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type SynapseLinkWorkspaceProperties. +func (s *SynapseLinkWorkspaceProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -15798,20 +17972,8 @@ func (s *ServiceObjectiveProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "description": - err = unpopulate(val, "Description", &s.Description) - delete(rawMsg, key) - case "enabled": - err = unpopulate(val, "Enabled", &s.Enabled) - delete(rawMsg, key) - case "isDefault": - err = unpopulate(val, "IsDefault", &s.IsDefault) - delete(rawMsg, key) - case "isSystem": - err = unpopulate(val, "IsSystem", &s.IsSystem) - delete(rawMsg, key) - case "serviceObjectiveName": - err = unpopulate(val, "ServiceObjectiveName", &s.ServiceObjectiveName) + case "workspaces": + err = unpopulate(val, "Workspaces", &s.Workspaces) delete(rawMsg, key) } if err != nil { @@ -15821,18 +17983,18 @@ func (s *ServiceObjectiveProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ServicePrincipal. -func (s ServicePrincipal) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type SyncAgent. +func (s SyncAgent) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "clientId", s.ClientID) - populate(objectMap, "principalId", s.PrincipalID) - populate(objectMap, "tenantId", s.TenantID) + populate(objectMap, "id", s.ID) + populate(objectMap, "name", s.Name) + populate(objectMap, "properties", s.Properties) populate(objectMap, "type", s.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ServicePrincipal. -func (s *ServicePrincipal) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type SyncAgent. +func (s *SyncAgent) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -15840,14 +18002,14 @@ func (s *ServicePrincipal) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "clientId": - err = unpopulate(val, "ClientID", &s.ClientID) + case "id": + err = unpopulate(val, "ID", &s.ID) delete(rawMsg, key) - case "principalId": - err = unpopulate(val, "PrincipalID", &s.PrincipalID) + case "name": + err = unpopulate(val, "Name", &s.Name) delete(rawMsg, key) - case "tenantId": - err = unpopulate(val, "TenantID", &s.TenantID) + case "properties": + err = unpopulate(val, "Properties", &s.Properties) delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &s.Type) @@ -15860,17 +18022,15 @@ func (s *ServicePrincipal) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type SloUsageMetric. -func (s SloUsageMetric) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type SyncAgentKeyProperties. +func (s SyncAgentKeyProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "inRangeTimeRatio", s.InRangeTimeRatio) - populate(objectMap, "serviceLevelObjective", s.ServiceLevelObjective) - populate(objectMap, "serviceLevelObjectiveId", s.ServiceLevelObjectiveID) + populate(objectMap, "syncAgentKey", s.SyncAgentKey) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type SloUsageMetric. -func (s *SloUsageMetric) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type SyncAgentKeyProperties. +func (s *SyncAgentKeyProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -15878,14 +18038,47 @@ func (s *SloUsageMetric) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "inRangeTimeRatio": - err = unpopulate(val, "InRangeTimeRatio", &s.InRangeTimeRatio) + case "syncAgentKey": + err = unpopulate(val, "SyncAgentKey", &s.SyncAgentKey) delete(rawMsg, key) - case "serviceLevelObjective": - err = unpopulate(val, "ServiceLevelObjective", &s.ServiceLevelObjective) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SyncAgentLinkedDatabase. +func (s SyncAgentLinkedDatabase) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", s.ID) + populate(objectMap, "name", s.Name) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "type", s.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SyncAgentLinkedDatabase. +func (s *SyncAgentLinkedDatabase) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &s.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &s.Name) delete(rawMsg, key) - case "serviceLevelObjectiveId": - err = unpopulate(val, "ServiceLevelObjectiveID", &s.ServiceLevelObjectiveID) + case "properties": + err = unpopulate(val, "Properties", &s.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &s.Type) delete(rawMsg, key) } if err != nil { @@ -15895,17 +18088,16 @@ func (s *SloUsageMetric) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type StorageCapability. -func (s StorageCapability) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type SyncAgentLinkedDatabaseListResult. +func (s SyncAgentLinkedDatabaseListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "reason", s.Reason) - populate(objectMap, "status", s.Status) - populate(objectMap, "storageAccountType", s.StorageAccountType) + populate(objectMap, "nextLink", s.NextLink) + populate(objectMap, "value", s.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type StorageCapability. -func (s *StorageCapability) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type SyncAgentLinkedDatabaseListResult. +func (s *SyncAgentLinkedDatabaseListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -15913,14 +18105,11 @@ func (s *StorageCapability) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "reason": - err = unpopulate(val, "Reason", &s.Reason) - delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &s.Status) + case "nextLink": + err = unpopulate(val, "NextLink", &s.NextLink) delete(rawMsg, key) - case "storageAccountType": - err = unpopulate(val, "StorageAccountType", &s.StorageAccountType) + case "value": + err = unpopulate(val, "Value", &s.Value) delete(rawMsg, key) } if err != nil { @@ -15930,18 +18119,20 @@ func (s *StorageCapability) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type SubscriptionUsage. -func (s SubscriptionUsage) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type SyncAgentLinkedDatabaseProperties. +func (s SyncAgentLinkedDatabaseProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", s.ID) - populate(objectMap, "name", s.Name) - populate(objectMap, "properties", s.Properties) - populate(objectMap, "type", s.Type) + populate(objectMap, "databaseId", s.DatabaseID) + populate(objectMap, "databaseName", s.DatabaseName) + populate(objectMap, "databaseType", s.DatabaseType) + populate(objectMap, "description", s.Description) + populate(objectMap, "serverName", s.ServerName) + populate(objectMap, "userName", s.UserName) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type SubscriptionUsage. -func (s *SubscriptionUsage) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type SyncAgentLinkedDatabaseProperties. +func (s *SyncAgentLinkedDatabaseProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -15949,17 +18140,23 @@ func (s *SubscriptionUsage) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &s.ID) + case "databaseId": + err = unpopulate(val, "DatabaseID", &s.DatabaseID) delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &s.Name) + case "databaseName": + err = unpopulate(val, "DatabaseName", &s.DatabaseName) delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &s.Properties) + case "databaseType": + err = unpopulate(val, "DatabaseType", &s.DatabaseType) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &s.Type) + case "description": + err = unpopulate(val, "Description", &s.Description) + delete(rawMsg, key) + case "serverName": + err = unpopulate(val, "ServerName", &s.ServerName) + delete(rawMsg, key) + case "userName": + err = unpopulate(val, "UserName", &s.UserName) delete(rawMsg, key) } if err != nil { @@ -15969,16 +18166,16 @@ func (s *SubscriptionUsage) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type SubscriptionUsageListResult. -func (s SubscriptionUsageListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type SyncAgentListResult. +func (s SyncAgentListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "nextLink", s.NextLink) populate(objectMap, "value", s.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type SubscriptionUsageListResult. -func (s *SubscriptionUsageListResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type SyncAgentListResult. +func (s *SyncAgentListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -16000,18 +18197,21 @@ func (s *SubscriptionUsageListResult) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type SubscriptionUsageProperties. -func (s SubscriptionUsageProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type SyncAgentProperties. +func (s SyncAgentProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "currentValue", s.CurrentValue) - populate(objectMap, "displayName", s.DisplayName) - populate(objectMap, "limit", s.Limit) - populate(objectMap, "unit", s.Unit) + populateTimeRFC3339(objectMap, "expiryTime", s.ExpiryTime) + populate(objectMap, "isUpToDate", s.IsUpToDate) + populateTimeRFC3339(objectMap, "lastAliveTime", s.LastAliveTime) + populate(objectMap, "name", s.Name) + populate(objectMap, "state", s.State) + populate(objectMap, "syncDatabaseId", s.SyncDatabaseID) + populate(objectMap, "version", s.Version) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type SubscriptionUsageProperties. -func (s *SubscriptionUsageProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type SyncAgentProperties. +func (s *SyncAgentProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -16019,17 +18219,26 @@ func (s *SubscriptionUsageProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "currentValue": - err = unpopulate(val, "CurrentValue", &s.CurrentValue) + case "expiryTime": + err = unpopulateTimeRFC3339(val, "ExpiryTime", &s.ExpiryTime) delete(rawMsg, key) - case "displayName": - err = unpopulate(val, "DisplayName", &s.DisplayName) + case "isUpToDate": + err = unpopulate(val, "IsUpToDate", &s.IsUpToDate) delete(rawMsg, key) - case "limit": - err = unpopulate(val, "Limit", &s.Limit) + case "lastAliveTime": + err = unpopulateTimeRFC3339(val, "LastAliveTime", &s.LastAliveTime) delete(rawMsg, key) - case "unit": - err = unpopulate(val, "Unit", &s.Unit) + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "state": + err = unpopulate(val, "State", &s.State) + delete(rawMsg, key) + case "syncDatabaseId": + err = unpopulate(val, "SyncDatabaseID", &s.SyncDatabaseID) + delete(rawMsg, key) + case "version": + err = unpopulate(val, "Version", &s.Version) delete(rawMsg, key) } if err != nil { @@ -16039,18 +18248,16 @@ func (s *SubscriptionUsageProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type SyncAgent. -func (s SyncAgent) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type SyncDatabaseIDListResult. +func (s SyncDatabaseIDListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", s.ID) - populate(objectMap, "name", s.Name) - populate(objectMap, "properties", s.Properties) - populate(objectMap, "type", s.Type) + populate(objectMap, "nextLink", s.NextLink) + populate(objectMap, "value", s.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type SyncAgent. -func (s *SyncAgent) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type SyncDatabaseIDListResult. +func (s *SyncDatabaseIDListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -16058,17 +18265,11 @@ func (s *SyncAgent) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &s.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &s.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &s.Properties) + case "nextLink": + err = unpopulate(val, "NextLink", &s.NextLink) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &s.Type) + case "value": + err = unpopulate(val, "Value", &s.Value) delete(rawMsg, key) } if err != nil { @@ -16078,15 +18279,15 @@ func (s *SyncAgent) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type SyncAgentKeyProperties. -func (s SyncAgentKeyProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type SyncDatabaseIDProperties. +func (s SyncDatabaseIDProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "syncAgentKey", s.SyncAgentKey) + populate(objectMap, "id", s.ID) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type SyncAgentKeyProperties. -func (s *SyncAgentKeyProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type SyncDatabaseIDProperties. +func (s *SyncDatabaseIDProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -16094,8 +18295,8 @@ func (s *SyncAgentKeyProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "syncAgentKey": - err = unpopulate(val, "SyncAgentKey", &s.SyncAgentKey) + case "id": + err = unpopulate(val, "ID", &s.ID) delete(rawMsg, key) } if err != nil { @@ -16105,18 +18306,16 @@ func (s *SyncAgentKeyProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type SyncAgentLinkedDatabase. -func (s SyncAgentLinkedDatabase) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type SyncFullSchemaProperties. +func (s SyncFullSchemaProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", s.ID) - populate(objectMap, "name", s.Name) - populate(objectMap, "properties", s.Properties) - populate(objectMap, "type", s.Type) + populateTimeRFC3339(objectMap, "lastUpdateTime", s.LastUpdateTime) + populate(objectMap, "tables", s.Tables) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type SyncAgentLinkedDatabase. -func (s *SyncAgentLinkedDatabase) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type SyncFullSchemaProperties. +func (s *SyncFullSchemaProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -16124,17 +18323,11 @@ func (s *SyncAgentLinkedDatabase) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &s.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &s.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &s.Properties) + case "lastUpdateTime": + err = unpopulateTimeRFC3339(val, "LastUpdateTime", &s.LastUpdateTime) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &s.Type) + case "tables": + err = unpopulate(val, "Tables", &s.Tables) delete(rawMsg, key) } if err != nil { @@ -16144,16 +18337,16 @@ func (s *SyncAgentLinkedDatabase) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type SyncAgentLinkedDatabaseListResult. -func (s SyncAgentLinkedDatabaseListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type SyncFullSchemaPropertiesListResult. +func (s SyncFullSchemaPropertiesListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "nextLink", s.NextLink) populate(objectMap, "value", s.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type SyncAgentLinkedDatabaseListResult. -func (s *SyncAgentLinkedDatabaseListResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type SyncFullSchemaPropertiesListResult. +func (s *SyncFullSchemaPropertiesListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -16175,20 +18368,64 @@ func (s *SyncAgentLinkedDatabaseListResult) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type SyncAgentLinkedDatabaseProperties. -func (s SyncAgentLinkedDatabaseProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type SyncFullSchemaTable. +func (s SyncFullSchemaTable) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "databaseId", s.DatabaseID) - populate(objectMap, "databaseName", s.DatabaseName) - populate(objectMap, "databaseType", s.DatabaseType) - populate(objectMap, "description", s.Description) - populate(objectMap, "serverName", s.ServerName) - populate(objectMap, "userName", s.UserName) + populate(objectMap, "columns", s.Columns) + populate(objectMap, "errorId", s.ErrorID) + populate(objectMap, "hasError", s.HasError) + populate(objectMap, "name", s.Name) + populate(objectMap, "quotedName", s.QuotedName) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type SyncAgentLinkedDatabaseProperties. -func (s *SyncAgentLinkedDatabaseProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type SyncFullSchemaTable. +func (s *SyncFullSchemaTable) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "columns": + err = unpopulate(val, "Columns", &s.Columns) + delete(rawMsg, key) + case "errorId": + err = unpopulate(val, "ErrorID", &s.ErrorID) + delete(rawMsg, key) + case "hasError": + err = unpopulate(val, "HasError", &s.HasError) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "quotedName": + err = unpopulate(val, "QuotedName", &s.QuotedName) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SyncFullSchemaTableColumn. +func (s SyncFullSchemaTableColumn) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "dataSize", s.DataSize) + populate(objectMap, "dataType", s.DataType) + populate(objectMap, "errorId", s.ErrorID) + populate(objectMap, "hasError", s.HasError) + populate(objectMap, "isPrimaryKey", s.IsPrimaryKey) + populate(objectMap, "name", s.Name) + populate(objectMap, "quotedName", s.QuotedName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SyncFullSchemaTableColumn. +func (s *SyncFullSchemaTableColumn) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -16196,23 +18433,26 @@ func (s *SyncAgentLinkedDatabaseProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "databaseId": - err = unpopulate(val, "DatabaseID", &s.DatabaseID) + case "dataSize": + err = unpopulate(val, "DataSize", &s.DataSize) delete(rawMsg, key) - case "databaseName": - err = unpopulate(val, "DatabaseName", &s.DatabaseName) + case "dataType": + err = unpopulate(val, "DataType", &s.DataType) delete(rawMsg, key) - case "databaseType": - err = unpopulate(val, "DatabaseType", &s.DatabaseType) + case "errorId": + err = unpopulate(val, "ErrorID", &s.ErrorID) delete(rawMsg, key) - case "description": - err = unpopulate(val, "Description", &s.Description) + case "hasError": + err = unpopulate(val, "HasError", &s.HasError) delete(rawMsg, key) - case "serverName": - err = unpopulate(val, "ServerName", &s.ServerName) + case "isPrimaryKey": + err = unpopulate(val, "IsPrimaryKey", &s.IsPrimaryKey) delete(rawMsg, key) - case "userName": - err = unpopulate(val, "UserName", &s.UserName) + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "quotedName": + err = unpopulate(val, "QuotedName", &s.QuotedName) delete(rawMsg, key) } if err != nil { @@ -16222,16 +18462,19 @@ func (s *SyncAgentLinkedDatabaseProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type SyncAgentListResult. -func (s SyncAgentListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type SyncGroup. +func (s SyncGroup) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", s.NextLink) - populate(objectMap, "value", s.Value) + populate(objectMap, "id", s.ID) + populate(objectMap, "name", s.Name) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "sku", s.SKU) + populate(objectMap, "type", s.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type SyncAgentListResult. -func (s *SyncAgentListResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type SyncGroup. +func (s *SyncGroup) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -16239,11 +18482,20 @@ func (s *SyncAgentListResult) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &s.NextLink) + case "id": + err = unpopulate(val, "ID", &s.ID) delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &s.Value) + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &s.Properties) + delete(rawMsg, key) + case "sku": + err = unpopulate(val, "SKU", &s.SKU) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &s.Type) delete(rawMsg, key) } if err != nil { @@ -16253,21 +18505,16 @@ func (s *SyncAgentListResult) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type SyncAgentProperties. -func (s SyncAgentProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type SyncGroupListResult. +func (s SyncGroupListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populateTimeRFC3339(objectMap, "expiryTime", s.ExpiryTime) - populate(objectMap, "isUpToDate", s.IsUpToDate) - populateTimeRFC3339(objectMap, "lastAliveTime", s.LastAliveTime) - populate(objectMap, "name", s.Name) - populate(objectMap, "state", s.State) - populate(objectMap, "syncDatabaseId", s.SyncDatabaseID) - populate(objectMap, "version", s.Version) + populate(objectMap, "nextLink", s.NextLink) + populate(objectMap, "value", s.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type SyncAgentProperties. -func (s *SyncAgentProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type SyncGroupListResult. +func (s *SyncGroupListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -16275,26 +18522,11 @@ func (s *SyncAgentProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "expiryTime": - err = unpopulateTimeRFC3339(val, "ExpiryTime", &s.ExpiryTime) - delete(rawMsg, key) - case "isUpToDate": - err = unpopulate(val, "IsUpToDate", &s.IsUpToDate) - delete(rawMsg, key) - case "lastAliveTime": - err = unpopulateTimeRFC3339(val, "LastAliveTime", &s.LastAliveTime) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &s.Name) - delete(rawMsg, key) - case "state": - err = unpopulate(val, "State", &s.State) - delete(rawMsg, key) - case "syncDatabaseId": - err = unpopulate(val, "SyncDatabaseID", &s.SyncDatabaseID) + case "nextLink": + err = unpopulate(val, "NextLink", &s.NextLink) delete(rawMsg, key) - case "version": - err = unpopulate(val, "Version", &s.Version) + case "value": + err = unpopulate(val, "Value", &s.Value) delete(rawMsg, key) } if err != nil { @@ -16304,16 +18536,16 @@ func (s *SyncAgentProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type SyncDatabaseIDListResult. -func (s SyncDatabaseIDListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type SyncGroupLogListResult. +func (s SyncGroupLogListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "nextLink", s.NextLink) populate(objectMap, "value", s.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type SyncDatabaseIDListResult. -func (s *SyncDatabaseIDListResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type SyncGroupLogListResult. +func (s *SyncGroupLogListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -16335,15 +18567,20 @@ func (s *SyncDatabaseIDListResult) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type SyncDatabaseIDProperties. -func (s SyncDatabaseIDProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type SyncGroupLogProperties. +func (s SyncGroupLogProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", s.ID) + populate(objectMap, "details", s.Details) + populate(objectMap, "operationStatus", s.OperationStatus) + populate(objectMap, "source", s.Source) + populateTimeRFC3339(objectMap, "timestamp", s.Timestamp) + populate(objectMap, "tracingId", s.TracingID) + populate(objectMap, "type", s.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type SyncDatabaseIDProperties. -func (s *SyncDatabaseIDProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type SyncGroupLogProperties. +func (s *SyncGroupLogProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -16351,8 +18588,23 @@ func (s *SyncDatabaseIDProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &s.ID) + case "details": + err = unpopulate(val, "Details", &s.Details) + delete(rawMsg, key) + case "operationStatus": + err = unpopulate(val, "OperationStatus", &s.OperationStatus) + delete(rawMsg, key) + case "source": + err = unpopulate(val, "Source", &s.Source) + delete(rawMsg, key) + case "timestamp": + err = unpopulateTimeRFC3339(val, "Timestamp", &s.Timestamp) + delete(rawMsg, key) + case "tracingId": + err = unpopulate(val, "TracingID", &s.TracingID) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &s.Type) delete(rawMsg, key) } if err != nil { @@ -16362,16 +18614,26 @@ func (s *SyncDatabaseIDProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type SyncFullSchemaProperties. -func (s SyncFullSchemaProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type SyncGroupProperties. +func (s SyncGroupProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populateTimeRFC3339(objectMap, "lastUpdateTime", s.LastUpdateTime) - populate(objectMap, "tables", s.Tables) + populate(objectMap, "conflictLoggingRetentionInDays", s.ConflictLoggingRetentionInDays) + populate(objectMap, "conflictResolutionPolicy", s.ConflictResolutionPolicy) + populate(objectMap, "enableConflictLogging", s.EnableConflictLogging) + populate(objectMap, "hubDatabasePassword", s.HubDatabasePassword) + populate(objectMap, "hubDatabaseUserName", s.HubDatabaseUserName) + populate(objectMap, "interval", s.Interval) + populateTimeRFC3339(objectMap, "lastSyncTime", s.LastSyncTime) + populate(objectMap, "privateEndpointName", s.PrivateEndpointName) + populate(objectMap, "schema", s.Schema) + populate(objectMap, "syncDatabaseId", s.SyncDatabaseID) + populate(objectMap, "syncState", s.SyncState) + populate(objectMap, "usePrivateLinkConnection", s.UsePrivateLinkConnection) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type SyncFullSchemaProperties. -func (s *SyncFullSchemaProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type SyncGroupProperties. +func (s *SyncGroupProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -16379,11 +18641,41 @@ func (s *SyncFullSchemaProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "lastUpdateTime": - err = unpopulateTimeRFC3339(val, "LastUpdateTime", &s.LastUpdateTime) + case "conflictLoggingRetentionInDays": + err = unpopulate(val, "ConflictLoggingRetentionInDays", &s.ConflictLoggingRetentionInDays) delete(rawMsg, key) - case "tables": - err = unpopulate(val, "Tables", &s.Tables) + case "conflictResolutionPolicy": + err = unpopulate(val, "ConflictResolutionPolicy", &s.ConflictResolutionPolicy) + delete(rawMsg, key) + case "enableConflictLogging": + err = unpopulate(val, "EnableConflictLogging", &s.EnableConflictLogging) + delete(rawMsg, key) + case "hubDatabasePassword": + err = unpopulate(val, "HubDatabasePassword", &s.HubDatabasePassword) + delete(rawMsg, key) + case "hubDatabaseUserName": + err = unpopulate(val, "HubDatabaseUserName", &s.HubDatabaseUserName) + delete(rawMsg, key) + case "interval": + err = unpopulate(val, "Interval", &s.Interval) + delete(rawMsg, key) + case "lastSyncTime": + err = unpopulateTimeRFC3339(val, "LastSyncTime", &s.LastSyncTime) + delete(rawMsg, key) + case "privateEndpointName": + err = unpopulate(val, "PrivateEndpointName", &s.PrivateEndpointName) + delete(rawMsg, key) + case "schema": + err = unpopulate(val, "Schema", &s.Schema) + delete(rawMsg, key) + case "syncDatabaseId": + err = unpopulate(val, "SyncDatabaseID", &s.SyncDatabaseID) + delete(rawMsg, key) + case "syncState": + err = unpopulate(val, "SyncState", &s.SyncState) + delete(rawMsg, key) + case "usePrivateLinkConnection": + err = unpopulate(val, "UsePrivateLinkConnection", &s.UsePrivateLinkConnection) delete(rawMsg, key) } if err != nil { @@ -16393,16 +18685,16 @@ func (s *SyncFullSchemaProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type SyncFullSchemaPropertiesListResult. -func (s SyncFullSchemaPropertiesListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type SyncGroupSchema. +func (s SyncGroupSchema) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", s.NextLink) - populate(objectMap, "value", s.Value) + populate(objectMap, "masterSyncMemberName", s.MasterSyncMemberName) + populate(objectMap, "tables", s.Tables) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type SyncFullSchemaPropertiesListResult. -func (s *SyncFullSchemaPropertiesListResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type SyncGroupSchema. +func (s *SyncGroupSchema) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -16410,11 +18702,11 @@ func (s *SyncFullSchemaPropertiesListResult) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &s.NextLink) + case "masterSyncMemberName": + err = unpopulate(val, "MasterSyncMemberName", &s.MasterSyncMemberName) delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &s.Value) + case "tables": + err = unpopulate(val, "Tables", &s.Tables) delete(rawMsg, key) } if err != nil { @@ -16424,19 +18716,16 @@ func (s *SyncFullSchemaPropertiesListResult) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type SyncFullSchemaTable. -func (s SyncFullSchemaTable) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type SyncGroupSchemaTable. +func (s SyncGroupSchemaTable) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "columns", s.Columns) - populate(objectMap, "errorId", s.ErrorID) - populate(objectMap, "hasError", s.HasError) - populate(objectMap, "name", s.Name) populate(objectMap, "quotedName", s.QuotedName) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type SyncFullSchemaTable. -func (s *SyncFullSchemaTable) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type SyncGroupSchemaTable. +func (s *SyncGroupSchemaTable) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -16447,15 +18736,6 @@ func (s *SyncFullSchemaTable) UnmarshalJSON(data []byte) error { case "columns": err = unpopulate(val, "Columns", &s.Columns) delete(rawMsg, key) - case "errorId": - err = unpopulate(val, "ErrorID", &s.ErrorID) - delete(rawMsg, key) - case "hasError": - err = unpopulate(val, "HasError", &s.HasError) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &s.Name) - delete(rawMsg, key) case "quotedName": err = unpopulate(val, "QuotedName", &s.QuotedName) delete(rawMsg, key) @@ -16467,21 +18747,17 @@ func (s *SyncFullSchemaTable) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type SyncFullSchemaTableColumn. -func (s SyncFullSchemaTableColumn) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type SyncGroupSchemaTableColumn. +func (s SyncGroupSchemaTableColumn) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "dataSize", s.DataSize) populate(objectMap, "dataType", s.DataType) - populate(objectMap, "errorId", s.ErrorID) - populate(objectMap, "hasError", s.HasError) - populate(objectMap, "isPrimaryKey", s.IsPrimaryKey) - populate(objectMap, "name", s.Name) populate(objectMap, "quotedName", s.QuotedName) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type SyncFullSchemaTableColumn. -func (s *SyncFullSchemaTableColumn) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type SyncGroupSchemaTableColumn. +func (s *SyncGroupSchemaTableColumn) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -16495,18 +18771,6 @@ func (s *SyncFullSchemaTableColumn) UnmarshalJSON(data []byte) error { case "dataType": err = unpopulate(val, "DataType", &s.DataType) delete(rawMsg, key) - case "errorId": - err = unpopulate(val, "ErrorID", &s.ErrorID) - delete(rawMsg, key) - case "hasError": - err = unpopulate(val, "HasError", &s.HasError) - delete(rawMsg, key) - case "isPrimaryKey": - err = unpopulate(val, "IsPrimaryKey", &s.IsPrimaryKey) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &s.Name) - delete(rawMsg, key) case "quotedName": err = unpopulate(val, "QuotedName", &s.QuotedName) delete(rawMsg, key) @@ -16518,19 +18782,18 @@ func (s *SyncFullSchemaTableColumn) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type SyncGroup. -func (s SyncGroup) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type SyncMember. +func (s SyncMember) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", s.ID) populate(objectMap, "name", s.Name) populate(objectMap, "properties", s.Properties) - populate(objectMap, "sku", s.SKU) populate(objectMap, "type", s.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type SyncGroup. -func (s *SyncGroup) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type SyncMember. +func (s *SyncMember) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -16547,9 +18810,6 @@ func (s *SyncGroup) UnmarshalJSON(data []byte) error { case "properties": err = unpopulate(val, "Properties", &s.Properties) delete(rawMsg, key) - case "sku": - err = unpopulate(val, "SKU", &s.SKU) - delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &s.Type) delete(rawMsg, key) @@ -16561,16 +18821,16 @@ func (s *SyncGroup) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type SyncGroupListResult. -func (s SyncGroupListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type SyncMemberListResult. +func (s SyncMemberListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "nextLink", s.NextLink) populate(objectMap, "value", s.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type SyncGroupListResult. -func (s *SyncGroupListResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type SyncMemberListResult. +func (s *SyncMemberListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -16592,16 +18852,26 @@ func (s *SyncGroupListResult) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type SyncGroupLogListResult. -func (s SyncGroupLogListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type SyncMemberProperties. +func (s SyncMemberProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", s.NextLink) - populate(objectMap, "value", s.Value) + populate(objectMap, "databaseName", s.DatabaseName) + populate(objectMap, "databaseType", s.DatabaseType) + populate(objectMap, "password", s.Password) + populate(objectMap, "privateEndpointName", s.PrivateEndpointName) + populate(objectMap, "sqlServerDatabaseId", s.SQLServerDatabaseID) + populate(objectMap, "serverName", s.ServerName) + populate(objectMap, "syncAgentId", s.SyncAgentID) + populate(objectMap, "syncDirection", s.SyncDirection) + populate(objectMap, "syncMemberAzureDatabaseResourceId", s.SyncMemberAzureDatabaseResourceID) + populate(objectMap, "syncState", s.SyncState) + populate(objectMap, "usePrivateLinkConnection", s.UsePrivateLinkConnection) + populate(objectMap, "userName", s.UserName) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type SyncGroupLogListResult. -func (s *SyncGroupLogListResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type SyncMemberProperties. +func (s *SyncMemberProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -16609,11 +18879,41 @@ func (s *SyncGroupLogListResult) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &s.NextLink) + case "databaseName": + err = unpopulate(val, "DatabaseName", &s.DatabaseName) delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &s.Value) + case "databaseType": + err = unpopulate(val, "DatabaseType", &s.DatabaseType) + delete(rawMsg, key) + case "password": + err = unpopulate(val, "Password", &s.Password) + delete(rawMsg, key) + case "privateEndpointName": + err = unpopulate(val, "PrivateEndpointName", &s.PrivateEndpointName) + delete(rawMsg, key) + case "sqlServerDatabaseId": + err = unpopulate(val, "SQLServerDatabaseID", &s.SQLServerDatabaseID) + delete(rawMsg, key) + case "serverName": + err = unpopulate(val, "ServerName", &s.ServerName) + delete(rawMsg, key) + case "syncAgentId": + err = unpopulate(val, "SyncAgentID", &s.SyncAgentID) + delete(rawMsg, key) + case "syncDirection": + err = unpopulate(val, "SyncDirection", &s.SyncDirection) + delete(rawMsg, key) + case "syncMemberAzureDatabaseResourceId": + err = unpopulate(val, "SyncMemberAzureDatabaseResourceID", &s.SyncMemberAzureDatabaseResourceID) + delete(rawMsg, key) + case "syncState": + err = unpopulate(val, "SyncState", &s.SyncState) + delete(rawMsg, key) + case "usePrivateLinkConnection": + err = unpopulate(val, "UsePrivateLinkConnection", &s.UsePrivateLinkConnection) + delete(rawMsg, key) + case "userName": + err = unpopulate(val, "UserName", &s.UserName) delete(rawMsg, key) } if err != nil { @@ -16623,20 +18923,20 @@ func (s *SyncGroupLogListResult) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type SyncGroupLogProperties. -func (s SyncGroupLogProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type SystemData. +func (s SystemData) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "details", s.Details) - populate(objectMap, "operationStatus", s.OperationStatus) - populate(objectMap, "source", s.Source) - populateTimeRFC3339(objectMap, "timestamp", s.Timestamp) - populate(objectMap, "tracingId", s.TracingID) - populate(objectMap, "type", s.Type) + populateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) + populate(objectMap, "createdBy", s.CreatedBy) + populate(objectMap, "createdByType", s.CreatedByType) + populateTimeRFC3339(objectMap, "lastModifiedAt", s.LastModifiedAt) + populate(objectMap, "lastModifiedBy", s.LastModifiedBy) + populate(objectMap, "lastModifiedByType", s.LastModifiedByType) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type SyncGroupLogProperties. -func (s *SyncGroupLogProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type SystemData. +func (s *SystemData) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -16644,23 +18944,23 @@ func (s *SyncGroupLogProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "details": - err = unpopulate(val, "Details", &s.Details) + case "createdAt": + err = unpopulateTimeRFC3339(val, "CreatedAt", &s.CreatedAt) delete(rawMsg, key) - case "operationStatus": - err = unpopulate(val, "OperationStatus", &s.OperationStatus) + case "createdBy": + err = unpopulate(val, "CreatedBy", &s.CreatedBy) delete(rawMsg, key) - case "source": - err = unpopulate(val, "Source", &s.Source) + case "createdByType": + err = unpopulate(val, "CreatedByType", &s.CreatedByType) delete(rawMsg, key) - case "timestamp": - err = unpopulateTimeRFC3339(val, "Timestamp", &s.Timestamp) + case "lastModifiedAt": + err = unpopulateTimeRFC3339(val, "LastModifiedAt", &s.LastModifiedAt) delete(rawMsg, key) - case "tracingId": - err = unpopulate(val, "TracingID", &s.TracingID) + case "lastModifiedBy": + err = unpopulate(val, "LastModifiedBy", &s.LastModifiedBy) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &s.Type) + case "lastModifiedByType": + err = unpopulate(val, "LastModifiedByType", &s.LastModifiedByType) delete(rawMsg, key) } if err != nil { @@ -16670,979 +18970,969 @@ func (s *SyncGroupLogProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type SyncGroupProperties. -func (s SyncGroupProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type TdeCertificate. +func (t TdeCertificate) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "conflictLoggingRetentionInDays", s.ConflictLoggingRetentionInDays) - populate(objectMap, "conflictResolutionPolicy", s.ConflictResolutionPolicy) - populate(objectMap, "enableConflictLogging", s.EnableConflictLogging) - populate(objectMap, "hubDatabasePassword", s.HubDatabasePassword) - populate(objectMap, "hubDatabaseUserName", s.HubDatabaseUserName) - populate(objectMap, "interval", s.Interval) - populateTimeRFC3339(objectMap, "lastSyncTime", s.LastSyncTime) - populate(objectMap, "privateEndpointName", s.PrivateEndpointName) - populate(objectMap, "schema", s.Schema) - populate(objectMap, "syncDatabaseId", s.SyncDatabaseID) - populate(objectMap, "syncState", s.SyncState) - populate(objectMap, "usePrivateLinkConnection", s.UsePrivateLinkConnection) + populate(objectMap, "id", t.ID) + populate(objectMap, "name", t.Name) + populate(objectMap, "properties", t.Properties) + populate(objectMap, "type", t.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type SyncGroupProperties. -func (s *SyncGroupProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type TdeCertificate. +func (t *TdeCertificate) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", t, err) } for key, val := range rawMsg { var err error switch key { - case "conflictLoggingRetentionInDays": - err = unpopulate(val, "ConflictLoggingRetentionInDays", &s.ConflictLoggingRetentionInDays) - delete(rawMsg, key) - case "conflictResolutionPolicy": - err = unpopulate(val, "ConflictResolutionPolicy", &s.ConflictResolutionPolicy) - delete(rawMsg, key) - case "enableConflictLogging": - err = unpopulate(val, "EnableConflictLogging", &s.EnableConflictLogging) - delete(rawMsg, key) - case "hubDatabasePassword": - err = unpopulate(val, "HubDatabasePassword", &s.HubDatabasePassword) - delete(rawMsg, key) - case "hubDatabaseUserName": - err = unpopulate(val, "HubDatabaseUserName", &s.HubDatabaseUserName) - delete(rawMsg, key) - case "interval": - err = unpopulate(val, "Interval", &s.Interval) - delete(rawMsg, key) - case "lastSyncTime": - err = unpopulateTimeRFC3339(val, "LastSyncTime", &s.LastSyncTime) + case "id": + err = unpopulate(val, "ID", &t.ID) delete(rawMsg, key) - case "privateEndpointName": - err = unpopulate(val, "PrivateEndpointName", &s.PrivateEndpointName) + case "name": + err = unpopulate(val, "Name", &t.Name) delete(rawMsg, key) - case "schema": - err = unpopulate(val, "Schema", &s.Schema) + case "properties": + err = unpopulate(val, "Properties", &t.Properties) delete(rawMsg, key) - case "syncDatabaseId": - err = unpopulate(val, "SyncDatabaseID", &s.SyncDatabaseID) + case "type": + err = unpopulate(val, "Type", &t.Type) delete(rawMsg, key) - case "syncState": - err = unpopulate(val, "SyncState", &s.SyncState) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type TdeCertificateProperties. +func (t TdeCertificateProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "certPassword", t.CertPassword) + populate(objectMap, "privateBlob", t.PrivateBlob) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TdeCertificateProperties. +func (t *TdeCertificateProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "certPassword": + err = unpopulate(val, "CertPassword", &t.CertPassword) delete(rawMsg, key) - case "usePrivateLinkConnection": - err = unpopulate(val, "UsePrivateLinkConnection", &s.UsePrivateLinkConnection) + case "privateBlob": + err = unpopulate(val, "PrivateBlob", &t.PrivateBlob) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", t, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type SyncGroupSchema. -func (s SyncGroupSchema) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type TimeZone. +func (t TimeZone) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "masterSyncMemberName", s.MasterSyncMemberName) - populate(objectMap, "tables", s.Tables) + populate(objectMap, "id", t.ID) + populate(objectMap, "name", t.Name) + populate(objectMap, "properties", t.Properties) + populate(objectMap, "type", t.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type SyncGroupSchema. -func (s *SyncGroupSchema) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type TimeZone. +func (t *TimeZone) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", t, err) } for key, val := range rawMsg { var err error switch key { - case "masterSyncMemberName": - err = unpopulate(val, "MasterSyncMemberName", &s.MasterSyncMemberName) + case "id": + err = unpopulate(val, "ID", &t.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &t.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &t.Properties) delete(rawMsg, key) - case "tables": - err = unpopulate(val, "Tables", &s.Tables) + case "type": + err = unpopulate(val, "Type", &t.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", t, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type SyncGroupSchemaTable. -func (s SyncGroupSchemaTable) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type TimeZoneListResult. +func (t TimeZoneListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "columns", s.Columns) - populate(objectMap, "quotedName", s.QuotedName) + populate(objectMap, "nextLink", t.NextLink) + populate(objectMap, "value", t.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type SyncGroupSchemaTable. -func (s *SyncGroupSchemaTable) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type TimeZoneListResult. +func (t *TimeZoneListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", t, err) } for key, val := range rawMsg { var err error switch key { - case "columns": - err = unpopulate(val, "Columns", &s.Columns) + case "nextLink": + err = unpopulate(val, "NextLink", &t.NextLink) delete(rawMsg, key) - case "quotedName": - err = unpopulate(val, "QuotedName", &s.QuotedName) + case "value": + err = unpopulate(val, "Value", &t.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", t, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type SyncGroupSchemaTableColumn. -func (s SyncGroupSchemaTableColumn) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type TimeZoneProperties. +func (t TimeZoneProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "dataSize", s.DataSize) - populate(objectMap, "dataType", s.DataType) - populate(objectMap, "quotedName", s.QuotedName) + populate(objectMap, "displayName", t.DisplayName) + populate(objectMap, "timeZoneId", t.TimeZoneID) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type SyncGroupSchemaTableColumn. -func (s *SyncGroupSchemaTableColumn) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type TimeZoneProperties. +func (t *TimeZoneProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", t, err) } for key, val := range rawMsg { var err error switch key { - case "dataSize": - err = unpopulate(val, "DataSize", &s.DataSize) - delete(rawMsg, key) - case "dataType": - err = unpopulate(val, "DataType", &s.DataType) + case "displayName": + err = unpopulate(val, "DisplayName", &t.DisplayName) delete(rawMsg, key) - case "quotedName": - err = unpopulate(val, "QuotedName", &s.QuotedName) + case "timeZoneId": + err = unpopulate(val, "TimeZoneID", &t.TimeZoneID) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", t, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type SyncMember. -func (s SyncMember) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type TopQueries. +func (t TopQueries) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", s.ID) - populate(objectMap, "name", s.Name) - populate(objectMap, "properties", s.Properties) - populate(objectMap, "type", s.Type) + populate(objectMap, "aggregationFunction", t.AggregationFunction) + populate(objectMap, "endTime", t.EndTime) + populate(objectMap, "intervalType", t.IntervalType) + populate(objectMap, "numberOfQueries", t.NumberOfQueries) + populate(objectMap, "observationMetric", t.ObservationMetric) + populate(objectMap, "queries", t.Queries) + populate(objectMap, "startTime", t.StartTime) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type SyncMember. -func (s *SyncMember) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type TopQueries. +func (t *TopQueries) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", t, err) } for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &s.ID) + case "aggregationFunction": + err = unpopulate(val, "AggregationFunction", &t.AggregationFunction) delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &s.Name) + case "endTime": + err = unpopulate(val, "EndTime", &t.EndTime) delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &s.Properties) + case "intervalType": + err = unpopulate(val, "IntervalType", &t.IntervalType) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &s.Type) + case "numberOfQueries": + err = unpopulate(val, "NumberOfQueries", &t.NumberOfQueries) + delete(rawMsg, key) + case "observationMetric": + err = unpopulate(val, "ObservationMetric", &t.ObservationMetric) + delete(rawMsg, key) + case "queries": + err = unpopulate(val, "Queries", &t.Queries) + delete(rawMsg, key) + case "startTime": + err = unpopulate(val, "StartTime", &t.StartTime) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", t, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type SyncMemberListResult. -func (s SyncMemberListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type TopQueriesListResult. +func (t TopQueriesListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", s.NextLink) - populate(objectMap, "value", s.Value) + populate(objectMap, "nextLink", t.NextLink) + populate(objectMap, "value", t.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type SyncMemberListResult. -func (s *SyncMemberListResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type TopQueriesListResult. +func (t *TopQueriesListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", t, err) } for key, val := range rawMsg { var err error switch key { case "nextLink": - err = unpopulate(val, "NextLink", &s.NextLink) + err = unpopulate(val, "NextLink", &t.NextLink) delete(rawMsg, key) case "value": - err = unpopulate(val, "Value", &s.Value) + err = unpopulate(val, "Value", &t.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", t, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type SyncMemberProperties. -func (s SyncMemberProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type TrackedResource. +func (t TrackedResource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "databaseName", s.DatabaseName) - populate(objectMap, "databaseType", s.DatabaseType) - populate(objectMap, "password", s.Password) - populate(objectMap, "privateEndpointName", s.PrivateEndpointName) - populate(objectMap, "sqlServerDatabaseId", s.SQLServerDatabaseID) - populate(objectMap, "serverName", s.ServerName) - populate(objectMap, "syncAgentId", s.SyncAgentID) - populate(objectMap, "syncDirection", s.SyncDirection) - populate(objectMap, "syncMemberAzureDatabaseResourceId", s.SyncMemberAzureDatabaseResourceID) - populate(objectMap, "syncState", s.SyncState) - populate(objectMap, "usePrivateLinkConnection", s.UsePrivateLinkConnection) - populate(objectMap, "userName", s.UserName) + populate(objectMap, "id", t.ID) + populate(objectMap, "location", t.Location) + populate(objectMap, "name", t.Name) + populate(objectMap, "tags", t.Tags) + populate(objectMap, "type", t.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type SyncMemberProperties. -func (s *SyncMemberProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type TrackedResource. +func (t *TrackedResource) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", t, err) } for key, val := range rawMsg { var err error switch key { - case "databaseName": - err = unpopulate(val, "DatabaseName", &s.DatabaseName) - delete(rawMsg, key) - case "databaseType": - err = unpopulate(val, "DatabaseType", &s.DatabaseType) - delete(rawMsg, key) - case "password": - err = unpopulate(val, "Password", &s.Password) - delete(rawMsg, key) - case "privateEndpointName": - err = unpopulate(val, "PrivateEndpointName", &s.PrivateEndpointName) - delete(rawMsg, key) - case "sqlServerDatabaseId": - err = unpopulate(val, "SQLServerDatabaseID", &s.SQLServerDatabaseID) - delete(rawMsg, key) - case "serverName": - err = unpopulate(val, "ServerName", &s.ServerName) - delete(rawMsg, key) - case "syncAgentId": - err = unpopulate(val, "SyncAgentID", &s.SyncAgentID) - delete(rawMsg, key) - case "syncDirection": - err = unpopulate(val, "SyncDirection", &s.SyncDirection) + case "id": + err = unpopulate(val, "ID", &t.ID) delete(rawMsg, key) - case "syncMemberAzureDatabaseResourceId": - err = unpopulate(val, "SyncMemberAzureDatabaseResourceID", &s.SyncMemberAzureDatabaseResourceID) + case "location": + err = unpopulate(val, "Location", &t.Location) delete(rawMsg, key) - case "syncState": - err = unpopulate(val, "SyncState", &s.SyncState) + case "name": + err = unpopulate(val, "Name", &t.Name) delete(rawMsg, key) - case "usePrivateLinkConnection": - err = unpopulate(val, "UsePrivateLinkConnection", &s.UsePrivateLinkConnection) + case "tags": + err = unpopulate(val, "Tags", &t.Tags) delete(rawMsg, key) - case "userName": - err = unpopulate(val, "UserName", &s.UserName) + case "type": + err = unpopulate(val, "Type", &t.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", t, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type SystemData. -func (s SystemData) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type TransparentDataEncryptionProperties. +func (t TransparentDataEncryptionProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) - populate(objectMap, "createdBy", s.CreatedBy) - populate(objectMap, "createdByType", s.CreatedByType) - populateTimeRFC3339(objectMap, "lastModifiedAt", s.LastModifiedAt) - populate(objectMap, "lastModifiedBy", s.LastModifiedBy) - populate(objectMap, "lastModifiedByType", s.LastModifiedByType) + populate(objectMap, "state", t.State) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type SystemData. -func (s *SystemData) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type TransparentDataEncryptionProperties. +func (t *TransparentDataEncryptionProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", t, err) } for key, val := range rawMsg { var err error switch key { - case "createdAt": - err = unpopulateTimeRFC3339(val, "CreatedAt", &s.CreatedAt) - delete(rawMsg, key) - case "createdBy": - err = unpopulate(val, "CreatedBy", &s.CreatedBy) - delete(rawMsg, key) - case "createdByType": - err = unpopulate(val, "CreatedByType", &s.CreatedByType) - delete(rawMsg, key) - case "lastModifiedAt": - err = unpopulateTimeRFC3339(val, "LastModifiedAt", &s.LastModifiedAt) - delete(rawMsg, key) - case "lastModifiedBy": - err = unpopulate(val, "LastModifiedBy", &s.LastModifiedBy) - delete(rawMsg, key) - case "lastModifiedByType": - err = unpopulate(val, "LastModifiedByType", &s.LastModifiedByType) + case "state": + err = unpopulate(val, "State", &t.State) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", t, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type TdeCertificate. -func (t TdeCertificate) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type UpdateLongTermRetentionBackupParameters. +func (u UpdateLongTermRetentionBackupParameters) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", t.ID) - populate(objectMap, "name", t.Name) - populate(objectMap, "properties", t.Properties) - populate(objectMap, "type", t.Type) + populate(objectMap, "properties", u.Properties) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type TdeCertificate. -func (t *TdeCertificate) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type UpdateLongTermRetentionBackupParameters. +func (u *UpdateLongTermRetentionBackupParameters) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) + return fmt.Errorf("unmarshalling type %T: %v", u, err) } for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &t.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &t.Name) - delete(rawMsg, key) case "properties": - err = unpopulate(val, "Properties", &t.Properties) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &t.Type) + err = unpopulate(val, "Properties", &u.Properties) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) + return fmt.Errorf("unmarshalling type %T: %v", u, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type TdeCertificateProperties. -func (t TdeCertificateProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type UpdateLongTermRetentionBackupParametersProperties. +func (u UpdateLongTermRetentionBackupParametersProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "certPassword", t.CertPassword) - populate(objectMap, "privateBlob", t.PrivateBlob) + populate(objectMap, "requestedBackupStorageRedundancy", u.RequestedBackupStorageRedundancy) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type TdeCertificateProperties. -func (t *TdeCertificateProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type UpdateLongTermRetentionBackupParametersProperties. +func (u *UpdateLongTermRetentionBackupParametersProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) + return fmt.Errorf("unmarshalling type %T: %v", u, err) } for key, val := range rawMsg { var err error switch key { - case "certPassword": - err = unpopulate(val, "CertPassword", &t.CertPassword) - delete(rawMsg, key) - case "privateBlob": - err = unpopulate(val, "PrivateBlob", &t.PrivateBlob) + case "requestedBackupStorageRedundancy": + err = unpopulate(val, "RequestedBackupStorageRedundancy", &u.RequestedBackupStorageRedundancy) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) + return fmt.Errorf("unmarshalling type %T: %v", u, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type TimeZone. -func (t TimeZone) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type UpdateVirtualClusterDNSServersOperation. +func (u UpdateVirtualClusterDNSServersOperation) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", t.ID) - populate(objectMap, "name", t.Name) - populate(objectMap, "properties", t.Properties) - populate(objectMap, "type", t.Type) + populate(objectMap, "id", u.ID) + populate(objectMap, "name", u.Name) + populate(objectMap, "properties", u.Properties) + populate(objectMap, "type", u.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type TimeZone. -func (t *TimeZone) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type UpdateVirtualClusterDNSServersOperation. +func (u *UpdateVirtualClusterDNSServersOperation) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) + return fmt.Errorf("unmarshalling type %T: %v", u, err) } for key, val := range rawMsg { var err error switch key { case "id": - err = unpopulate(val, "ID", &t.ID) + err = unpopulate(val, "ID", &u.ID) delete(rawMsg, key) case "name": - err = unpopulate(val, "Name", &t.Name) + err = unpopulate(val, "Name", &u.Name) delete(rawMsg, key) case "properties": - err = unpopulate(val, "Properties", &t.Properties) + err = unpopulate(val, "Properties", &u.Properties) delete(rawMsg, key) case "type": - err = unpopulate(val, "Type", &t.Type) + err = unpopulate(val, "Type", &u.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) + return fmt.Errorf("unmarshalling type %T: %v", u, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type TimeZoneListResult. -func (t TimeZoneListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type UpsertManagedServerOperationParameters. +func (u UpsertManagedServerOperationParameters) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", t.NextLink) - populate(objectMap, "value", t.Value) + populate(objectMap, "family", u.Family) + populate(objectMap, "storageSizeInGB", u.StorageSizeInGB) + populate(objectMap, "tier", u.Tier) + populate(objectMap, "vCores", u.VCores) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type TimeZoneListResult. -func (t *TimeZoneListResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type UpsertManagedServerOperationParameters. +func (u *UpsertManagedServerOperationParameters) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) + return fmt.Errorf("unmarshalling type %T: %v", u, err) } for key, val := range rawMsg { var err error switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &t.NextLink) + case "family": + err = unpopulate(val, "Family", &u.Family) delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &t.Value) + case "storageSizeInGB": + err = unpopulate(val, "StorageSizeInGB", &u.StorageSizeInGB) + delete(rawMsg, key) + case "tier": + err = unpopulate(val, "Tier", &u.Tier) + delete(rawMsg, key) + case "vCores": + err = unpopulate(val, "VCores", &u.VCores) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) + return fmt.Errorf("unmarshalling type %T: %v", u, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type TimeZoneProperties. -func (t TimeZoneProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type UpsertManagedServerOperationStepWithEstimatesAndDuration. +func (u UpsertManagedServerOperationStepWithEstimatesAndDuration) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "displayName", t.DisplayName) - populate(objectMap, "timeZoneId", t.TimeZoneID) + populate(objectMap, "name", u.Name) + populate(objectMap, "order", u.Order) + populate(objectMap, "status", u.Status) + populateTimeRFC3339(objectMap, "stepEndTime", u.StepEndTime) + populateTimeRFC3339(objectMap, "stepStartTime", u.StepStartTime) + populate(objectMap, "timeElapsed", u.TimeElapsed) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type TimeZoneProperties. -func (t *TimeZoneProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type UpsertManagedServerOperationStepWithEstimatesAndDuration. +func (u *UpsertManagedServerOperationStepWithEstimatesAndDuration) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) + return fmt.Errorf("unmarshalling type %T: %v", u, err) } for key, val := range rawMsg { var err error switch key { - case "displayName": - err = unpopulate(val, "DisplayName", &t.DisplayName) + case "name": + err = unpopulate(val, "Name", &u.Name) delete(rawMsg, key) - case "timeZoneId": - err = unpopulate(val, "TimeZoneID", &t.TimeZoneID) + case "order": + err = unpopulate(val, "Order", &u.Order) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &u.Status) + delete(rawMsg, key) + case "stepEndTime": + err = unpopulateTimeRFC3339(val, "StepEndTime", &u.StepEndTime) + delete(rawMsg, key) + case "stepStartTime": + err = unpopulateTimeRFC3339(val, "StepStartTime", &u.StepStartTime) + delete(rawMsg, key) + case "timeElapsed": + err = unpopulate(val, "TimeElapsed", &u.TimeElapsed) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) + return fmt.Errorf("unmarshalling type %T: %v", u, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type TopQueries. -func (t TopQueries) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type Usage. +func (u Usage) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "aggregationFunction", t.AggregationFunction) - populate(objectMap, "endTime", t.EndTime) - populate(objectMap, "intervalType", t.IntervalType) - populate(objectMap, "numberOfQueries", t.NumberOfQueries) - populate(objectMap, "observationMetric", t.ObservationMetric) - populate(objectMap, "queries", t.Queries) - populate(objectMap, "startTime", t.StartTime) + populate(objectMap, "currentValue", u.CurrentValue) + populate(objectMap, "id", u.ID) + populate(objectMap, "limit", u.Limit) + populate(objectMap, "name", u.Name) + populate(objectMap, "requestedLimit", u.RequestedLimit) + populate(objectMap, "type", u.Type) + populate(objectMap, "unit", u.Unit) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type TopQueries. -func (t *TopQueries) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type Usage. +func (u *Usage) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) + return fmt.Errorf("unmarshalling type %T: %v", u, err) } for key, val := range rawMsg { var err error switch key { - case "aggregationFunction": - err = unpopulate(val, "AggregationFunction", &t.AggregationFunction) + case "currentValue": + err = unpopulate(val, "CurrentValue", &u.CurrentValue) delete(rawMsg, key) - case "endTime": - err = unpopulate(val, "EndTime", &t.EndTime) + case "id": + err = unpopulate(val, "ID", &u.ID) delete(rawMsg, key) - case "intervalType": - err = unpopulate(val, "IntervalType", &t.IntervalType) + case "limit": + err = unpopulate(val, "Limit", &u.Limit) delete(rawMsg, key) - case "numberOfQueries": - err = unpopulate(val, "NumberOfQueries", &t.NumberOfQueries) + case "name": + err = unpopulate(val, "Name", &u.Name) delete(rawMsg, key) - case "observationMetric": - err = unpopulate(val, "ObservationMetric", &t.ObservationMetric) + case "requestedLimit": + err = unpopulate(val, "RequestedLimit", &u.RequestedLimit) delete(rawMsg, key) - case "queries": - err = unpopulate(val, "Queries", &t.Queries) + case "type": + err = unpopulate(val, "Type", &u.Type) delete(rawMsg, key) - case "startTime": - err = unpopulate(val, "StartTime", &t.StartTime) + case "unit": + err = unpopulate(val, "Unit", &u.Unit) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) + return fmt.Errorf("unmarshalling type %T: %v", u, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type TopQueriesListResult. -func (t TopQueriesListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type UsageListResult. +func (u UsageListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", t.NextLink) - populate(objectMap, "value", t.Value) + populate(objectMap, "nextLink", u.NextLink) + populate(objectMap, "value", u.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type TopQueriesListResult. -func (t *TopQueriesListResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type UsageListResult. +func (u *UsageListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) + return fmt.Errorf("unmarshalling type %T: %v", u, err) } for key, val := range rawMsg { var err error switch key { case "nextLink": - err = unpopulate(val, "NextLink", &t.NextLink) + err = unpopulate(val, "NextLink", &u.NextLink) delete(rawMsg, key) case "value": - err = unpopulate(val, "Value", &t.Value) + err = unpopulate(val, "Value", &u.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) + return fmt.Errorf("unmarshalling type %T: %v", u, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type TrackedResource. -func (t TrackedResource) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type UserIdentity. +func (u UserIdentity) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", t.ID) - populate(objectMap, "location", t.Location) - populate(objectMap, "name", t.Name) - populate(objectMap, "tags", t.Tags) - populate(objectMap, "type", t.Type) + populate(objectMap, "clientId", u.ClientID) + populate(objectMap, "principalId", u.PrincipalID) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type TrackedResource. -func (t *TrackedResource) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type UserIdentity. +func (u *UserIdentity) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) + return fmt.Errorf("unmarshalling type %T: %v", u, err) } for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &t.ID) - delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &t.Location) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &t.Name) - delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &t.Tags) + case "clientId": + err = unpopulate(val, "ClientID", &u.ClientID) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &t.Type) + case "principalId": + err = unpopulate(val, "PrincipalID", &u.PrincipalID) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) + return fmt.Errorf("unmarshalling type %T: %v", u, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type TransparentDataEncryptionProperties. -func (t TransparentDataEncryptionProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type VaRule. +func (v VaRule) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "state", t.State) + populate(objectMap, "benchmarkReferences", v.BenchmarkReferences) + populate(objectMap, "category", v.Category) + populate(objectMap, "description", v.Description) + populate(objectMap, "queryCheck", v.QueryCheck) + populate(objectMap, "rationale", v.Rationale) + populate(objectMap, "ruleId", v.RuleID) + populate(objectMap, "ruleType", v.RuleType) + populate(objectMap, "severity", v.Severity) + populate(objectMap, "title", v.Title) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type TransparentDataEncryptionProperties. -func (t *TransparentDataEncryptionProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type VaRule. +func (v *VaRule) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) + return fmt.Errorf("unmarshalling type %T: %v", v, err) } for key, val := range rawMsg { var err error switch key { - case "state": - err = unpopulate(val, "State", &t.State) + case "benchmarkReferences": + err = unpopulate(val, "BenchmarkReferences", &v.BenchmarkReferences) + delete(rawMsg, key) + case "category": + err = unpopulate(val, "Category", &v.Category) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &v.Description) + delete(rawMsg, key) + case "queryCheck": + err = unpopulate(val, "QueryCheck", &v.QueryCheck) + delete(rawMsg, key) + case "rationale": + err = unpopulate(val, "Rationale", &v.Rationale) + delete(rawMsg, key) + case "ruleId": + err = unpopulate(val, "RuleID", &v.RuleID) + delete(rawMsg, key) + case "ruleType": + err = unpopulate(val, "RuleType", &v.RuleType) + delete(rawMsg, key) + case "severity": + err = unpopulate(val, "Severity", &v.Severity) + delete(rawMsg, key) + case "title": + err = unpopulate(val, "Title", &v.Title) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) + return fmt.Errorf("unmarshalling type %T: %v", v, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type UpdateLongTermRetentionBackupParameters. -func (u UpdateLongTermRetentionBackupParameters) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type VirtualCluster. +func (v VirtualCluster) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "properties", u.Properties) + populate(objectMap, "id", v.ID) + populate(objectMap, "location", v.Location) + populate(objectMap, "name", v.Name) + populate(objectMap, "properties", v.Properties) + populate(objectMap, "tags", v.Tags) + populate(objectMap, "type", v.Type) return json.Marshal(objectMap) } - -// UnmarshalJSON implements the json.Unmarshaller interface for type UpdateLongTermRetentionBackupParameters. -func (u *UpdateLongTermRetentionBackupParameters) UnmarshalJSON(data []byte) error { + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualCluster. +func (v *VirtualCluster) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", u, err) + return fmt.Errorf("unmarshalling type %T: %v", v, err) } for key, val := range rawMsg { var err error switch key { + case "id": + err = unpopulate(val, "ID", &v.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &v.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &v.Name) + delete(rawMsg, key) case "properties": - err = unpopulate(val, "Properties", &u.Properties) + err = unpopulate(val, "Properties", &v.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &v.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &v.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", u, err) + return fmt.Errorf("unmarshalling type %T: %v", v, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type UpdateLongTermRetentionBackupParametersProperties. -func (u UpdateLongTermRetentionBackupParametersProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type VirtualClusterDNSServersProperties. +func (v VirtualClusterDNSServersProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "requestedBackupStorageRedundancy", u.RequestedBackupStorageRedundancy) + populate(objectMap, "status", v.Status) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type UpdateLongTermRetentionBackupParametersProperties. -func (u *UpdateLongTermRetentionBackupParametersProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualClusterDNSServersProperties. +func (v *VirtualClusterDNSServersProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", u, err) + return fmt.Errorf("unmarshalling type %T: %v", v, err) } for key, val := range rawMsg { var err error switch key { - case "requestedBackupStorageRedundancy": - err = unpopulate(val, "RequestedBackupStorageRedundancy", &u.RequestedBackupStorageRedundancy) + case "status": + err = unpopulate(val, "Status", &v.Status) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", u, err) + return fmt.Errorf("unmarshalling type %T: %v", v, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type UpdateManagedInstanceDNSServersOperation. -func (u UpdateManagedInstanceDNSServersOperation) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type VirtualClusterListResult. +func (v VirtualClusterListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", u.ID) - populate(objectMap, "name", u.Name) - populate(objectMap, "properties", u.Properties) - populate(objectMap, "type", u.Type) + populate(objectMap, "nextLink", v.NextLink) + populate(objectMap, "value", v.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type UpdateManagedInstanceDNSServersOperation. -func (u *UpdateManagedInstanceDNSServersOperation) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualClusterListResult. +func (v *VirtualClusterListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", u, err) + return fmt.Errorf("unmarshalling type %T: %v", v, err) } for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &u.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &u.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &u.Properties) + case "nextLink": + err = unpopulate(val, "NextLink", &v.NextLink) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &u.Type) + case "value": + err = unpopulate(val, "Value", &v.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", u, err) + return fmt.Errorf("unmarshalling type %T: %v", v, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type UpsertManagedServerOperationParameters. -func (u UpsertManagedServerOperationParameters) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type VirtualClusterProperties. +func (v VirtualClusterProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "family", u.Family) - populate(objectMap, "storageSizeInGB", u.StorageSizeInGB) - populate(objectMap, "tier", u.Tier) - populate(objectMap, "vCores", u.VCores) + populate(objectMap, "childResources", v.ChildResources) + populate(objectMap, "subnetId", v.SubnetID) + populate(objectMap, "version", v.Version) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type UpsertManagedServerOperationParameters. -func (u *UpsertManagedServerOperationParameters) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualClusterProperties. +func (v *VirtualClusterProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", u, err) + return fmt.Errorf("unmarshalling type %T: %v", v, err) } for key, val := range rawMsg { var err error switch key { - case "family": - err = unpopulate(val, "Family", &u.Family) - delete(rawMsg, key) - case "storageSizeInGB": - err = unpopulate(val, "StorageSizeInGB", &u.StorageSizeInGB) + case "childResources": + err = unpopulate(val, "ChildResources", &v.ChildResources) delete(rawMsg, key) - case "tier": - err = unpopulate(val, "Tier", &u.Tier) + case "subnetId": + err = unpopulate(val, "SubnetID", &v.SubnetID) delete(rawMsg, key) - case "vCores": - err = unpopulate(val, "VCores", &u.VCores) + case "version": + err = unpopulate(val, "Version", &v.Version) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", u, err) + return fmt.Errorf("unmarshalling type %T: %v", v, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type UpsertManagedServerOperationStep. -func (u UpsertManagedServerOperationStep) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type VirtualClusterUpdate. +func (v VirtualClusterUpdate) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "name", u.Name) - populate(objectMap, "order", u.Order) - populate(objectMap, "status", u.Status) + populate(objectMap, "properties", v.Properties) + populate(objectMap, "tags", v.Tags) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type UpsertManagedServerOperationStep. -func (u *UpsertManagedServerOperationStep) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualClusterUpdate. +func (v *VirtualClusterUpdate) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", u, err) + return fmt.Errorf("unmarshalling type %T: %v", v, err) } for key, val := range rawMsg { var err error switch key { - case "name": - err = unpopulate(val, "Name", &u.Name) - delete(rawMsg, key) - case "order": - err = unpopulate(val, "Order", &u.Order) + case "properties": + err = unpopulate(val, "Properties", &v.Properties) delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &u.Status) + case "tags": + err = unpopulate(val, "Tags", &v.Tags) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", u, err) + return fmt.Errorf("unmarshalling type %T: %v", v, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type Usage. -func (u Usage) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type VirtualNetworkRule. +func (v VirtualNetworkRule) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "currentValue", u.CurrentValue) - populate(objectMap, "id", u.ID) - populate(objectMap, "limit", u.Limit) - populate(objectMap, "name", u.Name) - populate(objectMap, "requestedLimit", u.RequestedLimit) - populate(objectMap, "type", u.Type) - populate(objectMap, "unit", u.Unit) + populate(objectMap, "id", v.ID) + populate(objectMap, "name", v.Name) + populate(objectMap, "properties", v.Properties) + populate(objectMap, "type", v.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type Usage. -func (u *Usage) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualNetworkRule. +func (v *VirtualNetworkRule) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", u, err) + return fmt.Errorf("unmarshalling type %T: %v", v, err) } for key, val := range rawMsg { var err error switch key { - case "currentValue": - err = unpopulate(val, "CurrentValue", &u.CurrentValue) - delete(rawMsg, key) case "id": - err = unpopulate(val, "ID", &u.ID) - delete(rawMsg, key) - case "limit": - err = unpopulate(val, "Limit", &u.Limit) + err = unpopulate(val, "ID", &v.ID) delete(rawMsg, key) case "name": - err = unpopulate(val, "Name", &u.Name) + err = unpopulate(val, "Name", &v.Name) delete(rawMsg, key) - case "requestedLimit": - err = unpopulate(val, "RequestedLimit", &u.RequestedLimit) + case "properties": + err = unpopulate(val, "Properties", &v.Properties) delete(rawMsg, key) case "type": - err = unpopulate(val, "Type", &u.Type) - delete(rawMsg, key) - case "unit": - err = unpopulate(val, "Unit", &u.Unit) + err = unpopulate(val, "Type", &v.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", u, err) + return fmt.Errorf("unmarshalling type %T: %v", v, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type UsageListResult. -func (u UsageListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type VirtualNetworkRuleListResult. +func (v VirtualNetworkRuleListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", u.NextLink) - populate(objectMap, "value", u.Value) + populate(objectMap, "nextLink", v.NextLink) + populate(objectMap, "value", v.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type UsageListResult. -func (u *UsageListResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualNetworkRuleListResult. +func (v *VirtualNetworkRuleListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", u, err) + return fmt.Errorf("unmarshalling type %T: %v", v, err) } for key, val := range rawMsg { var err error switch key { case "nextLink": - err = unpopulate(val, "NextLink", &u.NextLink) + err = unpopulate(val, "NextLink", &v.NextLink) delete(rawMsg, key) case "value": - err = unpopulate(val, "Value", &u.Value) + err = unpopulate(val, "Value", &v.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", u, err) + return fmt.Errorf("unmarshalling type %T: %v", v, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type UserIdentity. -func (u UserIdentity) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type VirtualNetworkRuleProperties. +func (v VirtualNetworkRuleProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "clientId", u.ClientID) - populate(objectMap, "principalId", u.PrincipalID) + populate(objectMap, "ignoreMissingVnetServiceEndpoint", v.IgnoreMissingVnetServiceEndpoint) + populate(objectMap, "state", v.State) + populate(objectMap, "virtualNetworkSubnetId", v.VirtualNetworkSubnetID) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type UserIdentity. -func (u *UserIdentity) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualNetworkRuleProperties. +func (v *VirtualNetworkRuleProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", u, err) + return fmt.Errorf("unmarshalling type %T: %v", v, err) } for key, val := range rawMsg { var err error switch key { - case "clientId": - err = unpopulate(val, "ClientID", &u.ClientID) + case "ignoreMissingVnetServiceEndpoint": + err = unpopulate(val, "IgnoreMissingVnetServiceEndpoint", &v.IgnoreMissingVnetServiceEndpoint) delete(rawMsg, key) - case "principalId": - err = unpopulate(val, "PrincipalID", &u.PrincipalID) + case "state": + err = unpopulate(val, "State", &v.State) + delete(rawMsg, key) + case "virtualNetworkSubnetId": + err = unpopulate(val, "VirtualNetworkSubnetID", &v.VirtualNetworkSubnetID) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", u, err) + return fmt.Errorf("unmarshalling type %T: %v", v, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type VirtualCluster. -func (v VirtualCluster) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type VulnerabilityAssessment. +func (v VulnerabilityAssessment) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", v.ID) - populate(objectMap, "location", v.Location) populate(objectMap, "name", v.Name) populate(objectMap, "properties", v.Properties) - populate(objectMap, "tags", v.Tags) + populate(objectMap, "systemData", v.SystemData) populate(objectMap, "type", v.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualCluster. -func (v *VirtualCluster) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type VulnerabilityAssessment. +func (v *VulnerabilityAssessment) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", v, err) @@ -17653,17 +19943,14 @@ func (v *VirtualCluster) UnmarshalJSON(data []byte) error { case "id": err = unpopulate(val, "ID", &v.ID) delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &v.Location) - delete(rawMsg, key) case "name": err = unpopulate(val, "Name", &v.Name) delete(rawMsg, key) case "properties": err = unpopulate(val, "Properties", &v.Properties) delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &v.Tags) + case "systemData": + err = unpopulate(val, "SystemData", &v.SystemData) delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &v.Type) @@ -17676,16 +19963,16 @@ func (v *VirtualCluster) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type VirtualClusterListResult. -func (v VirtualClusterListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type VulnerabilityAssessmentListResult. +func (v VulnerabilityAssessmentListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "nextLink", v.NextLink) populate(objectMap, "value", v.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualClusterListResult. -func (v *VirtualClusterListResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type VulnerabilityAssessmentListResult. +func (v *VulnerabilityAssessmentListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", v, err) @@ -17707,18 +19994,44 @@ func (v *VirtualClusterListResult) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type VirtualClusterProperties. -func (v VirtualClusterProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type VulnerabilityAssessmentPolicyProperties. +func (v VulnerabilityAssessmentPolicyProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "childResources", v.ChildResources) - populate(objectMap, "family", v.Family) - populate(objectMap, "maintenanceConfigurationId", v.MaintenanceConfigurationID) - populate(objectMap, "subnetId", v.SubnetID) + populate(objectMap, "state", v.State) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VulnerabilityAssessmentPolicyProperties. +func (v *VulnerabilityAssessmentPolicyProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "state": + err = unpopulate(val, "State", &v.State) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VulnerabilityAssessmentRecurringScansProperties. +func (v VulnerabilityAssessmentRecurringScansProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "emailSubscriptionAdmins", v.EmailSubscriptionAdmins) + populate(objectMap, "emails", v.Emails) + populate(objectMap, "isEnabled", v.IsEnabled) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualClusterProperties. -func (v *VirtualClusterProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type VulnerabilityAssessmentRecurringScansProperties. +func (v *VulnerabilityAssessmentRecurringScansProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", v, err) @@ -17726,17 +20039,14 @@ func (v *VirtualClusterProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "childResources": - err = unpopulate(val, "ChildResources", &v.ChildResources) - delete(rawMsg, key) - case "family": - err = unpopulate(val, "Family", &v.Family) + case "emailSubscriptionAdmins": + err = unpopulate(val, "EmailSubscriptionAdmins", &v.EmailSubscriptionAdmins) delete(rawMsg, key) - case "maintenanceConfigurationId": - err = unpopulate(val, "MaintenanceConfigurationID", &v.MaintenanceConfigurationID) + case "emails": + err = unpopulate(val, "Emails", &v.Emails) delete(rawMsg, key) - case "subnetId": - err = unpopulate(val, "SubnetID", &v.SubnetID) + case "isEnabled": + err = unpopulate(val, "IsEnabled", &v.IsEnabled) delete(rawMsg, key) } if err != nil { @@ -17746,16 +20056,16 @@ func (v *VirtualClusterProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type VirtualClusterUpdate. -func (v VirtualClusterUpdate) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type VulnerabilityAssessmentScanError. +func (v VulnerabilityAssessmentScanError) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "properties", v.Properties) - populate(objectMap, "tags", v.Tags) + populate(objectMap, "code", v.Code) + populate(objectMap, "message", v.Message) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualClusterUpdate. -func (v *VirtualClusterUpdate) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type VulnerabilityAssessmentScanError. +func (v *VulnerabilityAssessmentScanError) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", v, err) @@ -17763,11 +20073,11 @@ func (v *VirtualClusterUpdate) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "properties": - err = unpopulate(val, "Properties", &v.Properties) + case "code": + err = unpopulate(val, "Code", &v.Code) delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &v.Tags) + case "message": + err = unpopulate(val, "Message", &v.Message) delete(rawMsg, key) } if err != nil { @@ -17777,18 +20087,16 @@ func (v *VirtualClusterUpdate) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type VirtualNetworkRule. -func (v VirtualNetworkRule) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type VulnerabilityAssessmentScanForSQLError. +func (v VulnerabilityAssessmentScanForSQLError) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", v.ID) - populate(objectMap, "name", v.Name) - populate(objectMap, "properties", v.Properties) - populate(objectMap, "type", v.Type) + populate(objectMap, "code", v.Code) + populate(objectMap, "message", v.Message) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualNetworkRule. -func (v *VirtualNetworkRule) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type VulnerabilityAssessmentScanForSQLError. +func (v *VulnerabilityAssessmentScanForSQLError) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", v, err) @@ -17796,17 +20104,11 @@ func (v *VirtualNetworkRule) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &v.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &v.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &v.Properties) + case "code": + err = unpopulate(val, "Code", &v.Code) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &v.Type) + case "message": + err = unpopulate(val, "Message", &v.Message) delete(rawMsg, key) } if err != nil { @@ -17816,16 +20118,16 @@ func (v *VirtualNetworkRule) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type VirtualNetworkRuleListResult. -func (v VirtualNetworkRuleListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type VulnerabilityAssessmentScanListResult. +func (v VulnerabilityAssessmentScanListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "nextLink", v.NextLink) populate(objectMap, "value", v.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualNetworkRuleListResult. -func (v *VirtualNetworkRuleListResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type VulnerabilityAssessmentScanListResult. +func (v *VulnerabilityAssessmentScanListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", v, err) @@ -17847,17 +20149,18 @@ func (v *VirtualNetworkRuleListResult) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type VirtualNetworkRuleProperties. -func (v VirtualNetworkRuleProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type VulnerabilityAssessmentScanRecord. +func (v VulnerabilityAssessmentScanRecord) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "ignoreMissingVnetServiceEndpoint", v.IgnoreMissingVnetServiceEndpoint) - populate(objectMap, "state", v.State) - populate(objectMap, "virtualNetworkSubnetId", v.VirtualNetworkSubnetID) + populate(objectMap, "id", v.ID) + populate(objectMap, "name", v.Name) + populate(objectMap, "properties", v.Properties) + populate(objectMap, "type", v.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualNetworkRuleProperties. -func (v *VirtualNetworkRuleProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type VulnerabilityAssessmentScanRecord. +func (v *VulnerabilityAssessmentScanRecord) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", v, err) @@ -17865,14 +20168,17 @@ func (v *VirtualNetworkRuleProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "ignoreMissingVnetServiceEndpoint": - err = unpopulate(val, "IgnoreMissingVnetServiceEndpoint", &v.IgnoreMissingVnetServiceEndpoint) + case "id": + err = unpopulate(val, "ID", &v.ID) delete(rawMsg, key) - case "state": - err = unpopulate(val, "State", &v.State) + case "name": + err = unpopulate(val, "Name", &v.Name) delete(rawMsg, key) - case "virtualNetworkSubnetId": - err = unpopulate(val, "VirtualNetworkSubnetID", &v.VirtualNetworkSubnetID) + case "properties": + err = unpopulate(val, "Properties", &v.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &v.Type) delete(rawMsg, key) } if err != nil { @@ -17882,17 +20188,19 @@ func (v *VirtualNetworkRuleProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type VulnerabilityAssessmentRecurringScansProperties. -func (v VulnerabilityAssessmentRecurringScansProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type VulnerabilityAssessmentScanRecordForSQL. +func (v VulnerabilityAssessmentScanRecordForSQL) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "emailSubscriptionAdmins", v.EmailSubscriptionAdmins) - populate(objectMap, "emails", v.Emails) - populate(objectMap, "isEnabled", v.IsEnabled) + populate(objectMap, "id", v.ID) + populate(objectMap, "name", v.Name) + populate(objectMap, "properties", v.Properties) + populate(objectMap, "systemData", v.SystemData) + populate(objectMap, "type", v.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type VulnerabilityAssessmentRecurringScansProperties. -func (v *VulnerabilityAssessmentRecurringScansProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type VulnerabilityAssessmentScanRecordForSQL. +func (v *VulnerabilityAssessmentScanRecordForSQL) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", v, err) @@ -17900,14 +20208,20 @@ func (v *VulnerabilityAssessmentRecurringScansProperties) UnmarshalJSON(data []b for key, val := range rawMsg { var err error switch key { - case "emailSubscriptionAdmins": - err = unpopulate(val, "EmailSubscriptionAdmins", &v.EmailSubscriptionAdmins) + case "id": + err = unpopulate(val, "ID", &v.ID) delete(rawMsg, key) - case "emails": - err = unpopulate(val, "Emails", &v.Emails) + case "name": + err = unpopulate(val, "Name", &v.Name) delete(rawMsg, key) - case "isEnabled": - err = unpopulate(val, "IsEnabled", &v.IsEnabled) + case "properties": + err = unpopulate(val, "Properties", &v.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &v.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &v.Type) delete(rawMsg, key) } if err != nil { @@ -17917,16 +20231,16 @@ func (v *VulnerabilityAssessmentRecurringScansProperties) UnmarshalJSON(data []b return nil } -// MarshalJSON implements the json.Marshaller interface for type VulnerabilityAssessmentScanError. -func (v VulnerabilityAssessmentScanError) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type VulnerabilityAssessmentScanRecordForSQLListResult. +func (v VulnerabilityAssessmentScanRecordForSQLListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "code", v.Code) - populate(objectMap, "message", v.Message) + populate(objectMap, "nextLink", v.NextLink) + populate(objectMap, "value", v.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type VulnerabilityAssessmentScanError. -func (v *VulnerabilityAssessmentScanError) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type VulnerabilityAssessmentScanRecordForSQLListResult. +func (v *VulnerabilityAssessmentScanRecordForSQLListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", v, err) @@ -17934,11 +20248,11 @@ func (v *VulnerabilityAssessmentScanError) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "code": - err = unpopulate(val, "Code", &v.Code) + case "nextLink": + err = unpopulate(val, "NextLink", &v.NextLink) delete(rawMsg, key) - case "message": - err = unpopulate(val, "Message", &v.Message) + case "value": + err = unpopulate(val, "Value", &v.Value) delete(rawMsg, key) } if err != nil { @@ -17948,18 +20262,31 @@ func (v *VulnerabilityAssessmentScanError) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type VulnerabilityAssessmentScanRecord. -func (v VulnerabilityAssessmentScanRecord) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type VulnerabilityAssessmentScanRecordForSQLProperties. +func (v VulnerabilityAssessmentScanRecordForSQLProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", v.ID) - populate(objectMap, "name", v.Name) - populate(objectMap, "properties", v.Properties) - populate(objectMap, "type", v.Type) + populate(objectMap, "database", v.Database) + populateTimeRFC3339(objectMap, "endTime", v.EndTime) + populate(objectMap, "errors", v.Errors) + populate(objectMap, "highSeverityFailedRulesCount", v.HighSeverityFailedRulesCount) + populate(objectMap, "isBaselineApplied", v.IsBaselineApplied) + populateTimeRFC3339(objectMap, "lastScanTime", v.LastScanTime) + populate(objectMap, "lowSeverityFailedRulesCount", v.LowSeverityFailedRulesCount) + populate(objectMap, "mediumSeverityFailedRulesCount", v.MediumSeverityFailedRulesCount) + populate(objectMap, "sqlVersion", v.SQLVersion) + populate(objectMap, "scanId", v.ScanID) + populate(objectMap, "server", v.Server) + populateTimeRFC3339(objectMap, "startTime", v.StartTime) + populate(objectMap, "state", v.State) + populate(objectMap, "totalFailedRulesCount", v.TotalFailedRulesCount) + populate(objectMap, "totalPassedRulesCount", v.TotalPassedRulesCount) + populate(objectMap, "totalRulesCount", v.TotalRulesCount) + populate(objectMap, "triggerType", v.TriggerType) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type VulnerabilityAssessmentScanRecord. -func (v *VulnerabilityAssessmentScanRecord) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type VulnerabilityAssessmentScanRecordForSQLProperties. +func (v *VulnerabilityAssessmentScanRecordForSQLProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", v, err) @@ -17967,17 +20294,56 @@ func (v *VulnerabilityAssessmentScanRecord) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &v.ID) + case "database": + err = unpopulate(val, "Database", &v.Database) delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &v.Name) + case "endTime": + err = unpopulateTimeRFC3339(val, "EndTime", &v.EndTime) delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &v.Properties) + case "errors": + err = unpopulate(val, "Errors", &v.Errors) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &v.Type) + case "highSeverityFailedRulesCount": + err = unpopulate(val, "HighSeverityFailedRulesCount", &v.HighSeverityFailedRulesCount) + delete(rawMsg, key) + case "isBaselineApplied": + err = unpopulate(val, "IsBaselineApplied", &v.IsBaselineApplied) + delete(rawMsg, key) + case "lastScanTime": + err = unpopulateTimeRFC3339(val, "LastScanTime", &v.LastScanTime) + delete(rawMsg, key) + case "lowSeverityFailedRulesCount": + err = unpopulate(val, "LowSeverityFailedRulesCount", &v.LowSeverityFailedRulesCount) + delete(rawMsg, key) + case "mediumSeverityFailedRulesCount": + err = unpopulate(val, "MediumSeverityFailedRulesCount", &v.MediumSeverityFailedRulesCount) + delete(rawMsg, key) + case "sqlVersion": + err = unpopulate(val, "SQLVersion", &v.SQLVersion) + delete(rawMsg, key) + case "scanId": + err = unpopulate(val, "ScanID", &v.ScanID) + delete(rawMsg, key) + case "server": + err = unpopulate(val, "Server", &v.Server) + delete(rawMsg, key) + case "startTime": + err = unpopulateTimeRFC3339(val, "StartTime", &v.StartTime) + delete(rawMsg, key) + case "state": + err = unpopulate(val, "State", &v.State) + delete(rawMsg, key) + case "totalFailedRulesCount": + err = unpopulate(val, "TotalFailedRulesCount", &v.TotalFailedRulesCount) + delete(rawMsg, key) + case "totalPassedRulesCount": + err = unpopulate(val, "TotalPassedRulesCount", &v.TotalPassedRulesCount) + delete(rawMsg, key) + case "totalRulesCount": + err = unpopulate(val, "TotalRulesCount", &v.TotalRulesCount) + delete(rawMsg, key) + case "triggerType": + err = unpopulate(val, "TriggerType", &v.TriggerType) delete(rawMsg, key) } if err != nil { @@ -18073,6 +20439,104 @@ func (v *VulnerabilityAssessmentScanRecordProperties) UnmarshalJSON(data []byte) return nil } +// MarshalJSON implements the json.Marshaller interface for type VulnerabilityAssessmentScanResultProperties. +func (v VulnerabilityAssessmentScanResultProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "baselineAdjustedResult", v.BaselineAdjustedResult) + populate(objectMap, "errorMessage", v.ErrorMessage) + populate(objectMap, "isTrimmed", v.IsTrimmed) + populate(objectMap, "queryResults", v.QueryResults) + populate(objectMap, "remediation", v.Remediation) + populate(objectMap, "ruleId", v.RuleID) + populate(objectMap, "ruleMetadata", v.RuleMetadata) + populate(objectMap, "status", v.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VulnerabilityAssessmentScanResultProperties. +func (v *VulnerabilityAssessmentScanResultProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "baselineAdjustedResult": + err = unpopulate(val, "BaselineAdjustedResult", &v.BaselineAdjustedResult) + delete(rawMsg, key) + case "errorMessage": + err = unpopulate(val, "ErrorMessage", &v.ErrorMessage) + delete(rawMsg, key) + case "isTrimmed": + err = unpopulate(val, "IsTrimmed", &v.IsTrimmed) + delete(rawMsg, key) + case "queryResults": + err = unpopulate(val, "QueryResults", &v.QueryResults) + delete(rawMsg, key) + case "remediation": + err = unpopulate(val, "Remediation", &v.Remediation) + delete(rawMsg, key) + case "ruleId": + err = unpopulate(val, "RuleID", &v.RuleID) + delete(rawMsg, key) + case "ruleMetadata": + err = unpopulate(val, "RuleMetadata", &v.RuleMetadata) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &v.Status) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VulnerabilityAssessmentScanResults. +func (v VulnerabilityAssessmentScanResults) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", v.ID) + populate(objectMap, "name", v.Name) + populate(objectMap, "properties", v.Properties) + populate(objectMap, "systemData", v.SystemData) + populate(objectMap, "type", v.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VulnerabilityAssessmentScanResults. +func (v *VulnerabilityAssessmentScanResults) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &v.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &v.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &v.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &v.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &v.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type WorkloadClassifier. func (w WorkloadClassifier) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) diff --git a/sdk/resourcemanager/sql/armsql/networksecurityperimeterconfigurations_client.go b/sdk/resourcemanager/sql/armsql/networksecurityperimeterconfigurations_client.go new file mode 100644 index 000000000000..2c500bdb0052 --- /dev/null +++ b/sdk/resourcemanager/sql/armsql/networksecurityperimeterconfigurations_client.go @@ -0,0 +1,256 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armsql + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// NetworkSecurityPerimeterConfigurationsClient contains the methods for the NetworkSecurityPerimeterConfigurations group. +// Don't use this type directly, use NewNetworkSecurityPerimeterConfigurationsClient() instead. +type NetworkSecurityPerimeterConfigurationsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewNetworkSecurityPerimeterConfigurationsClient creates a new instance of NetworkSecurityPerimeterConfigurationsClient with the specified values. +// - subscriptionID - The subscription ID that identifies an Azure subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewNetworkSecurityPerimeterConfigurationsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*NetworkSecurityPerimeterConfigurationsClient, error) { + cl, err := arm.NewClient(moduleName+".NetworkSecurityPerimeterConfigurationsClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &NetworkSecurityPerimeterConfigurationsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Get - Gets a network security perimeter configuration. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-11-01-preview +// - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure +// Resource Manager API or the portal. +// - serverName - The name of the server. +// - options - NetworkSecurityPerimeterConfigurationsClientGetOptions contains the optional parameters for the NetworkSecurityPerimeterConfigurationsClient.Get +// method. +func (client *NetworkSecurityPerimeterConfigurationsClient) Get(ctx context.Context, resourceGroupName string, serverName string, nspConfigName string, options *NetworkSecurityPerimeterConfigurationsClientGetOptions) (NetworkSecurityPerimeterConfigurationsClientGetResponse, error) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, serverName, nspConfigName, options) + if err != nil { + return NetworkSecurityPerimeterConfigurationsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return NetworkSecurityPerimeterConfigurationsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return NetworkSecurityPerimeterConfigurationsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *NetworkSecurityPerimeterConfigurationsClient) getCreateRequest(ctx context.Context, resourceGroupName string, serverName string, nspConfigName string, options *NetworkSecurityPerimeterConfigurationsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/networkSecurityPerimeterConfigurations/{nspConfigName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serverName == "" { + return nil, errors.New("parameter serverName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serverName}", url.PathEscape(serverName)) + if nspConfigName == "" { + return nil, errors.New("parameter nspConfigName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{nspConfigName}", url.PathEscape(nspConfigName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *NetworkSecurityPerimeterConfigurationsClient) getHandleResponse(resp *http.Response) (NetworkSecurityPerimeterConfigurationsClientGetResponse, error) { + result := NetworkSecurityPerimeterConfigurationsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.NetworkSecurityPerimeterConfiguration); err != nil { + return NetworkSecurityPerimeterConfigurationsClientGetResponse{}, err + } + return result, nil +} + +// NewListByServerPager - Gets a list of NSP configurations for a server. +// +// Generated from API version 2022-11-01-preview +// - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure +// Resource Manager API or the portal. +// - serverName - The name of the server. +// - options - NetworkSecurityPerimeterConfigurationsClientListByServerOptions contains the optional parameters for the NetworkSecurityPerimeterConfigurationsClient.NewListByServerPager +// method. +func (client *NetworkSecurityPerimeterConfigurationsClient) NewListByServerPager(resourceGroupName string, serverName string, options *NetworkSecurityPerimeterConfigurationsClientListByServerOptions) *runtime.Pager[NetworkSecurityPerimeterConfigurationsClientListByServerResponse] { + return runtime.NewPager(runtime.PagingHandler[NetworkSecurityPerimeterConfigurationsClientListByServerResponse]{ + More: func(page NetworkSecurityPerimeterConfigurationsClientListByServerResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *NetworkSecurityPerimeterConfigurationsClientListByServerResponse) (NetworkSecurityPerimeterConfigurationsClientListByServerResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByServerCreateRequest(ctx, resourceGroupName, serverName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return NetworkSecurityPerimeterConfigurationsClientListByServerResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return NetworkSecurityPerimeterConfigurationsClientListByServerResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return NetworkSecurityPerimeterConfigurationsClientListByServerResponse{}, runtime.NewResponseError(resp) + } + return client.listByServerHandleResponse(resp) + }, + }) +} + +// listByServerCreateRequest creates the ListByServer request. +func (client *NetworkSecurityPerimeterConfigurationsClient) listByServerCreateRequest(ctx context.Context, resourceGroupName string, serverName string, options *NetworkSecurityPerimeterConfigurationsClientListByServerOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/networkSecurityPerimeterConfigurations" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serverName == "" { + return nil, errors.New("parameter serverName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serverName}", url.PathEscape(serverName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByServerHandleResponse handles the ListByServer response. +func (client *NetworkSecurityPerimeterConfigurationsClient) listByServerHandleResponse(resp *http.Response) (NetworkSecurityPerimeterConfigurationsClientListByServerResponse, error) { + result := NetworkSecurityPerimeterConfigurationsClientListByServerResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.NetworkSecurityPerimeterConfigurationListResult); err != nil { + return NetworkSecurityPerimeterConfigurationsClientListByServerResponse{}, err + } + return result, nil +} + +// BeginReconcile - Reconcile network security perimeter configuration for SQL Resource Provider +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-11-01-preview +// - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure +// Resource Manager API or the portal. +// - serverName - The name of the server. +// - options - NetworkSecurityPerimeterConfigurationsClientBeginReconcileOptions contains the optional parameters for the NetworkSecurityPerimeterConfigurationsClient.BeginReconcile +// method. +func (client *NetworkSecurityPerimeterConfigurationsClient) BeginReconcile(ctx context.Context, resourceGroupName string, serverName string, nspConfigName string, options *NetworkSecurityPerimeterConfigurationsClientBeginReconcileOptions) (*runtime.Poller[NetworkSecurityPerimeterConfigurationsClientReconcileResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.reconcile(ctx, resourceGroupName, serverName, nspConfigName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[NetworkSecurityPerimeterConfigurationsClientReconcileResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[NetworkSecurityPerimeterConfigurationsClientReconcileResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Reconcile - Reconcile network security perimeter configuration for SQL Resource Provider +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-11-01-preview +func (client *NetworkSecurityPerimeterConfigurationsClient) reconcile(ctx context.Context, resourceGroupName string, serverName string, nspConfigName string, options *NetworkSecurityPerimeterConfigurationsClientBeginReconcileOptions) (*http.Response, error) { + var err error + req, err := client.reconcileCreateRequest(ctx, resourceGroupName, serverName, nspConfigName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// reconcileCreateRequest creates the Reconcile request. +func (client *NetworkSecurityPerimeterConfigurationsClient) reconcileCreateRequest(ctx context.Context, resourceGroupName string, serverName string, nspConfigName string, options *NetworkSecurityPerimeterConfigurationsClientBeginReconcileOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/networkSecurityPerimeterConfigurations/{nspConfigName}/reconcile" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serverName == "" { + return nil, errors.New("parameter serverName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serverName}", url.PathEscape(serverName)) + if nspConfigName == "" { + return nil, errors.New("parameter nspConfigName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{nspConfigName}", url.PathEscape(nspConfigName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} diff --git a/sdk/resourcemanager/sql/armsql/operations_client.go b/sdk/resourcemanager/sql/armsql/operations_client.go index ed850b20b5f1..50d4ed7ddb41 100644 --- a/sdk/resourcemanager/sql/armsql/operations_client.go +++ b/sdk/resourcemanager/sql/armsql/operations_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armsql @@ -40,7 +39,7 @@ func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientO // NewListPager - Lists all of the available SQL Rest API operations. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - options - OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. func (client *OperationsClient) NewListPager(options *OperationsClientListOptions) *runtime.Pager[OperationsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[OperationsClientListResponse]{ @@ -78,7 +77,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/sql/armsql/options.go b/sdk/resourcemanager/sql/armsql/options.go new file mode 100644 index 000000000000..0cf92051dbd2 --- /dev/null +++ b/sdk/resourcemanager/sql/armsql/options.go @@ -0,0 +1,3378 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armsql + +import "time" + +// AgentClientCreateOrUpdateOptions contains the optional parameters for the AgentClient.CreateOrUpdate method. +type AgentClientCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// AgentClientGetOptions contains the optional parameters for the AgentClient.Get method. +type AgentClientGetOptions struct { + // placeholder for future optional parameters +} + +// BackupShortTermRetentionPoliciesClientBeginCreateOrUpdateOptions contains the optional parameters for the BackupShortTermRetentionPoliciesClient.BeginCreateOrUpdate +// method. +type BackupShortTermRetentionPoliciesClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// BackupShortTermRetentionPoliciesClientBeginUpdateOptions contains the optional parameters for the BackupShortTermRetentionPoliciesClient.BeginUpdate +// method. +type BackupShortTermRetentionPoliciesClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// BackupShortTermRetentionPoliciesClientGetOptions contains the optional parameters for the BackupShortTermRetentionPoliciesClient.Get +// method. +type BackupShortTermRetentionPoliciesClientGetOptions struct { + // placeholder for future optional parameters +} + +// BackupShortTermRetentionPoliciesClientListByDatabaseOptions contains the optional parameters for the BackupShortTermRetentionPoliciesClient.NewListByDatabasePager +// method. +type BackupShortTermRetentionPoliciesClientListByDatabaseOptions struct { + // placeholder for future optional parameters +} + +// CapabilitiesClientListByLocationOptions contains the optional parameters for the CapabilitiesClient.ListByLocation method. +type CapabilitiesClientListByLocationOptions struct { + // If specified, restricts the response to only include the selected item. + Include *CapabilityGroup +} + +// DataMaskingPoliciesClientCreateOrUpdateOptions contains the optional parameters for the DataMaskingPoliciesClient.CreateOrUpdate +// method. +type DataMaskingPoliciesClientCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// DataMaskingPoliciesClientGetOptions contains the optional parameters for the DataMaskingPoliciesClient.Get method. +type DataMaskingPoliciesClientGetOptions struct { + // placeholder for future optional parameters +} + +// DataMaskingRulesClientCreateOrUpdateOptions contains the optional parameters for the DataMaskingRulesClient.CreateOrUpdate +// method. +type DataMaskingRulesClientCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// DataMaskingRulesClientListByDatabaseOptions contains the optional parameters for the DataMaskingRulesClient.NewListByDatabasePager +// method. +type DataMaskingRulesClientListByDatabaseOptions struct { + // placeholder for future optional parameters +} + +// DataWarehouseUserActivitiesClientGetOptions contains the optional parameters for the DataWarehouseUserActivitiesClient.Get +// method. +type DataWarehouseUserActivitiesClientGetOptions struct { + // placeholder for future optional parameters +} + +// DataWarehouseUserActivitiesClientListByDatabaseOptions contains the optional parameters for the DataWarehouseUserActivitiesClient.NewListByDatabasePager +// method. +type DataWarehouseUserActivitiesClientListByDatabaseOptions struct { + // placeholder for future optional parameters +} + +// DatabaseAdvancedThreatProtectionSettingsClientCreateOrUpdateOptions contains the optional parameters for the DatabaseAdvancedThreatProtectionSettingsClient.CreateOrUpdate +// method. +type DatabaseAdvancedThreatProtectionSettingsClientCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// DatabaseAdvancedThreatProtectionSettingsClientGetOptions contains the optional parameters for the DatabaseAdvancedThreatProtectionSettingsClient.Get +// method. +type DatabaseAdvancedThreatProtectionSettingsClientGetOptions struct { + // placeholder for future optional parameters +} + +// DatabaseAdvancedThreatProtectionSettingsClientListByDatabaseOptions contains the optional parameters for the DatabaseAdvancedThreatProtectionSettingsClient.NewListByDatabasePager +// method. +type DatabaseAdvancedThreatProtectionSettingsClientListByDatabaseOptions struct { + // placeholder for future optional parameters +} + +// DatabaseAdvisorsClientGetOptions contains the optional parameters for the DatabaseAdvisorsClient.Get method. +type DatabaseAdvisorsClientGetOptions struct { + // placeholder for future optional parameters +} + +// DatabaseAdvisorsClientListByDatabaseOptions contains the optional parameters for the DatabaseAdvisorsClient.ListByDatabase +// method. +type DatabaseAdvisorsClientListByDatabaseOptions struct { + // The child resources to include in the response. + Expand *string +} + +// DatabaseAdvisorsClientUpdateOptions contains the optional parameters for the DatabaseAdvisorsClient.Update method. +type DatabaseAdvisorsClientUpdateOptions struct { + // placeholder for future optional parameters +} + +// DatabaseAutomaticTuningClientGetOptions contains the optional parameters for the DatabaseAutomaticTuningClient.Get method. +type DatabaseAutomaticTuningClientGetOptions struct { + // placeholder for future optional parameters +} + +// DatabaseAutomaticTuningClientUpdateOptions contains the optional parameters for the DatabaseAutomaticTuningClient.Update +// method. +type DatabaseAutomaticTuningClientUpdateOptions struct { + // placeholder for future optional parameters +} + +// DatabaseBlobAuditingPoliciesClientCreateOrUpdateOptions contains the optional parameters for the DatabaseBlobAuditingPoliciesClient.CreateOrUpdate +// method. +type DatabaseBlobAuditingPoliciesClientCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// DatabaseBlobAuditingPoliciesClientGetOptions contains the optional parameters for the DatabaseBlobAuditingPoliciesClient.Get +// method. +type DatabaseBlobAuditingPoliciesClientGetOptions struct { + // placeholder for future optional parameters +} + +// DatabaseBlobAuditingPoliciesClientListByDatabaseOptions contains the optional parameters for the DatabaseBlobAuditingPoliciesClient.NewListByDatabasePager +// method. +type DatabaseBlobAuditingPoliciesClientListByDatabaseOptions struct { + // placeholder for future optional parameters +} + +// DatabaseColumnsClientGetOptions contains the optional parameters for the DatabaseColumnsClient.Get method. +type DatabaseColumnsClientGetOptions struct { + // placeholder for future optional parameters +} + +// DatabaseColumnsClientListByDatabaseOptions contains the optional parameters for the DatabaseColumnsClient.NewListByDatabasePager +// method. +type DatabaseColumnsClientListByDatabaseOptions struct { + Column []string + OrderBy []string + Schema []string + + // An opaque token that identifies a starting point in the collection. + Skiptoken *string + Table []string +} + +// DatabaseColumnsClientListByTableOptions contains the optional parameters for the DatabaseColumnsClient.NewListByTablePager +// method. +type DatabaseColumnsClientListByTableOptions struct { + // An OData filter expression that filters elements in the collection. + Filter *string +} + +// DatabaseEncryptionProtectorsClientBeginRevalidateOptions contains the optional parameters for the DatabaseEncryptionProtectorsClient.BeginRevalidate +// method. +type DatabaseEncryptionProtectorsClientBeginRevalidateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DatabaseEncryptionProtectorsClientBeginRevertOptions contains the optional parameters for the DatabaseEncryptionProtectorsClient.BeginRevert +// method. +type DatabaseEncryptionProtectorsClientBeginRevertOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DatabaseExtensionsClientBeginCreateOrUpdateOptions contains the optional parameters for the DatabaseExtensionsClient.BeginCreateOrUpdate +// method. +type DatabaseExtensionsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DatabaseExtensionsClientGetOptions contains the optional parameters for the DatabaseExtensionsClient.Get method. +type DatabaseExtensionsClientGetOptions struct { + // placeholder for future optional parameters +} + +// DatabaseExtensionsClientListByDatabaseOptions contains the optional parameters for the DatabaseExtensionsClient.NewListByDatabasePager +// method. +type DatabaseExtensionsClientListByDatabaseOptions struct { + // placeholder for future optional parameters +} + +// DatabaseOperationsClientCancelOptions contains the optional parameters for the DatabaseOperationsClient.Cancel method. +type DatabaseOperationsClientCancelOptions struct { + // placeholder for future optional parameters +} + +// DatabaseOperationsClientListByDatabaseOptions contains the optional parameters for the DatabaseOperationsClient.NewListByDatabasePager +// method. +type DatabaseOperationsClientListByDatabaseOptions struct { + // placeholder for future optional parameters +} + +// DatabaseRecommendedActionsClientGetOptions contains the optional parameters for the DatabaseRecommendedActionsClient.Get +// method. +type DatabaseRecommendedActionsClientGetOptions struct { + // placeholder for future optional parameters +} + +// DatabaseRecommendedActionsClientListByDatabaseAdvisorOptions contains the optional parameters for the DatabaseRecommendedActionsClient.ListByDatabaseAdvisor +// method. +type DatabaseRecommendedActionsClientListByDatabaseAdvisorOptions struct { + // placeholder for future optional parameters +} + +// DatabaseRecommendedActionsClientUpdateOptions contains the optional parameters for the DatabaseRecommendedActionsClient.Update +// method. +type DatabaseRecommendedActionsClientUpdateOptions struct { + // placeholder for future optional parameters +} + +// DatabaseSQLVulnerabilityAssessmentBaselinesClientCreateOrUpdateOptions contains the optional parameters for the DatabaseSQLVulnerabilityAssessmentBaselinesClient.CreateOrUpdate +// method. +type DatabaseSQLVulnerabilityAssessmentBaselinesClientCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// DatabaseSQLVulnerabilityAssessmentBaselinesClientGetOptions contains the optional parameters for the DatabaseSQLVulnerabilityAssessmentBaselinesClient.Get +// method. +type DatabaseSQLVulnerabilityAssessmentBaselinesClientGetOptions struct { + // placeholder for future optional parameters +} + +// DatabaseSQLVulnerabilityAssessmentBaselinesClientListBySQLVulnerabilityAssessmentOptions contains the optional parameters +// for the DatabaseSQLVulnerabilityAssessmentBaselinesClient.NewListBySQLVulnerabilityAssessmentPager method. +type DatabaseSQLVulnerabilityAssessmentBaselinesClientListBySQLVulnerabilityAssessmentOptions struct { + // placeholder for future optional parameters +} + +// DatabaseSQLVulnerabilityAssessmentExecuteScanClientBeginExecuteOptions contains the optional parameters for the DatabaseSQLVulnerabilityAssessmentExecuteScanClient.BeginExecute +// method. +type DatabaseSQLVulnerabilityAssessmentExecuteScanClientBeginExecuteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DatabaseSQLVulnerabilityAssessmentRuleBaselinesClientCreateOrUpdateOptions contains the optional parameters for the DatabaseSQLVulnerabilityAssessmentRuleBaselinesClient.CreateOrUpdate +// method. +type DatabaseSQLVulnerabilityAssessmentRuleBaselinesClientCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// DatabaseSQLVulnerabilityAssessmentRuleBaselinesClientDeleteOptions contains the optional parameters for the DatabaseSQLVulnerabilityAssessmentRuleBaselinesClient.Delete +// method. +type DatabaseSQLVulnerabilityAssessmentRuleBaselinesClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// DatabaseSQLVulnerabilityAssessmentRuleBaselinesClientGetOptions contains the optional parameters for the DatabaseSQLVulnerabilityAssessmentRuleBaselinesClient.Get +// method. +type DatabaseSQLVulnerabilityAssessmentRuleBaselinesClientGetOptions struct { + // placeholder for future optional parameters +} + +// DatabaseSQLVulnerabilityAssessmentRuleBaselinesClientListByBaselineOptions contains the optional parameters for the DatabaseSQLVulnerabilityAssessmentRuleBaselinesClient.NewListByBaselinePager +// method. +type DatabaseSQLVulnerabilityAssessmentRuleBaselinesClientListByBaselineOptions struct { + // placeholder for future optional parameters +} + +// DatabaseSQLVulnerabilityAssessmentScanResultClientGetOptions contains the optional parameters for the DatabaseSQLVulnerabilityAssessmentScanResultClient.Get +// method. +type DatabaseSQLVulnerabilityAssessmentScanResultClientGetOptions struct { + // placeholder for future optional parameters +} + +// DatabaseSQLVulnerabilityAssessmentScanResultClientListByScanOptions contains the optional parameters for the DatabaseSQLVulnerabilityAssessmentScanResultClient.NewListByScanPager +// method. +type DatabaseSQLVulnerabilityAssessmentScanResultClientListByScanOptions struct { + // placeholder for future optional parameters +} + +// DatabaseSQLVulnerabilityAssessmentScansClientGetOptions contains the optional parameters for the DatabaseSQLVulnerabilityAssessmentScansClient.Get +// method. +type DatabaseSQLVulnerabilityAssessmentScansClientGetOptions struct { + // placeholder for future optional parameters +} + +// DatabaseSQLVulnerabilityAssessmentScansClientListBySQLVulnerabilityAssessmentsOptions contains the optional parameters +// for the DatabaseSQLVulnerabilityAssessmentScansClient.NewListBySQLVulnerabilityAssessmentsPager method. +type DatabaseSQLVulnerabilityAssessmentScansClientListBySQLVulnerabilityAssessmentsOptions struct { + // placeholder for future optional parameters +} + +// DatabaseSQLVulnerabilityAssessmentsSettingsClientGetOptions contains the optional parameters for the DatabaseSQLVulnerabilityAssessmentsSettingsClient.Get +// method. +type DatabaseSQLVulnerabilityAssessmentsSettingsClientGetOptions struct { + // placeholder for future optional parameters +} + +// DatabaseSQLVulnerabilityAssessmentsSettingsClientListByDatabaseOptions contains the optional parameters for the DatabaseSQLVulnerabilityAssessmentsSettingsClient.NewListByDatabasePager +// method. +type DatabaseSQLVulnerabilityAssessmentsSettingsClientListByDatabaseOptions struct { + // placeholder for future optional parameters +} + +// DatabaseSchemasClientGetOptions contains the optional parameters for the DatabaseSchemasClient.Get method. +type DatabaseSchemasClientGetOptions struct { + // placeholder for future optional parameters +} + +// DatabaseSchemasClientListByDatabaseOptions contains the optional parameters for the DatabaseSchemasClient.NewListByDatabasePager +// method. +type DatabaseSchemasClientListByDatabaseOptions struct { + // An OData filter expression that filters elements in the collection. + Filter *string +} + +// DatabaseSecurityAlertPoliciesClientCreateOrUpdateOptions contains the optional parameters for the DatabaseSecurityAlertPoliciesClient.CreateOrUpdate +// method. +type DatabaseSecurityAlertPoliciesClientCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// DatabaseSecurityAlertPoliciesClientGetOptions contains the optional parameters for the DatabaseSecurityAlertPoliciesClient.Get +// method. +type DatabaseSecurityAlertPoliciesClientGetOptions struct { + // placeholder for future optional parameters +} + +// DatabaseSecurityAlertPoliciesClientListByDatabaseOptions contains the optional parameters for the DatabaseSecurityAlertPoliciesClient.NewListByDatabasePager +// method. +type DatabaseSecurityAlertPoliciesClientListByDatabaseOptions struct { + // placeholder for future optional parameters +} + +// DatabaseTablesClientGetOptions contains the optional parameters for the DatabaseTablesClient.Get method. +type DatabaseTablesClientGetOptions struct { + // placeholder for future optional parameters +} + +// DatabaseTablesClientListBySchemaOptions contains the optional parameters for the DatabaseTablesClient.NewListBySchemaPager +// method. +type DatabaseTablesClientListBySchemaOptions struct { + // An OData filter expression that filters elements in the collection. + Filter *string +} + +// DatabaseUsagesClientListByDatabaseOptions contains the optional parameters for the DatabaseUsagesClient.NewListByDatabasePager +// method. +type DatabaseUsagesClientListByDatabaseOptions struct { + // placeholder for future optional parameters +} + +// DatabaseVulnerabilityAssessmentRuleBaselinesClientCreateOrUpdateOptions contains the optional parameters for the DatabaseVulnerabilityAssessmentRuleBaselinesClient.CreateOrUpdate +// method. +type DatabaseVulnerabilityAssessmentRuleBaselinesClientCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// DatabaseVulnerabilityAssessmentRuleBaselinesClientDeleteOptions contains the optional parameters for the DatabaseVulnerabilityAssessmentRuleBaselinesClient.Delete +// method. +type DatabaseVulnerabilityAssessmentRuleBaselinesClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// DatabaseVulnerabilityAssessmentRuleBaselinesClientGetOptions contains the optional parameters for the DatabaseVulnerabilityAssessmentRuleBaselinesClient.Get +// method. +type DatabaseVulnerabilityAssessmentRuleBaselinesClientGetOptions struct { + // placeholder for future optional parameters +} + +// DatabaseVulnerabilityAssessmentScansClientBeginInitiateScanOptions contains the optional parameters for the DatabaseVulnerabilityAssessmentScansClient.BeginInitiateScan +// method. +type DatabaseVulnerabilityAssessmentScansClientBeginInitiateScanOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DatabaseVulnerabilityAssessmentScansClientExportOptions contains the optional parameters for the DatabaseVulnerabilityAssessmentScansClient.Export +// method. +type DatabaseVulnerabilityAssessmentScansClientExportOptions struct { + // placeholder for future optional parameters +} + +// DatabaseVulnerabilityAssessmentScansClientGetOptions contains the optional parameters for the DatabaseVulnerabilityAssessmentScansClient.Get +// method. +type DatabaseVulnerabilityAssessmentScansClientGetOptions struct { + // placeholder for future optional parameters +} + +// DatabaseVulnerabilityAssessmentScansClientListByDatabaseOptions contains the optional parameters for the DatabaseVulnerabilityAssessmentScansClient.NewListByDatabasePager +// method. +type DatabaseVulnerabilityAssessmentScansClientListByDatabaseOptions struct { + // placeholder for future optional parameters +} + +// DatabaseVulnerabilityAssessmentsClientCreateOrUpdateOptions contains the optional parameters for the DatabaseVulnerabilityAssessmentsClient.CreateOrUpdate +// method. +type DatabaseVulnerabilityAssessmentsClientCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// DatabaseVulnerabilityAssessmentsClientDeleteOptions contains the optional parameters for the DatabaseVulnerabilityAssessmentsClient.Delete +// method. +type DatabaseVulnerabilityAssessmentsClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// DatabaseVulnerabilityAssessmentsClientGetOptions contains the optional parameters for the DatabaseVulnerabilityAssessmentsClient.Get +// method. +type DatabaseVulnerabilityAssessmentsClientGetOptions struct { + // placeholder for future optional parameters +} + +// DatabaseVulnerabilityAssessmentsClientListByDatabaseOptions contains the optional parameters for the DatabaseVulnerabilityAssessmentsClient.NewListByDatabasePager +// method. +type DatabaseVulnerabilityAssessmentsClientListByDatabaseOptions struct { + // placeholder for future optional parameters +} + +// DatabasesClientBeginCreateOrUpdateOptions contains the optional parameters for the DatabasesClient.BeginCreateOrUpdate +// method. +type DatabasesClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DatabasesClientBeginDeleteOptions contains the optional parameters for the DatabasesClient.BeginDelete method. +type DatabasesClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DatabasesClientBeginExportOptions contains the optional parameters for the DatabasesClient.BeginExport method. +type DatabasesClientBeginExportOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DatabasesClientBeginFailoverOptions contains the optional parameters for the DatabasesClient.BeginFailover method. +type DatabasesClientBeginFailoverOptions struct { + // The type of replica to be failed over. + ReplicaType *ReplicaType + + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DatabasesClientBeginImportOptions contains the optional parameters for the DatabasesClient.BeginImport method. +type DatabasesClientBeginImportOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DatabasesClientBeginPauseOptions contains the optional parameters for the DatabasesClient.BeginPause method. +type DatabasesClientBeginPauseOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DatabasesClientBeginResumeOptions contains the optional parameters for the DatabasesClient.BeginResume method. +type DatabasesClientBeginResumeOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DatabasesClientBeginUpdateOptions contains the optional parameters for the DatabasesClient.BeginUpdate method. +type DatabasesClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DatabasesClientBeginUpgradeDataWarehouseOptions contains the optional parameters for the DatabasesClient.BeginUpgradeDataWarehouse +// method. +type DatabasesClientBeginUpgradeDataWarehouseOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DatabasesClientGetOptions contains the optional parameters for the DatabasesClient.Get method. +type DatabasesClientGetOptions struct { + // The child resources to include in the response. + Expand *string + + // An OData filter expression that filters elements in the collection. + Filter *string +} + +// DatabasesClientListByElasticPoolOptions contains the optional parameters for the DatabasesClient.NewListByElasticPoolPager +// method. +type DatabasesClientListByElasticPoolOptions struct { + // placeholder for future optional parameters +} + +// DatabasesClientListByServerOptions contains the optional parameters for the DatabasesClient.NewListByServerPager method. +type DatabasesClientListByServerOptions struct { + SkipToken *string +} + +// DatabasesClientListInaccessibleByServerOptions contains the optional parameters for the DatabasesClient.NewListInaccessibleByServerPager +// method. +type DatabasesClientListInaccessibleByServerOptions struct { + // placeholder for future optional parameters +} + +// DatabasesClientRenameOptions contains the optional parameters for the DatabasesClient.Rename method. +type DatabasesClientRenameOptions struct { + // placeholder for future optional parameters +} + +// DeletedServersClientBeginRecoverOptions contains the optional parameters for the DeletedServersClient.BeginRecover method. +type DeletedServersClientBeginRecoverOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DeletedServersClientGetOptions contains the optional parameters for the DeletedServersClient.Get method. +type DeletedServersClientGetOptions struct { + // placeholder for future optional parameters +} + +// DeletedServersClientListByLocationOptions contains the optional parameters for the DeletedServersClient.NewListByLocationPager +// method. +type DeletedServersClientListByLocationOptions struct { + // placeholder for future optional parameters +} + +// DeletedServersClientListOptions contains the optional parameters for the DeletedServersClient.NewListPager method. +type DeletedServersClientListOptions struct { + // placeholder for future optional parameters +} + +// DistributedAvailabilityGroupsClientBeginCreateOrUpdateOptions contains the optional parameters for the DistributedAvailabilityGroupsClient.BeginCreateOrUpdate +// method. +type DistributedAvailabilityGroupsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DistributedAvailabilityGroupsClientBeginDeleteOptions contains the optional parameters for the DistributedAvailabilityGroupsClient.BeginDelete +// method. +type DistributedAvailabilityGroupsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DistributedAvailabilityGroupsClientBeginSetRoleOptions contains the optional parameters for the DistributedAvailabilityGroupsClient.BeginSetRole +// method. +type DistributedAvailabilityGroupsClientBeginSetRoleOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DistributedAvailabilityGroupsClientBeginUpdateOptions contains the optional parameters for the DistributedAvailabilityGroupsClient.BeginUpdate +// method. +type DistributedAvailabilityGroupsClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DistributedAvailabilityGroupsClientGetOptions contains the optional parameters for the DistributedAvailabilityGroupsClient.Get +// method. +type DistributedAvailabilityGroupsClientGetOptions struct { + // placeholder for future optional parameters +} + +// DistributedAvailabilityGroupsClientListByInstanceOptions contains the optional parameters for the DistributedAvailabilityGroupsClient.NewListByInstancePager +// method. +type DistributedAvailabilityGroupsClientListByInstanceOptions struct { + // placeholder for future optional parameters +} + +// ElasticPoolOperationsClientCancelOptions contains the optional parameters for the ElasticPoolOperationsClient.Cancel method. +type ElasticPoolOperationsClientCancelOptions struct { + // placeholder for future optional parameters +} + +// ElasticPoolOperationsClientListByElasticPoolOptions contains the optional parameters for the ElasticPoolOperationsClient.NewListByElasticPoolPager +// method. +type ElasticPoolOperationsClientListByElasticPoolOptions struct { + // placeholder for future optional parameters +} + +// ElasticPoolsClientBeginCreateOrUpdateOptions contains the optional parameters for the ElasticPoolsClient.BeginCreateOrUpdate +// method. +type ElasticPoolsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ElasticPoolsClientBeginDeleteOptions contains the optional parameters for the ElasticPoolsClient.BeginDelete method. +type ElasticPoolsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ElasticPoolsClientBeginFailoverOptions contains the optional parameters for the ElasticPoolsClient.BeginFailover method. +type ElasticPoolsClientBeginFailoverOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ElasticPoolsClientBeginUpdateOptions contains the optional parameters for the ElasticPoolsClient.BeginUpdate method. +type ElasticPoolsClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ElasticPoolsClientGetOptions contains the optional parameters for the ElasticPoolsClient.Get method. +type ElasticPoolsClientGetOptions struct { + // placeholder for future optional parameters +} + +// ElasticPoolsClientListByServerOptions contains the optional parameters for the ElasticPoolsClient.NewListByServerPager +// method. +type ElasticPoolsClientListByServerOptions struct { + // The number of elements in the collection to skip. + Skip *int64 +} + +// EncryptionProtectorsClientBeginCreateOrUpdateOptions contains the optional parameters for the EncryptionProtectorsClient.BeginCreateOrUpdate +// method. +type EncryptionProtectorsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// EncryptionProtectorsClientBeginRevalidateOptions contains the optional parameters for the EncryptionProtectorsClient.BeginRevalidate +// method. +type EncryptionProtectorsClientBeginRevalidateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// EncryptionProtectorsClientGetOptions contains the optional parameters for the EncryptionProtectorsClient.Get method. +type EncryptionProtectorsClientGetOptions struct { + // placeholder for future optional parameters +} + +// EncryptionProtectorsClientListByServerOptions contains the optional parameters for the EncryptionProtectorsClient.NewListByServerPager +// method. +type EncryptionProtectorsClientListByServerOptions struct { + // placeholder for future optional parameters +} + +// EndpointCertificatesClientGetOptions contains the optional parameters for the EndpointCertificatesClient.Get method. +type EndpointCertificatesClientGetOptions struct { + // placeholder for future optional parameters +} + +// EndpointCertificatesClientListByInstanceOptions contains the optional parameters for the EndpointCertificatesClient.NewListByInstancePager +// method. +type EndpointCertificatesClientListByInstanceOptions struct { + // placeholder for future optional parameters +} + +// ExtendedDatabaseBlobAuditingPoliciesClientCreateOrUpdateOptions contains the optional parameters for the ExtendedDatabaseBlobAuditingPoliciesClient.CreateOrUpdate +// method. +type ExtendedDatabaseBlobAuditingPoliciesClientCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// ExtendedDatabaseBlobAuditingPoliciesClientGetOptions contains the optional parameters for the ExtendedDatabaseBlobAuditingPoliciesClient.Get +// method. +type ExtendedDatabaseBlobAuditingPoliciesClientGetOptions struct { + // placeholder for future optional parameters +} + +// ExtendedDatabaseBlobAuditingPoliciesClientListByDatabaseOptions contains the optional parameters for the ExtendedDatabaseBlobAuditingPoliciesClient.NewListByDatabasePager +// method. +type ExtendedDatabaseBlobAuditingPoliciesClientListByDatabaseOptions struct { + // placeholder for future optional parameters +} + +// ExtendedServerBlobAuditingPoliciesClientBeginCreateOrUpdateOptions contains the optional parameters for the ExtendedServerBlobAuditingPoliciesClient.BeginCreateOrUpdate +// method. +type ExtendedServerBlobAuditingPoliciesClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ExtendedServerBlobAuditingPoliciesClientGetOptions contains the optional parameters for the ExtendedServerBlobAuditingPoliciesClient.Get +// method. +type ExtendedServerBlobAuditingPoliciesClientGetOptions struct { + // placeholder for future optional parameters +} + +// ExtendedServerBlobAuditingPoliciesClientListByServerOptions contains the optional parameters for the ExtendedServerBlobAuditingPoliciesClient.NewListByServerPager +// method. +type ExtendedServerBlobAuditingPoliciesClientListByServerOptions struct { + // placeholder for future optional parameters +} + +// FailoverGroupsClientBeginCreateOrUpdateOptions contains the optional parameters for the FailoverGroupsClient.BeginCreateOrUpdate +// method. +type FailoverGroupsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// FailoverGroupsClientBeginDeleteOptions contains the optional parameters for the FailoverGroupsClient.BeginDelete method. +type FailoverGroupsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// FailoverGroupsClientBeginFailoverOptions contains the optional parameters for the FailoverGroupsClient.BeginFailover method. +type FailoverGroupsClientBeginFailoverOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// FailoverGroupsClientBeginForceFailoverAllowDataLossOptions contains the optional parameters for the FailoverGroupsClient.BeginForceFailoverAllowDataLoss +// method. +type FailoverGroupsClientBeginForceFailoverAllowDataLossOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// FailoverGroupsClientBeginTryPlannedBeforeForcedFailoverOptions contains the optional parameters for the FailoverGroupsClient.BeginTryPlannedBeforeForcedFailover +// method. +type FailoverGroupsClientBeginTryPlannedBeforeForcedFailoverOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// FailoverGroupsClientBeginUpdateOptions contains the optional parameters for the FailoverGroupsClient.BeginUpdate method. +type FailoverGroupsClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// FailoverGroupsClientGetOptions contains the optional parameters for the FailoverGroupsClient.Get method. +type FailoverGroupsClientGetOptions struct { + // placeholder for future optional parameters +} + +// FailoverGroupsClientListByServerOptions contains the optional parameters for the FailoverGroupsClient.NewListByServerPager +// method. +type FailoverGroupsClientListByServerOptions struct { + // placeholder for future optional parameters +} + +// FirewallRulesClientCreateOrUpdateOptions contains the optional parameters for the FirewallRulesClient.CreateOrUpdate method. +type FirewallRulesClientCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// FirewallRulesClientDeleteOptions contains the optional parameters for the FirewallRulesClient.Delete method. +type FirewallRulesClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// FirewallRulesClientGetOptions contains the optional parameters for the FirewallRulesClient.Get method. +type FirewallRulesClientGetOptions struct { + // placeholder for future optional parameters +} + +// FirewallRulesClientListByServerOptions contains the optional parameters for the FirewallRulesClient.NewListByServerPager +// method. +type FirewallRulesClientListByServerOptions struct { + // placeholder for future optional parameters +} + +// FirewallRulesClientReplaceOptions contains the optional parameters for the FirewallRulesClient.Replace method. +type FirewallRulesClientReplaceOptions struct { + // placeholder for future optional parameters +} + +// GeoBackupPoliciesClientCreateOrUpdateOptions contains the optional parameters for the GeoBackupPoliciesClient.CreateOrUpdate +// method. +type GeoBackupPoliciesClientCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// GeoBackupPoliciesClientGetOptions contains the optional parameters for the GeoBackupPoliciesClient.Get method. +type GeoBackupPoliciesClientGetOptions struct { + // placeholder for future optional parameters +} + +// GeoBackupPoliciesClientListOptions contains the optional parameters for the GeoBackupPoliciesClient.NewListPager method. +type GeoBackupPoliciesClientListOptions struct { + // placeholder for future optional parameters +} + +// IPv6FirewallRulesClientCreateOrUpdateOptions contains the optional parameters for the IPv6FirewallRulesClient.CreateOrUpdate +// method. +type IPv6FirewallRulesClientCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// IPv6FirewallRulesClientDeleteOptions contains the optional parameters for the IPv6FirewallRulesClient.Delete method. +type IPv6FirewallRulesClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// IPv6FirewallRulesClientGetOptions contains the optional parameters for the IPv6FirewallRulesClient.Get method. +type IPv6FirewallRulesClientGetOptions struct { + // placeholder for future optional parameters +} + +// IPv6FirewallRulesClientListByServerOptions contains the optional parameters for the IPv6FirewallRulesClient.NewListByServerPager +// method. +type IPv6FirewallRulesClientListByServerOptions struct { + // placeholder for future optional parameters +} + +// InstanceFailoverGroupsClientBeginCreateOrUpdateOptions contains the optional parameters for the InstanceFailoverGroupsClient.BeginCreateOrUpdate +// method. +type InstanceFailoverGroupsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// InstanceFailoverGroupsClientBeginDeleteOptions contains the optional parameters for the InstanceFailoverGroupsClient.BeginDelete +// method. +type InstanceFailoverGroupsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// InstanceFailoverGroupsClientBeginFailoverOptions contains the optional parameters for the InstanceFailoverGroupsClient.BeginFailover +// method. +type InstanceFailoverGroupsClientBeginFailoverOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// InstanceFailoverGroupsClientBeginForceFailoverAllowDataLossOptions contains the optional parameters for the InstanceFailoverGroupsClient.BeginForceFailoverAllowDataLoss +// method. +type InstanceFailoverGroupsClientBeginForceFailoverAllowDataLossOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// InstanceFailoverGroupsClientGetOptions contains the optional parameters for the InstanceFailoverGroupsClient.Get method. +type InstanceFailoverGroupsClientGetOptions struct { + // placeholder for future optional parameters +} + +// InstanceFailoverGroupsClientListByLocationOptions contains the optional parameters for the InstanceFailoverGroupsClient.NewListByLocationPager +// method. +type InstanceFailoverGroupsClientListByLocationOptions struct { + // placeholder for future optional parameters +} + +// InstancePoolsClientBeginCreateOrUpdateOptions contains the optional parameters for the InstancePoolsClient.BeginCreateOrUpdate +// method. +type InstancePoolsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// InstancePoolsClientBeginDeleteOptions contains the optional parameters for the InstancePoolsClient.BeginDelete method. +type InstancePoolsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// InstancePoolsClientBeginUpdateOptions contains the optional parameters for the InstancePoolsClient.BeginUpdate method. +type InstancePoolsClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// InstancePoolsClientGetOptions contains the optional parameters for the InstancePoolsClient.Get method. +type InstancePoolsClientGetOptions struct { + // placeholder for future optional parameters +} + +// InstancePoolsClientListByResourceGroupOptions contains the optional parameters for the InstancePoolsClient.NewListByResourceGroupPager +// method. +type InstancePoolsClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// InstancePoolsClientListOptions contains the optional parameters for the InstancePoolsClient.NewListPager method. +type InstancePoolsClientListOptions struct { + // placeholder for future optional parameters +} + +// JobAgentsClientBeginCreateOrUpdateOptions contains the optional parameters for the JobAgentsClient.BeginCreateOrUpdate +// method. +type JobAgentsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// JobAgentsClientBeginDeleteOptions contains the optional parameters for the JobAgentsClient.BeginDelete method. +type JobAgentsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// JobAgentsClientBeginUpdateOptions contains the optional parameters for the JobAgentsClient.BeginUpdate method. +type JobAgentsClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// JobAgentsClientGetOptions contains the optional parameters for the JobAgentsClient.Get method. +type JobAgentsClientGetOptions struct { + // placeholder for future optional parameters +} + +// JobAgentsClientListByServerOptions contains the optional parameters for the JobAgentsClient.NewListByServerPager method. +type JobAgentsClientListByServerOptions struct { + // placeholder for future optional parameters +} + +// JobCredentialsClientCreateOrUpdateOptions contains the optional parameters for the JobCredentialsClient.CreateOrUpdate +// method. +type JobCredentialsClientCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// JobCredentialsClientDeleteOptions contains the optional parameters for the JobCredentialsClient.Delete method. +type JobCredentialsClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// JobCredentialsClientGetOptions contains the optional parameters for the JobCredentialsClient.Get method. +type JobCredentialsClientGetOptions struct { + // placeholder for future optional parameters +} + +// JobCredentialsClientListByAgentOptions contains the optional parameters for the JobCredentialsClient.NewListByAgentPager +// method. +type JobCredentialsClientListByAgentOptions struct { + // placeholder for future optional parameters +} + +// JobExecutionsClientBeginCreateOptions contains the optional parameters for the JobExecutionsClient.BeginCreate method. +type JobExecutionsClientBeginCreateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// JobExecutionsClientBeginCreateOrUpdateOptions contains the optional parameters for the JobExecutionsClient.BeginCreateOrUpdate +// method. +type JobExecutionsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// JobExecutionsClientCancelOptions contains the optional parameters for the JobExecutionsClient.Cancel method. +type JobExecutionsClientCancelOptions struct { + // placeholder for future optional parameters +} + +// JobExecutionsClientGetOptions contains the optional parameters for the JobExecutionsClient.Get method. +type JobExecutionsClientGetOptions struct { + // placeholder for future optional parameters +} + +// JobExecutionsClientListByAgentOptions contains the optional parameters for the JobExecutionsClient.NewListByAgentPager +// method. +type JobExecutionsClientListByAgentOptions struct { + // If specified, only job executions created before the specified time are included. + CreateTimeMax *time.Time + + // If specified, only job executions created at or after the specified time are included. + CreateTimeMin *time.Time + + // If specified, only job executions completed before the specified time are included. + EndTimeMax *time.Time + + // If specified, only job executions completed at or after the specified time are included. + EndTimeMin *time.Time + + // If specified, only active or only completed job executions are included. + IsActive *bool + + // The number of elements in the collection to skip. + Skip *int64 + + // The number of elements to return from the collection. + Top *int64 +} + +// JobExecutionsClientListByJobOptions contains the optional parameters for the JobExecutionsClient.NewListByJobPager method. +type JobExecutionsClientListByJobOptions struct { + // If specified, only job executions created before the specified time are included. + CreateTimeMax *time.Time + + // If specified, only job executions created at or after the specified time are included. + CreateTimeMin *time.Time + + // If specified, only job executions completed before the specified time are included. + EndTimeMax *time.Time + + // If specified, only job executions completed at or after the specified time are included. + EndTimeMin *time.Time + + // If specified, only active or only completed job executions are included. + IsActive *bool + + // The number of elements in the collection to skip. + Skip *int64 + + // The number of elements to return from the collection. + Top *int64 +} + +// JobStepExecutionsClientGetOptions contains the optional parameters for the JobStepExecutionsClient.Get method. +type JobStepExecutionsClientGetOptions struct { + // placeholder for future optional parameters +} + +// JobStepExecutionsClientListByJobExecutionOptions contains the optional parameters for the JobStepExecutionsClient.NewListByJobExecutionPager +// method. +type JobStepExecutionsClientListByJobExecutionOptions struct { + // If specified, only job executions created before the specified time are included. + CreateTimeMax *time.Time + + // If specified, only job executions created at or after the specified time are included. + CreateTimeMin *time.Time + + // If specified, only job executions completed before the specified time are included. + EndTimeMax *time.Time + + // If specified, only job executions completed at or after the specified time are included. + EndTimeMin *time.Time + + // If specified, only active or only completed job executions are included. + IsActive *bool + + // The number of elements in the collection to skip. + Skip *int64 + + // The number of elements to return from the collection. + Top *int64 +} + +// JobStepsClientCreateOrUpdateOptions contains the optional parameters for the JobStepsClient.CreateOrUpdate method. +type JobStepsClientCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// JobStepsClientDeleteOptions contains the optional parameters for the JobStepsClient.Delete method. +type JobStepsClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// JobStepsClientGetByVersionOptions contains the optional parameters for the JobStepsClient.GetByVersion method. +type JobStepsClientGetByVersionOptions struct { + // placeholder for future optional parameters +} + +// JobStepsClientGetOptions contains the optional parameters for the JobStepsClient.Get method. +type JobStepsClientGetOptions struct { + // placeholder for future optional parameters +} + +// JobStepsClientListByJobOptions contains the optional parameters for the JobStepsClient.NewListByJobPager method. +type JobStepsClientListByJobOptions struct { + // placeholder for future optional parameters +} + +// JobStepsClientListByVersionOptions contains the optional parameters for the JobStepsClient.NewListByVersionPager method. +type JobStepsClientListByVersionOptions struct { + // placeholder for future optional parameters +} + +// JobTargetExecutionsClientGetOptions contains the optional parameters for the JobTargetExecutionsClient.Get method. +type JobTargetExecutionsClientGetOptions struct { + // placeholder for future optional parameters +} + +// JobTargetExecutionsClientListByJobExecutionOptions contains the optional parameters for the JobTargetExecutionsClient.NewListByJobExecutionPager +// method. +type JobTargetExecutionsClientListByJobExecutionOptions struct { + // If specified, only job executions created before the specified time are included. + CreateTimeMax *time.Time + + // If specified, only job executions created at or after the specified time are included. + CreateTimeMin *time.Time + + // If specified, only job executions completed before the specified time are included. + EndTimeMax *time.Time + + // If specified, only job executions completed at or after the specified time are included. + EndTimeMin *time.Time + + // If specified, only active or only completed job executions are included. + IsActive *bool + + // The number of elements in the collection to skip. + Skip *int64 + + // The number of elements to return from the collection. + Top *int64 +} + +// JobTargetExecutionsClientListByStepOptions contains the optional parameters for the JobTargetExecutionsClient.NewListByStepPager +// method. +type JobTargetExecutionsClientListByStepOptions struct { + // If specified, only job executions created before the specified time are included. + CreateTimeMax *time.Time + + // If specified, only job executions created at or after the specified time are included. + CreateTimeMin *time.Time + + // If specified, only job executions completed before the specified time are included. + EndTimeMax *time.Time + + // If specified, only job executions completed at or after the specified time are included. + EndTimeMin *time.Time + + // If specified, only active or only completed job executions are included. + IsActive *bool + + // The number of elements in the collection to skip. + Skip *int64 + + // The number of elements to return from the collection. + Top *int64 +} + +// JobTargetGroupsClientCreateOrUpdateOptions contains the optional parameters for the JobTargetGroupsClient.CreateOrUpdate +// method. +type JobTargetGroupsClientCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// JobTargetGroupsClientDeleteOptions contains the optional parameters for the JobTargetGroupsClient.Delete method. +type JobTargetGroupsClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// JobTargetGroupsClientGetOptions contains the optional parameters for the JobTargetGroupsClient.Get method. +type JobTargetGroupsClientGetOptions struct { + // placeholder for future optional parameters +} + +// JobTargetGroupsClientListByAgentOptions contains the optional parameters for the JobTargetGroupsClient.NewListByAgentPager +// method. +type JobTargetGroupsClientListByAgentOptions struct { + // placeholder for future optional parameters +} + +// JobVersionsClientGetOptions contains the optional parameters for the JobVersionsClient.Get method. +type JobVersionsClientGetOptions struct { + // placeholder for future optional parameters +} + +// JobVersionsClientListByJobOptions contains the optional parameters for the JobVersionsClient.NewListByJobPager method. +type JobVersionsClientListByJobOptions struct { + // placeholder for future optional parameters +} + +// JobsClientCreateOrUpdateOptions contains the optional parameters for the JobsClient.CreateOrUpdate method. +type JobsClientCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// JobsClientDeleteOptions contains the optional parameters for the JobsClient.Delete method. +type JobsClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// JobsClientGetOptions contains the optional parameters for the JobsClient.Get method. +type JobsClientGetOptions struct { + // placeholder for future optional parameters +} + +// JobsClientListByAgentOptions contains the optional parameters for the JobsClient.NewListByAgentPager method. +type JobsClientListByAgentOptions struct { + // placeholder for future optional parameters +} + +// LedgerDigestUploadsClientBeginCreateOrUpdateOptions contains the optional parameters for the LedgerDigestUploadsClient.BeginCreateOrUpdate +// method. +type LedgerDigestUploadsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// LedgerDigestUploadsClientBeginDisableOptions contains the optional parameters for the LedgerDigestUploadsClient.BeginDisable +// method. +type LedgerDigestUploadsClientBeginDisableOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// LedgerDigestUploadsClientGetOptions contains the optional parameters for the LedgerDigestUploadsClient.Get method. +type LedgerDigestUploadsClientGetOptions struct { + // placeholder for future optional parameters +} + +// LedgerDigestUploadsClientListByDatabaseOptions contains the optional parameters for the LedgerDigestUploadsClient.NewListByDatabasePager +// method. +type LedgerDigestUploadsClientListByDatabaseOptions struct { + // placeholder for future optional parameters +} + +// LongTermRetentionBackupsClientBeginCopyByResourceGroupOptions contains the optional parameters for the LongTermRetentionBackupsClient.BeginCopyByResourceGroup +// method. +type LongTermRetentionBackupsClientBeginCopyByResourceGroupOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// LongTermRetentionBackupsClientBeginCopyOptions contains the optional parameters for the LongTermRetentionBackupsClient.BeginCopy +// method. +type LongTermRetentionBackupsClientBeginCopyOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// LongTermRetentionBackupsClientBeginDeleteByResourceGroupOptions contains the optional parameters for the LongTermRetentionBackupsClient.BeginDeleteByResourceGroup +// method. +type LongTermRetentionBackupsClientBeginDeleteByResourceGroupOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// LongTermRetentionBackupsClientBeginDeleteOptions contains the optional parameters for the LongTermRetentionBackupsClient.BeginDelete +// method. +type LongTermRetentionBackupsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// LongTermRetentionBackupsClientBeginUpdateByResourceGroupOptions contains the optional parameters for the LongTermRetentionBackupsClient.BeginUpdateByResourceGroup +// method. +type LongTermRetentionBackupsClientBeginUpdateByResourceGroupOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// LongTermRetentionBackupsClientBeginUpdateOptions contains the optional parameters for the LongTermRetentionBackupsClient.BeginUpdate +// method. +type LongTermRetentionBackupsClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// LongTermRetentionBackupsClientGetByResourceGroupOptions contains the optional parameters for the LongTermRetentionBackupsClient.GetByResourceGroup +// method. +type LongTermRetentionBackupsClientGetByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// LongTermRetentionBackupsClientGetOptions contains the optional parameters for the LongTermRetentionBackupsClient.Get method. +type LongTermRetentionBackupsClientGetOptions struct { + // placeholder for future optional parameters +} + +// LongTermRetentionBackupsClientListByDatabaseOptions contains the optional parameters for the LongTermRetentionBackupsClient.NewListByDatabasePager +// method. +type LongTermRetentionBackupsClientListByDatabaseOptions struct { + // Whether to query against just live databases, just deleted databases, or all databases. + DatabaseState *DatabaseState + + // Whether or not to only get the latest backup for each database. + OnlyLatestPerDatabase *bool +} + +// LongTermRetentionBackupsClientListByLocationOptions contains the optional parameters for the LongTermRetentionBackupsClient.NewListByLocationPager +// method. +type LongTermRetentionBackupsClientListByLocationOptions struct { + // Whether to query against just live databases, just deleted databases, or all databases. + DatabaseState *DatabaseState + + // Whether or not to only get the latest backup for each database. + OnlyLatestPerDatabase *bool +} + +// LongTermRetentionBackupsClientListByResourceGroupDatabaseOptions contains the optional parameters for the LongTermRetentionBackupsClient.NewListByResourceGroupDatabasePager +// method. +type LongTermRetentionBackupsClientListByResourceGroupDatabaseOptions struct { + // Whether to query against just live databases, just deleted databases, or all databases. + DatabaseState *DatabaseState + + // Whether or not to only get the latest backup for each database. + OnlyLatestPerDatabase *bool +} + +// LongTermRetentionBackupsClientListByResourceGroupLocationOptions contains the optional parameters for the LongTermRetentionBackupsClient.NewListByResourceGroupLocationPager +// method. +type LongTermRetentionBackupsClientListByResourceGroupLocationOptions struct { + // Whether to query against just live databases, just deleted databases, or all databases. + DatabaseState *DatabaseState + + // Whether or not to only get the latest backup for each database. + OnlyLatestPerDatabase *bool +} + +// LongTermRetentionBackupsClientListByResourceGroupServerOptions contains the optional parameters for the LongTermRetentionBackupsClient.NewListByResourceGroupServerPager +// method. +type LongTermRetentionBackupsClientListByResourceGroupServerOptions struct { + // Whether to query against just live databases, just deleted databases, or all databases. + DatabaseState *DatabaseState + + // Whether or not to only get the latest backup for each database. + OnlyLatestPerDatabase *bool +} + +// LongTermRetentionBackupsClientListByServerOptions contains the optional parameters for the LongTermRetentionBackupsClient.NewListByServerPager +// method. +type LongTermRetentionBackupsClientListByServerOptions struct { + // Whether to query against just live databases, just deleted databases, or all databases. + DatabaseState *DatabaseState + + // Whether or not to only get the latest backup for each database. + OnlyLatestPerDatabase *bool +} + +// LongTermRetentionManagedInstanceBackupsClientBeginDeleteByResourceGroupOptions contains the optional parameters for the +// LongTermRetentionManagedInstanceBackupsClient.BeginDeleteByResourceGroup method. +type LongTermRetentionManagedInstanceBackupsClientBeginDeleteByResourceGroupOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// LongTermRetentionManagedInstanceBackupsClientBeginDeleteOptions contains the optional parameters for the LongTermRetentionManagedInstanceBackupsClient.BeginDelete +// method. +type LongTermRetentionManagedInstanceBackupsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// LongTermRetentionManagedInstanceBackupsClientGetByResourceGroupOptions contains the optional parameters for the LongTermRetentionManagedInstanceBackupsClient.GetByResourceGroup +// method. +type LongTermRetentionManagedInstanceBackupsClientGetByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// LongTermRetentionManagedInstanceBackupsClientGetOptions contains the optional parameters for the LongTermRetentionManagedInstanceBackupsClient.Get +// method. +type LongTermRetentionManagedInstanceBackupsClientGetOptions struct { + // placeholder for future optional parameters +} + +// LongTermRetentionManagedInstanceBackupsClientListByDatabaseOptions contains the optional parameters for the LongTermRetentionManagedInstanceBackupsClient.NewListByDatabasePager +// method. +type LongTermRetentionManagedInstanceBackupsClientListByDatabaseOptions struct { + // Whether to query against just live databases, just deleted databases, or all databases. + DatabaseState *DatabaseState + + // Whether or not to only get the latest backup for each database. + OnlyLatestPerDatabase *bool +} + +// LongTermRetentionManagedInstanceBackupsClientListByInstanceOptions contains the optional parameters for the LongTermRetentionManagedInstanceBackupsClient.NewListByInstancePager +// method. +type LongTermRetentionManagedInstanceBackupsClientListByInstanceOptions struct { + // Whether to query against just live databases, just deleted databases, or all databases. + DatabaseState *DatabaseState + + // Whether or not to only get the latest backup for each database. + OnlyLatestPerDatabase *bool +} + +// LongTermRetentionManagedInstanceBackupsClientListByLocationOptions contains the optional parameters for the LongTermRetentionManagedInstanceBackupsClient.NewListByLocationPager +// method. +type LongTermRetentionManagedInstanceBackupsClientListByLocationOptions struct { + // Whether to query against just live databases, just deleted databases, or all databases. + DatabaseState *DatabaseState + + // Whether or not to only get the latest backup for each database. + OnlyLatestPerDatabase *bool +} + +// LongTermRetentionManagedInstanceBackupsClientListByResourceGroupDatabaseOptions contains the optional parameters for the +// LongTermRetentionManagedInstanceBackupsClient.NewListByResourceGroupDatabasePager method. +type LongTermRetentionManagedInstanceBackupsClientListByResourceGroupDatabaseOptions struct { + // Whether to query against just live databases, just deleted databases, or all databases. + DatabaseState *DatabaseState + + // Whether or not to only get the latest backup for each database. + OnlyLatestPerDatabase *bool +} + +// LongTermRetentionManagedInstanceBackupsClientListByResourceGroupInstanceOptions contains the optional parameters for the +// LongTermRetentionManagedInstanceBackupsClient.NewListByResourceGroupInstancePager method. +type LongTermRetentionManagedInstanceBackupsClientListByResourceGroupInstanceOptions struct { + // Whether to query against just live databases, just deleted databases, or all databases. + DatabaseState *DatabaseState + + // Whether or not to only get the latest backup for each database. + OnlyLatestPerDatabase *bool +} + +// LongTermRetentionManagedInstanceBackupsClientListByResourceGroupLocationOptions contains the optional parameters for the +// LongTermRetentionManagedInstanceBackupsClient.NewListByResourceGroupLocationPager method. +type LongTermRetentionManagedInstanceBackupsClientListByResourceGroupLocationOptions struct { + // Whether to query against just live databases, just deleted databases, or all databases. + DatabaseState *DatabaseState + + // Whether or not to only get the latest backup for each database. + OnlyLatestPerDatabase *bool +} + +// LongTermRetentionPoliciesClientBeginCreateOrUpdateOptions contains the optional parameters for the LongTermRetentionPoliciesClient.BeginCreateOrUpdate +// method. +type LongTermRetentionPoliciesClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// LongTermRetentionPoliciesClientGetOptions contains the optional parameters for the LongTermRetentionPoliciesClient.Get +// method. +type LongTermRetentionPoliciesClientGetOptions struct { + // placeholder for future optional parameters +} + +// LongTermRetentionPoliciesClientListByDatabaseOptions contains the optional parameters for the LongTermRetentionPoliciesClient.NewListByDatabasePager +// method. +type LongTermRetentionPoliciesClientListByDatabaseOptions struct { + // placeholder for future optional parameters +} + +// MaintenanceWindowOptionsClientGetOptions contains the optional parameters for the MaintenanceWindowOptionsClient.Get method. +type MaintenanceWindowOptionsClientGetOptions struct { + // placeholder for future optional parameters +} + +// MaintenanceWindowsClientCreateOrUpdateOptions contains the optional parameters for the MaintenanceWindowsClient.CreateOrUpdate +// method. +type MaintenanceWindowsClientCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// MaintenanceWindowsClientGetOptions contains the optional parameters for the MaintenanceWindowsClient.Get method. +type MaintenanceWindowsClientGetOptions struct { + // placeholder for future optional parameters +} + +// ManagedBackupShortTermRetentionPoliciesClientBeginCreateOrUpdateOptions contains the optional parameters for the ManagedBackupShortTermRetentionPoliciesClient.BeginCreateOrUpdate +// method. +type ManagedBackupShortTermRetentionPoliciesClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ManagedBackupShortTermRetentionPoliciesClientBeginUpdateOptions contains the optional parameters for the ManagedBackupShortTermRetentionPoliciesClient.BeginUpdate +// method. +type ManagedBackupShortTermRetentionPoliciesClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ManagedBackupShortTermRetentionPoliciesClientGetOptions contains the optional parameters for the ManagedBackupShortTermRetentionPoliciesClient.Get +// method. +type ManagedBackupShortTermRetentionPoliciesClientGetOptions struct { + // placeholder for future optional parameters +} + +// ManagedBackupShortTermRetentionPoliciesClientListByDatabaseOptions contains the optional parameters for the ManagedBackupShortTermRetentionPoliciesClient.NewListByDatabasePager +// method. +type ManagedBackupShortTermRetentionPoliciesClientListByDatabaseOptions struct { + // placeholder for future optional parameters +} + +// ManagedDatabaseAdvancedThreatProtectionSettingsClientCreateOrUpdateOptions contains the optional parameters for the ManagedDatabaseAdvancedThreatProtectionSettingsClient.CreateOrUpdate +// method. +type ManagedDatabaseAdvancedThreatProtectionSettingsClientCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// ManagedDatabaseAdvancedThreatProtectionSettingsClientGetOptions contains the optional parameters for the ManagedDatabaseAdvancedThreatProtectionSettingsClient.Get +// method. +type ManagedDatabaseAdvancedThreatProtectionSettingsClientGetOptions struct { + // placeholder for future optional parameters +} + +// ManagedDatabaseAdvancedThreatProtectionSettingsClientListByDatabaseOptions contains the optional parameters for the ManagedDatabaseAdvancedThreatProtectionSettingsClient.NewListByDatabasePager +// method. +type ManagedDatabaseAdvancedThreatProtectionSettingsClientListByDatabaseOptions struct { + // placeholder for future optional parameters +} + +// ManagedDatabaseColumnsClientGetOptions contains the optional parameters for the ManagedDatabaseColumnsClient.Get method. +type ManagedDatabaseColumnsClientGetOptions struct { + // placeholder for future optional parameters +} + +// ManagedDatabaseColumnsClientListByDatabaseOptions contains the optional parameters for the ManagedDatabaseColumnsClient.NewListByDatabasePager +// method. +type ManagedDatabaseColumnsClientListByDatabaseOptions struct { + Column []string + OrderBy []string + Schema []string + + // An opaque token that identifies a starting point in the collection. + Skiptoken *string + Table []string +} + +// ManagedDatabaseColumnsClientListByTableOptions contains the optional parameters for the ManagedDatabaseColumnsClient.NewListByTablePager +// method. +type ManagedDatabaseColumnsClientListByTableOptions struct { + // An OData filter expression that filters elements in the collection. + Filter *string +} + +// ManagedDatabaseMoveOperationsClientGetOptions contains the optional parameters for the ManagedDatabaseMoveOperationsClient.Get +// method. +type ManagedDatabaseMoveOperationsClientGetOptions struct { + // placeholder for future optional parameters +} + +// ManagedDatabaseMoveOperationsClientListByLocationOptions contains the optional parameters for the ManagedDatabaseMoveOperationsClient.NewListByLocationPager +// method. +type ManagedDatabaseMoveOperationsClientListByLocationOptions struct { + // An OData filter expression that filters elements in the collection. + Filter *string + + // Whether or not to only get the latest operation for each database. Has higher priority than $filter. + OnlyLatestPerDatabase *bool +} + +// ManagedDatabaseQueriesClientGetOptions contains the optional parameters for the ManagedDatabaseQueriesClient.Get method. +type ManagedDatabaseQueriesClientGetOptions struct { + // placeholder for future optional parameters +} + +// ManagedDatabaseQueriesClientListByQueryOptions contains the optional parameters for the ManagedDatabaseQueriesClient.NewListByQueryPager +// method. +type ManagedDatabaseQueriesClientListByQueryOptions struct { + // End time for observed period. + EndTime *string + + // The time step to be used to summarize the metric values. + Interval *QueryTimeGrainType + + // Start time for observed period. + StartTime *string +} + +// ManagedDatabaseRecommendedSensitivityLabelsClientUpdateOptions contains the optional parameters for the ManagedDatabaseRecommendedSensitivityLabelsClient.Update +// method. +type ManagedDatabaseRecommendedSensitivityLabelsClientUpdateOptions struct { + // placeholder for future optional parameters +} + +// ManagedDatabaseRestoreDetailsClientGetOptions contains the optional parameters for the ManagedDatabaseRestoreDetailsClient.Get +// method. +type ManagedDatabaseRestoreDetailsClientGetOptions struct { + // placeholder for future optional parameters +} + +// ManagedDatabaseSchemasClientGetOptions contains the optional parameters for the ManagedDatabaseSchemasClient.Get method. +type ManagedDatabaseSchemasClientGetOptions struct { + // placeholder for future optional parameters +} + +// ManagedDatabaseSchemasClientListByDatabaseOptions contains the optional parameters for the ManagedDatabaseSchemasClient.NewListByDatabasePager +// method. +type ManagedDatabaseSchemasClientListByDatabaseOptions struct { + // An OData filter expression that filters elements in the collection. + Filter *string +} + +// ManagedDatabaseSecurityAlertPoliciesClientCreateOrUpdateOptions contains the optional parameters for the ManagedDatabaseSecurityAlertPoliciesClient.CreateOrUpdate +// method. +type ManagedDatabaseSecurityAlertPoliciesClientCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// ManagedDatabaseSecurityAlertPoliciesClientGetOptions contains the optional parameters for the ManagedDatabaseSecurityAlertPoliciesClient.Get +// method. +type ManagedDatabaseSecurityAlertPoliciesClientGetOptions struct { + // placeholder for future optional parameters +} + +// ManagedDatabaseSecurityAlertPoliciesClientListByDatabaseOptions contains the optional parameters for the ManagedDatabaseSecurityAlertPoliciesClient.NewListByDatabasePager +// method. +type ManagedDatabaseSecurityAlertPoliciesClientListByDatabaseOptions struct { + // placeholder for future optional parameters +} + +// ManagedDatabaseSecurityEventsClientListByDatabaseOptions contains the optional parameters for the ManagedDatabaseSecurityEventsClient.NewListByDatabasePager +// method. +type ManagedDatabaseSecurityEventsClientListByDatabaseOptions struct { + // An OData filter expression that filters elements in the collection. + Filter *string + + // The number of elements in the collection to skip. + Skip *int64 + + // An opaque token that identifies a starting point in the collection. + Skiptoken *string + + // The number of elements to return from the collection. + Top *int64 +} + +// ManagedDatabaseSensitivityLabelsClientCreateOrUpdateOptions contains the optional parameters for the ManagedDatabaseSensitivityLabelsClient.CreateOrUpdate +// method. +type ManagedDatabaseSensitivityLabelsClientCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// ManagedDatabaseSensitivityLabelsClientDeleteOptions contains the optional parameters for the ManagedDatabaseSensitivityLabelsClient.Delete +// method. +type ManagedDatabaseSensitivityLabelsClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// ManagedDatabaseSensitivityLabelsClientDisableRecommendationOptions contains the optional parameters for the ManagedDatabaseSensitivityLabelsClient.DisableRecommendation +// method. +type ManagedDatabaseSensitivityLabelsClientDisableRecommendationOptions struct { + // placeholder for future optional parameters +} + +// ManagedDatabaseSensitivityLabelsClientEnableRecommendationOptions contains the optional parameters for the ManagedDatabaseSensitivityLabelsClient.EnableRecommendation +// method. +type ManagedDatabaseSensitivityLabelsClientEnableRecommendationOptions struct { + // placeholder for future optional parameters +} + +// ManagedDatabaseSensitivityLabelsClientGetOptions contains the optional parameters for the ManagedDatabaseSensitivityLabelsClient.Get +// method. +type ManagedDatabaseSensitivityLabelsClientGetOptions struct { + // placeholder for future optional parameters +} + +// ManagedDatabaseSensitivityLabelsClientListByDatabaseOptions contains the optional parameters for the ManagedDatabaseSensitivityLabelsClient.NewListByDatabasePager +// method. +type ManagedDatabaseSensitivityLabelsClientListByDatabaseOptions struct { + // An OData filter expression that filters elements in the collection. + Filter *string +} + +// ManagedDatabaseSensitivityLabelsClientListCurrentByDatabaseOptions contains the optional parameters for the ManagedDatabaseSensitivityLabelsClient.NewListCurrentByDatabasePager +// method. +type ManagedDatabaseSensitivityLabelsClientListCurrentByDatabaseOptions struct { + Count *bool + + // An OData filter expression that filters elements in the collection. + Filter *string + SkipToken *string +} + +// ManagedDatabaseSensitivityLabelsClientListRecommendedByDatabaseOptions contains the optional parameters for the ManagedDatabaseSensitivityLabelsClient.NewListRecommendedByDatabasePager +// method. +type ManagedDatabaseSensitivityLabelsClientListRecommendedByDatabaseOptions struct { + // An OData filter expression that filters elements in the collection. + Filter *string + + // Specifies whether to include disabled recommendations or not. + IncludeDisabledRecommendations *bool + SkipToken *string +} + +// ManagedDatabaseSensitivityLabelsClientUpdateOptions contains the optional parameters for the ManagedDatabaseSensitivityLabelsClient.Update +// method. +type ManagedDatabaseSensitivityLabelsClientUpdateOptions struct { + // placeholder for future optional parameters +} + +// ManagedDatabaseTablesClientGetOptions contains the optional parameters for the ManagedDatabaseTablesClient.Get method. +type ManagedDatabaseTablesClientGetOptions struct { + // placeholder for future optional parameters +} + +// ManagedDatabaseTablesClientListBySchemaOptions contains the optional parameters for the ManagedDatabaseTablesClient.NewListBySchemaPager +// method. +type ManagedDatabaseTablesClientListBySchemaOptions struct { + // An OData filter expression that filters elements in the collection. + Filter *string +} + +// ManagedDatabaseTransparentDataEncryptionClientCreateOrUpdateOptions contains the optional parameters for the ManagedDatabaseTransparentDataEncryptionClient.CreateOrUpdate +// method. +type ManagedDatabaseTransparentDataEncryptionClientCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// ManagedDatabaseTransparentDataEncryptionClientGetOptions contains the optional parameters for the ManagedDatabaseTransparentDataEncryptionClient.Get +// method. +type ManagedDatabaseTransparentDataEncryptionClientGetOptions struct { + // placeholder for future optional parameters +} + +// ManagedDatabaseTransparentDataEncryptionClientListByDatabaseOptions contains the optional parameters for the ManagedDatabaseTransparentDataEncryptionClient.NewListByDatabasePager +// method. +type ManagedDatabaseTransparentDataEncryptionClientListByDatabaseOptions struct { + // placeholder for future optional parameters +} + +// ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClientCreateOrUpdateOptions contains the optional parameters for the +// ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient.CreateOrUpdate method. +type ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClientCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClientDeleteOptions contains the optional parameters for the ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient.Delete +// method. +type ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClientGetOptions contains the optional parameters for the ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient.Get +// method. +type ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClientGetOptions struct { + // placeholder for future optional parameters +} + +// ManagedDatabaseVulnerabilityAssessmentScansClientBeginInitiateScanOptions contains the optional parameters for the ManagedDatabaseVulnerabilityAssessmentScansClient.BeginInitiateScan +// method. +type ManagedDatabaseVulnerabilityAssessmentScansClientBeginInitiateScanOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ManagedDatabaseVulnerabilityAssessmentScansClientExportOptions contains the optional parameters for the ManagedDatabaseVulnerabilityAssessmentScansClient.Export +// method. +type ManagedDatabaseVulnerabilityAssessmentScansClientExportOptions struct { + // placeholder for future optional parameters +} + +// ManagedDatabaseVulnerabilityAssessmentScansClientGetOptions contains the optional parameters for the ManagedDatabaseVulnerabilityAssessmentScansClient.Get +// method. +type ManagedDatabaseVulnerabilityAssessmentScansClientGetOptions struct { + // placeholder for future optional parameters +} + +// ManagedDatabaseVulnerabilityAssessmentScansClientListByDatabaseOptions contains the optional parameters for the ManagedDatabaseVulnerabilityAssessmentScansClient.NewListByDatabasePager +// method. +type ManagedDatabaseVulnerabilityAssessmentScansClientListByDatabaseOptions struct { + // placeholder for future optional parameters +} + +// ManagedDatabaseVulnerabilityAssessmentsClientCreateOrUpdateOptions contains the optional parameters for the ManagedDatabaseVulnerabilityAssessmentsClient.CreateOrUpdate +// method. +type ManagedDatabaseVulnerabilityAssessmentsClientCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// ManagedDatabaseVulnerabilityAssessmentsClientDeleteOptions contains the optional parameters for the ManagedDatabaseVulnerabilityAssessmentsClient.Delete +// method. +type ManagedDatabaseVulnerabilityAssessmentsClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// ManagedDatabaseVulnerabilityAssessmentsClientGetOptions contains the optional parameters for the ManagedDatabaseVulnerabilityAssessmentsClient.Get +// method. +type ManagedDatabaseVulnerabilityAssessmentsClientGetOptions struct { + // placeholder for future optional parameters +} + +// ManagedDatabaseVulnerabilityAssessmentsClientListByDatabaseOptions contains the optional parameters for the ManagedDatabaseVulnerabilityAssessmentsClient.NewListByDatabasePager +// method. +type ManagedDatabaseVulnerabilityAssessmentsClientListByDatabaseOptions struct { + // placeholder for future optional parameters +} + +// ManagedDatabasesClientBeginCancelMoveOptions contains the optional parameters for the ManagedDatabasesClient.BeginCancelMove +// method. +type ManagedDatabasesClientBeginCancelMoveOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ManagedDatabasesClientBeginCompleteMoveOptions contains the optional parameters for the ManagedDatabasesClient.BeginCompleteMove +// method. +type ManagedDatabasesClientBeginCompleteMoveOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ManagedDatabasesClientBeginCompleteRestoreOptions contains the optional parameters for the ManagedDatabasesClient.BeginCompleteRestore +// method. +type ManagedDatabasesClientBeginCompleteRestoreOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ManagedDatabasesClientBeginCreateOrUpdateOptions contains the optional parameters for the ManagedDatabasesClient.BeginCreateOrUpdate +// method. +type ManagedDatabasesClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ManagedDatabasesClientBeginDeleteOptions contains the optional parameters for the ManagedDatabasesClient.BeginDelete method. +type ManagedDatabasesClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ManagedDatabasesClientBeginStartMoveOptions contains the optional parameters for the ManagedDatabasesClient.BeginStartMove +// method. +type ManagedDatabasesClientBeginStartMoveOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ManagedDatabasesClientBeginUpdateOptions contains the optional parameters for the ManagedDatabasesClient.BeginUpdate method. +type ManagedDatabasesClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ManagedDatabasesClientGetOptions contains the optional parameters for the ManagedDatabasesClient.Get method. +type ManagedDatabasesClientGetOptions struct { + // placeholder for future optional parameters +} + +// ManagedDatabasesClientListByInstanceOptions contains the optional parameters for the ManagedDatabasesClient.NewListByInstancePager +// method. +type ManagedDatabasesClientListByInstanceOptions struct { + // placeholder for future optional parameters +} + +// ManagedDatabasesClientListInaccessibleByInstanceOptions contains the optional parameters for the ManagedDatabasesClient.NewListInaccessibleByInstancePager +// method. +type ManagedDatabasesClientListInaccessibleByInstanceOptions struct { + // placeholder for future optional parameters +} + +// ManagedInstanceAdministratorsClientBeginCreateOrUpdateOptions contains the optional parameters for the ManagedInstanceAdministratorsClient.BeginCreateOrUpdate +// method. +type ManagedInstanceAdministratorsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ManagedInstanceAdministratorsClientBeginDeleteOptions contains the optional parameters for the ManagedInstanceAdministratorsClient.BeginDelete +// method. +type ManagedInstanceAdministratorsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ManagedInstanceAdministratorsClientGetOptions contains the optional parameters for the ManagedInstanceAdministratorsClient.Get +// method. +type ManagedInstanceAdministratorsClientGetOptions struct { + // placeholder for future optional parameters +} + +// ManagedInstanceAdministratorsClientListByInstanceOptions contains the optional parameters for the ManagedInstanceAdministratorsClient.NewListByInstancePager +// method. +type ManagedInstanceAdministratorsClientListByInstanceOptions struct { + // placeholder for future optional parameters +} + +// ManagedInstanceAdvancedThreatProtectionSettingsClientBeginCreateOrUpdateOptions contains the optional parameters for the +// ManagedInstanceAdvancedThreatProtectionSettingsClient.BeginCreateOrUpdate method. +type ManagedInstanceAdvancedThreatProtectionSettingsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ManagedInstanceAdvancedThreatProtectionSettingsClientGetOptions contains the optional parameters for the ManagedInstanceAdvancedThreatProtectionSettingsClient.Get +// method. +type ManagedInstanceAdvancedThreatProtectionSettingsClientGetOptions struct { + // placeholder for future optional parameters +} + +// ManagedInstanceAdvancedThreatProtectionSettingsClientListByInstanceOptions contains the optional parameters for the ManagedInstanceAdvancedThreatProtectionSettingsClient.NewListByInstancePager +// method. +type ManagedInstanceAdvancedThreatProtectionSettingsClientListByInstanceOptions struct { + // placeholder for future optional parameters +} + +// ManagedInstanceAzureADOnlyAuthenticationsClientBeginCreateOrUpdateOptions contains the optional parameters for the ManagedInstanceAzureADOnlyAuthenticationsClient.BeginCreateOrUpdate +// method. +type ManagedInstanceAzureADOnlyAuthenticationsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ManagedInstanceAzureADOnlyAuthenticationsClientBeginDeleteOptions contains the optional parameters for the ManagedInstanceAzureADOnlyAuthenticationsClient.BeginDelete +// method. +type ManagedInstanceAzureADOnlyAuthenticationsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ManagedInstanceAzureADOnlyAuthenticationsClientGetOptions contains the optional parameters for the ManagedInstanceAzureADOnlyAuthenticationsClient.Get +// method. +type ManagedInstanceAzureADOnlyAuthenticationsClientGetOptions struct { + // placeholder for future optional parameters +} + +// ManagedInstanceAzureADOnlyAuthenticationsClientListByInstanceOptions contains the optional parameters for the ManagedInstanceAzureADOnlyAuthenticationsClient.NewListByInstancePager +// method. +type ManagedInstanceAzureADOnlyAuthenticationsClientListByInstanceOptions struct { + // placeholder for future optional parameters +} + +// ManagedInstanceDtcsClientBeginCreateOrUpdateOptions contains the optional parameters for the ManagedInstanceDtcsClient.BeginCreateOrUpdate +// method. +type ManagedInstanceDtcsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ManagedInstanceDtcsClientGetOptions contains the optional parameters for the ManagedInstanceDtcsClient.Get method. +type ManagedInstanceDtcsClientGetOptions struct { + // placeholder for future optional parameters +} + +// ManagedInstanceDtcsClientListByManagedInstanceOptions contains the optional parameters for the ManagedInstanceDtcsClient.NewListByManagedInstancePager +// method. +type ManagedInstanceDtcsClientListByManagedInstanceOptions struct { + // placeholder for future optional parameters +} + +// ManagedInstanceEncryptionProtectorsClientBeginCreateOrUpdateOptions contains the optional parameters for the ManagedInstanceEncryptionProtectorsClient.BeginCreateOrUpdate +// method. +type ManagedInstanceEncryptionProtectorsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ManagedInstanceEncryptionProtectorsClientBeginRevalidateOptions contains the optional parameters for the ManagedInstanceEncryptionProtectorsClient.BeginRevalidate +// method. +type ManagedInstanceEncryptionProtectorsClientBeginRevalidateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ManagedInstanceEncryptionProtectorsClientGetOptions contains the optional parameters for the ManagedInstanceEncryptionProtectorsClient.Get +// method. +type ManagedInstanceEncryptionProtectorsClientGetOptions struct { + // placeholder for future optional parameters +} + +// ManagedInstanceEncryptionProtectorsClientListByInstanceOptions contains the optional parameters for the ManagedInstanceEncryptionProtectorsClient.NewListByInstancePager +// method. +type ManagedInstanceEncryptionProtectorsClientListByInstanceOptions struct { + // placeholder for future optional parameters +} + +// ManagedInstanceKeysClientBeginCreateOrUpdateOptions contains the optional parameters for the ManagedInstanceKeysClient.BeginCreateOrUpdate +// method. +type ManagedInstanceKeysClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ManagedInstanceKeysClientBeginDeleteOptions contains the optional parameters for the ManagedInstanceKeysClient.BeginDelete +// method. +type ManagedInstanceKeysClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ManagedInstanceKeysClientGetOptions contains the optional parameters for the ManagedInstanceKeysClient.Get method. +type ManagedInstanceKeysClientGetOptions struct { + // placeholder for future optional parameters +} + +// ManagedInstanceKeysClientListByInstanceOptions contains the optional parameters for the ManagedInstanceKeysClient.NewListByInstancePager +// method. +type ManagedInstanceKeysClientListByInstanceOptions struct { + // An OData filter expression that filters elements in the collection. + Filter *string +} + +// ManagedInstanceLongTermRetentionPoliciesClientBeginCreateOrUpdateOptions contains the optional parameters for the ManagedInstanceLongTermRetentionPoliciesClient.BeginCreateOrUpdate +// method. +type ManagedInstanceLongTermRetentionPoliciesClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ManagedInstanceLongTermRetentionPoliciesClientBeginDeleteOptions contains the optional parameters for the ManagedInstanceLongTermRetentionPoliciesClient.BeginDelete +// method. +type ManagedInstanceLongTermRetentionPoliciesClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ManagedInstanceLongTermRetentionPoliciesClientGetOptions contains the optional parameters for the ManagedInstanceLongTermRetentionPoliciesClient.Get +// method. +type ManagedInstanceLongTermRetentionPoliciesClientGetOptions struct { + // placeholder for future optional parameters +} + +// ManagedInstanceLongTermRetentionPoliciesClientListByDatabaseOptions contains the optional parameters for the ManagedInstanceLongTermRetentionPoliciesClient.NewListByDatabasePager +// method. +type ManagedInstanceLongTermRetentionPoliciesClientListByDatabaseOptions struct { + // placeholder for future optional parameters +} + +// ManagedInstanceOperationsClientCancelOptions contains the optional parameters for the ManagedInstanceOperationsClient.Cancel +// method. +type ManagedInstanceOperationsClientCancelOptions struct { + // placeholder for future optional parameters +} + +// ManagedInstanceOperationsClientGetOptions contains the optional parameters for the ManagedInstanceOperationsClient.Get +// method. +type ManagedInstanceOperationsClientGetOptions struct { + // placeholder for future optional parameters +} + +// ManagedInstanceOperationsClientListByManagedInstanceOptions contains the optional parameters for the ManagedInstanceOperationsClient.NewListByManagedInstancePager +// method. +type ManagedInstanceOperationsClientListByManagedInstanceOptions struct { + // placeholder for future optional parameters +} + +// ManagedInstancePrivateEndpointConnectionsClientBeginCreateOrUpdateOptions contains the optional parameters for the ManagedInstancePrivateEndpointConnectionsClient.BeginCreateOrUpdate +// method. +type ManagedInstancePrivateEndpointConnectionsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ManagedInstancePrivateEndpointConnectionsClientBeginDeleteOptions contains the optional parameters for the ManagedInstancePrivateEndpointConnectionsClient.BeginDelete +// method. +type ManagedInstancePrivateEndpointConnectionsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ManagedInstancePrivateEndpointConnectionsClientGetOptions contains the optional parameters for the ManagedInstancePrivateEndpointConnectionsClient.Get +// method. +type ManagedInstancePrivateEndpointConnectionsClientGetOptions struct { + // placeholder for future optional parameters +} + +// ManagedInstancePrivateEndpointConnectionsClientListByManagedInstanceOptions contains the optional parameters for the ManagedInstancePrivateEndpointConnectionsClient.NewListByManagedInstancePager +// method. +type ManagedInstancePrivateEndpointConnectionsClientListByManagedInstanceOptions struct { + // placeholder for future optional parameters +} + +// ManagedInstancePrivateLinkResourcesClientGetOptions contains the optional parameters for the ManagedInstancePrivateLinkResourcesClient.Get +// method. +type ManagedInstancePrivateLinkResourcesClientGetOptions struct { + // placeholder for future optional parameters +} + +// ManagedInstancePrivateLinkResourcesClientListByManagedInstanceOptions contains the optional parameters for the ManagedInstancePrivateLinkResourcesClient.NewListByManagedInstancePager +// method. +type ManagedInstancePrivateLinkResourcesClientListByManagedInstanceOptions struct { + // placeholder for future optional parameters +} + +// ManagedInstanceTdeCertificatesClientBeginCreateOptions contains the optional parameters for the ManagedInstanceTdeCertificatesClient.BeginCreate +// method. +type ManagedInstanceTdeCertificatesClientBeginCreateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ManagedInstanceVulnerabilityAssessmentsClientCreateOrUpdateOptions contains the optional parameters for the ManagedInstanceVulnerabilityAssessmentsClient.CreateOrUpdate +// method. +type ManagedInstanceVulnerabilityAssessmentsClientCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// ManagedInstanceVulnerabilityAssessmentsClientDeleteOptions contains the optional parameters for the ManagedInstanceVulnerabilityAssessmentsClient.Delete +// method. +type ManagedInstanceVulnerabilityAssessmentsClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// ManagedInstanceVulnerabilityAssessmentsClientGetOptions contains the optional parameters for the ManagedInstanceVulnerabilityAssessmentsClient.Get +// method. +type ManagedInstanceVulnerabilityAssessmentsClientGetOptions struct { + // placeholder for future optional parameters +} + +// ManagedInstanceVulnerabilityAssessmentsClientListByInstanceOptions contains the optional parameters for the ManagedInstanceVulnerabilityAssessmentsClient.NewListByInstancePager +// method. +type ManagedInstanceVulnerabilityAssessmentsClientListByInstanceOptions struct { + // placeholder for future optional parameters +} + +// ManagedInstancesClientBeginCreateOrUpdateOptions contains the optional parameters for the ManagedInstancesClient.BeginCreateOrUpdate +// method. +type ManagedInstancesClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ManagedInstancesClientBeginDeleteOptions contains the optional parameters for the ManagedInstancesClient.BeginDelete method. +type ManagedInstancesClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ManagedInstancesClientBeginFailoverOptions contains the optional parameters for the ManagedInstancesClient.BeginFailover +// method. +type ManagedInstancesClientBeginFailoverOptions struct { + // The type of replica to be failed over. + ReplicaType *ReplicaType + + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ManagedInstancesClientBeginStartOptions contains the optional parameters for the ManagedInstancesClient.BeginStart method. +type ManagedInstancesClientBeginStartOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ManagedInstancesClientBeginStopOptions contains the optional parameters for the ManagedInstancesClient.BeginStop method. +type ManagedInstancesClientBeginStopOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ManagedInstancesClientBeginUpdateOptions contains the optional parameters for the ManagedInstancesClient.BeginUpdate method. +type ManagedInstancesClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ManagedInstancesClientGetOptions contains the optional parameters for the ManagedInstancesClient.Get method. +type ManagedInstancesClientGetOptions struct { + // The child resources to include in the response. + Expand *string +} + +// ManagedInstancesClientListByInstancePoolOptions contains the optional parameters for the ManagedInstancesClient.NewListByInstancePoolPager +// method. +type ManagedInstancesClientListByInstancePoolOptions struct { + // The child resources to include in the response. + Expand *string +} + +// ManagedInstancesClientListByManagedInstanceOptions contains the optional parameters for the ManagedInstancesClient.NewListByManagedInstancePager +// method. +type ManagedInstancesClientListByManagedInstanceOptions struct { + // Aggregation function to be used, default value is 'sum' + AggregationFunction *AggregationFunctionType + + // Comma separated list of databases to be included into search. All DB's are included if this parameter is not specified. + Databases *string + + // End time for observed period. + EndTime *string + + // The time step to be used to summarize the metric values. Default value is PT1H + Interval *QueryTimeGrainType + + // How many 'top queries' to return. Default is 5. + NumberOfQueries *int32 + + // Metric to be used for ranking top queries. Default is 'cpu' + ObservationMetric *MetricType + + // Start time for observed period. + StartTime *string +} + +// ManagedInstancesClientListByResourceGroupOptions contains the optional parameters for the ManagedInstancesClient.NewListByResourceGroupPager +// method. +type ManagedInstancesClientListByResourceGroupOptions struct { + // The child resources to include in the response. + Expand *string +} + +// ManagedInstancesClientListOptions contains the optional parameters for the ManagedInstancesClient.NewListPager method. +type ManagedInstancesClientListOptions struct { + // The child resources to include in the response. + Expand *string +} + +// ManagedInstancesClientListOutboundNetworkDependenciesByManagedInstanceOptions contains the optional parameters for the +// ManagedInstancesClient.NewListOutboundNetworkDependenciesByManagedInstancePager method. +type ManagedInstancesClientListOutboundNetworkDependenciesByManagedInstanceOptions struct { + // placeholder for future optional parameters +} + +// ManagedLedgerDigestUploadsClientBeginCreateOrUpdateOptions contains the optional parameters for the ManagedLedgerDigestUploadsClient.BeginCreateOrUpdate +// method. +type ManagedLedgerDigestUploadsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ManagedLedgerDigestUploadsClientBeginDisableOptions contains the optional parameters for the ManagedLedgerDigestUploadsClient.BeginDisable +// method. +type ManagedLedgerDigestUploadsClientBeginDisableOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ManagedLedgerDigestUploadsClientGetOptions contains the optional parameters for the ManagedLedgerDigestUploadsClient.Get +// method. +type ManagedLedgerDigestUploadsClientGetOptions struct { + // placeholder for future optional parameters +} + +// ManagedLedgerDigestUploadsClientListByDatabaseOptions contains the optional parameters for the ManagedLedgerDigestUploadsClient.NewListByDatabasePager +// method. +type ManagedLedgerDigestUploadsClientListByDatabaseOptions struct { + // placeholder for future optional parameters +} + +// ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClientBeginCreateOrUpdateOptions contains the optional +// parameters for the ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClient.BeginCreateOrUpdate method. +type ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClientBeginUpdateOptions contains the optional parameters +// for the ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClient.BeginUpdate method. +type ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClientGetOptions contains the optional parameters for the +// ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClient.Get method. +type ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClientGetOptions struct { + // placeholder for future optional parameters +} + +// ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClientListByRestorableDroppedDatabaseOptions contains the +// optional parameters for the ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClient.NewListByRestorableDroppedDatabasePager +// method. +type ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClientListByRestorableDroppedDatabaseOptions struct { + // placeholder for future optional parameters +} + +// ManagedServerDNSAliasesClientBeginAcquireOptions contains the optional parameters for the ManagedServerDNSAliasesClient.BeginAcquire +// method. +type ManagedServerDNSAliasesClientBeginAcquireOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ManagedServerDNSAliasesClientBeginCreateOrUpdateOptions contains the optional parameters for the ManagedServerDNSAliasesClient.BeginCreateOrUpdate +// method. +type ManagedServerDNSAliasesClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ManagedServerDNSAliasesClientBeginDeleteOptions contains the optional parameters for the ManagedServerDNSAliasesClient.BeginDelete +// method. +type ManagedServerDNSAliasesClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ManagedServerDNSAliasesClientGetOptions contains the optional parameters for the ManagedServerDNSAliasesClient.Get method. +type ManagedServerDNSAliasesClientGetOptions struct { + // placeholder for future optional parameters +} + +// ManagedServerDNSAliasesClientListByManagedInstanceOptions contains the optional parameters for the ManagedServerDNSAliasesClient.NewListByManagedInstancePager +// method. +type ManagedServerDNSAliasesClientListByManagedInstanceOptions struct { + // placeholder for future optional parameters +} + +// ManagedServerSecurityAlertPoliciesClientBeginCreateOrUpdateOptions contains the optional parameters for the ManagedServerSecurityAlertPoliciesClient.BeginCreateOrUpdate +// method. +type ManagedServerSecurityAlertPoliciesClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ManagedServerSecurityAlertPoliciesClientGetOptions contains the optional parameters for the ManagedServerSecurityAlertPoliciesClient.Get +// method. +type ManagedServerSecurityAlertPoliciesClientGetOptions struct { + // placeholder for future optional parameters +} + +// ManagedServerSecurityAlertPoliciesClientListByInstanceOptions contains the optional parameters for the ManagedServerSecurityAlertPoliciesClient.NewListByInstancePager +// method. +type ManagedServerSecurityAlertPoliciesClientListByInstanceOptions struct { + // placeholder for future optional parameters +} + +// NetworkSecurityPerimeterConfigurationsClientBeginReconcileOptions contains the optional parameters for the NetworkSecurityPerimeterConfigurationsClient.BeginReconcile +// method. +type NetworkSecurityPerimeterConfigurationsClientBeginReconcileOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// NetworkSecurityPerimeterConfigurationsClientGetOptions contains the optional parameters for the NetworkSecurityPerimeterConfigurationsClient.Get +// method. +type NetworkSecurityPerimeterConfigurationsClientGetOptions struct { + // placeholder for future optional parameters +} + +// NetworkSecurityPerimeterConfigurationsClientListByServerOptions contains the optional parameters for the NetworkSecurityPerimeterConfigurationsClient.NewListByServerPager +// method. +type NetworkSecurityPerimeterConfigurationsClientListByServerOptions struct { + // placeholder for future optional parameters +} + +// OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. +type OperationsClientListOptions struct { + // placeholder for future optional parameters +} + +// OutboundFirewallRulesClientBeginCreateOrUpdateOptions contains the optional parameters for the OutboundFirewallRulesClient.BeginCreateOrUpdate +// method. +type OutboundFirewallRulesClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// OutboundFirewallRulesClientBeginDeleteOptions contains the optional parameters for the OutboundFirewallRulesClient.BeginDelete +// method. +type OutboundFirewallRulesClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// OutboundFirewallRulesClientGetOptions contains the optional parameters for the OutboundFirewallRulesClient.Get method. +type OutboundFirewallRulesClientGetOptions struct { + // placeholder for future optional parameters +} + +// OutboundFirewallRulesClientListByServerOptions contains the optional parameters for the OutboundFirewallRulesClient.NewListByServerPager +// method. +type OutboundFirewallRulesClientListByServerOptions struct { + // placeholder for future optional parameters +} + +// PrivateEndpointConnectionsClientBeginCreateOrUpdateOptions contains the optional parameters for the PrivateEndpointConnectionsClient.BeginCreateOrUpdate +// method. +type PrivateEndpointConnectionsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// PrivateEndpointConnectionsClientBeginDeleteOptions contains the optional parameters for the PrivateEndpointConnectionsClient.BeginDelete +// method. +type PrivateEndpointConnectionsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// PrivateEndpointConnectionsClientGetOptions contains the optional parameters for the PrivateEndpointConnectionsClient.Get +// method. +type PrivateEndpointConnectionsClientGetOptions struct { + // placeholder for future optional parameters +} + +// PrivateEndpointConnectionsClientListByServerOptions contains the optional parameters for the PrivateEndpointConnectionsClient.NewListByServerPager +// method. +type PrivateEndpointConnectionsClientListByServerOptions struct { + // placeholder for future optional parameters +} + +// PrivateLinkResourcesClientGetOptions contains the optional parameters for the PrivateLinkResourcesClient.Get method. +type PrivateLinkResourcesClientGetOptions struct { + // placeholder for future optional parameters +} + +// PrivateLinkResourcesClientListByServerOptions contains the optional parameters for the PrivateLinkResourcesClient.NewListByServerPager +// method. +type PrivateLinkResourcesClientListByServerOptions struct { + // placeholder for future optional parameters +} + +// RecommendedSensitivityLabelsClientUpdateOptions contains the optional parameters for the RecommendedSensitivityLabelsClient.Update +// method. +type RecommendedSensitivityLabelsClientUpdateOptions struct { + // placeholder for future optional parameters +} + +// RecoverableDatabasesClientGetOptions contains the optional parameters for the RecoverableDatabasesClient.Get method. +type RecoverableDatabasesClientGetOptions struct { + // The child resources to include in the response. + Expand *string + + // An OData filter expression that filters elements in the collection. + Filter *string +} + +// RecoverableDatabasesClientListByServerOptions contains the optional parameters for the RecoverableDatabasesClient.NewListByServerPager +// method. +type RecoverableDatabasesClientListByServerOptions struct { + // placeholder for future optional parameters +} + +// RecoverableManagedDatabasesClientGetOptions contains the optional parameters for the RecoverableManagedDatabasesClient.Get +// method. +type RecoverableManagedDatabasesClientGetOptions struct { + // placeholder for future optional parameters +} + +// RecoverableManagedDatabasesClientListByInstanceOptions contains the optional parameters for the RecoverableManagedDatabasesClient.NewListByInstancePager +// method. +type RecoverableManagedDatabasesClientListByInstanceOptions struct { + // placeholder for future optional parameters +} + +// ReplicationLinksClientBeginDeleteOptions contains the optional parameters for the ReplicationLinksClient.BeginDelete method. +type ReplicationLinksClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ReplicationLinksClientBeginFailoverAllowDataLossOptions contains the optional parameters for the ReplicationLinksClient.BeginFailoverAllowDataLoss +// method. +type ReplicationLinksClientBeginFailoverAllowDataLossOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ReplicationLinksClientBeginFailoverOptions contains the optional parameters for the ReplicationLinksClient.BeginFailover +// method. +type ReplicationLinksClientBeginFailoverOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ReplicationLinksClientGetOptions contains the optional parameters for the ReplicationLinksClient.Get method. +type ReplicationLinksClientGetOptions struct { + // placeholder for future optional parameters +} + +// ReplicationLinksClientListByDatabaseOptions contains the optional parameters for the ReplicationLinksClient.NewListByDatabasePager +// method. +type ReplicationLinksClientListByDatabaseOptions struct { + // placeholder for future optional parameters +} + +// ReplicationLinksClientListByServerOptions contains the optional parameters for the ReplicationLinksClient.NewListByServerPager +// method. +type ReplicationLinksClientListByServerOptions struct { + // placeholder for future optional parameters +} + +// RestorableDroppedDatabasesClientGetOptions contains the optional parameters for the RestorableDroppedDatabasesClient.Get +// method. +type RestorableDroppedDatabasesClientGetOptions struct { + // The child resources to include in the response. + Expand *string + + // An OData filter expression that filters elements in the collection. + Filter *string +} + +// RestorableDroppedDatabasesClientListByServerOptions contains the optional parameters for the RestorableDroppedDatabasesClient.NewListByServerPager +// method. +type RestorableDroppedDatabasesClientListByServerOptions struct { + // placeholder for future optional parameters +} + +// RestorableDroppedManagedDatabasesClientGetOptions contains the optional parameters for the RestorableDroppedManagedDatabasesClient.Get +// method. +type RestorableDroppedManagedDatabasesClientGetOptions struct { + // placeholder for future optional parameters +} + +// RestorableDroppedManagedDatabasesClientListByInstanceOptions contains the optional parameters for the RestorableDroppedManagedDatabasesClient.NewListByInstancePager +// method. +type RestorableDroppedManagedDatabasesClientListByInstanceOptions struct { + // placeholder for future optional parameters +} + +// RestorePointsClientBeginCreateOptions contains the optional parameters for the RestorePointsClient.BeginCreate method. +type RestorePointsClientBeginCreateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// RestorePointsClientDeleteOptions contains the optional parameters for the RestorePointsClient.Delete method. +type RestorePointsClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// RestorePointsClientGetOptions contains the optional parameters for the RestorePointsClient.Get method. +type RestorePointsClientGetOptions struct { + // placeholder for future optional parameters +} + +// RestorePointsClientListByDatabaseOptions contains the optional parameters for the RestorePointsClient.NewListByDatabasePager +// method. +type RestorePointsClientListByDatabaseOptions struct { + // placeholder for future optional parameters +} + +// SensitivityLabelsClientCreateOrUpdateOptions contains the optional parameters for the SensitivityLabelsClient.CreateOrUpdate +// method. +type SensitivityLabelsClientCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// SensitivityLabelsClientDeleteOptions contains the optional parameters for the SensitivityLabelsClient.Delete method. +type SensitivityLabelsClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// SensitivityLabelsClientDisableRecommendationOptions contains the optional parameters for the SensitivityLabelsClient.DisableRecommendation +// method. +type SensitivityLabelsClientDisableRecommendationOptions struct { + // placeholder for future optional parameters +} + +// SensitivityLabelsClientEnableRecommendationOptions contains the optional parameters for the SensitivityLabelsClient.EnableRecommendation +// method. +type SensitivityLabelsClientEnableRecommendationOptions struct { + // placeholder for future optional parameters +} + +// SensitivityLabelsClientGetOptions contains the optional parameters for the SensitivityLabelsClient.Get method. +type SensitivityLabelsClientGetOptions struct { + // placeholder for future optional parameters +} + +// SensitivityLabelsClientListByDatabaseOptions contains the optional parameters for the SensitivityLabelsClient.NewListByDatabasePager +// method. +type SensitivityLabelsClientListByDatabaseOptions struct { + // An OData filter expression that filters elements in the collection. + Filter *string +} + +// SensitivityLabelsClientListCurrentByDatabaseOptions contains the optional parameters for the SensitivityLabelsClient.NewListCurrentByDatabasePager +// method. +type SensitivityLabelsClientListCurrentByDatabaseOptions struct { + Count *bool + + // An OData filter expression that filters elements in the collection. + Filter *string + SkipToken *string +} + +// SensitivityLabelsClientListRecommendedByDatabaseOptions contains the optional parameters for the SensitivityLabelsClient.NewListRecommendedByDatabasePager +// method. +type SensitivityLabelsClientListRecommendedByDatabaseOptions struct { + // An OData filter expression that filters elements in the collection. + Filter *string + + // Specifies whether to include disabled recommendations or not. + IncludeDisabledRecommendations *bool + SkipToken *string +} + +// SensitivityLabelsClientUpdateOptions contains the optional parameters for the SensitivityLabelsClient.Update method. +type SensitivityLabelsClientUpdateOptions struct { + // placeholder for future optional parameters +} + +// ServerAdvancedThreatProtectionSettingsClientBeginCreateOrUpdateOptions contains the optional parameters for the ServerAdvancedThreatProtectionSettingsClient.BeginCreateOrUpdate +// method. +type ServerAdvancedThreatProtectionSettingsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ServerAdvancedThreatProtectionSettingsClientGetOptions contains the optional parameters for the ServerAdvancedThreatProtectionSettingsClient.Get +// method. +type ServerAdvancedThreatProtectionSettingsClientGetOptions struct { + // placeholder for future optional parameters +} + +// ServerAdvancedThreatProtectionSettingsClientListByServerOptions contains the optional parameters for the ServerAdvancedThreatProtectionSettingsClient.NewListByServerPager +// method. +type ServerAdvancedThreatProtectionSettingsClientListByServerOptions struct { + // placeholder for future optional parameters +} + +// ServerAdvisorsClientGetOptions contains the optional parameters for the ServerAdvisorsClient.Get method. +type ServerAdvisorsClientGetOptions struct { + // placeholder for future optional parameters +} + +// ServerAdvisorsClientListByServerOptions contains the optional parameters for the ServerAdvisorsClient.ListByServer method. +type ServerAdvisorsClientListByServerOptions struct { + // The child resources to include in the response. + Expand *string +} + +// ServerAdvisorsClientUpdateOptions contains the optional parameters for the ServerAdvisorsClient.Update method. +type ServerAdvisorsClientUpdateOptions struct { + // placeholder for future optional parameters +} + +// ServerAutomaticTuningClientGetOptions contains the optional parameters for the ServerAutomaticTuningClient.Get method. +type ServerAutomaticTuningClientGetOptions struct { + // placeholder for future optional parameters +} + +// ServerAutomaticTuningClientUpdateOptions contains the optional parameters for the ServerAutomaticTuningClient.Update method. +type ServerAutomaticTuningClientUpdateOptions struct { + // placeholder for future optional parameters +} + +// ServerAzureADAdministratorsClientBeginCreateOrUpdateOptions contains the optional parameters for the ServerAzureADAdministratorsClient.BeginCreateOrUpdate +// method. +type ServerAzureADAdministratorsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ServerAzureADAdministratorsClientBeginDeleteOptions contains the optional parameters for the ServerAzureADAdministratorsClient.BeginDelete +// method. +type ServerAzureADAdministratorsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ServerAzureADAdministratorsClientGetOptions contains the optional parameters for the ServerAzureADAdministratorsClient.Get +// method. +type ServerAzureADAdministratorsClientGetOptions struct { + // placeholder for future optional parameters +} + +// ServerAzureADAdministratorsClientListByServerOptions contains the optional parameters for the ServerAzureADAdministratorsClient.NewListByServerPager +// method. +type ServerAzureADAdministratorsClientListByServerOptions struct { + // placeholder for future optional parameters +} + +// ServerAzureADOnlyAuthenticationsClientBeginCreateOrUpdateOptions contains the optional parameters for the ServerAzureADOnlyAuthenticationsClient.BeginCreateOrUpdate +// method. +type ServerAzureADOnlyAuthenticationsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ServerAzureADOnlyAuthenticationsClientBeginDeleteOptions contains the optional parameters for the ServerAzureADOnlyAuthenticationsClient.BeginDelete +// method. +type ServerAzureADOnlyAuthenticationsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ServerAzureADOnlyAuthenticationsClientGetOptions contains the optional parameters for the ServerAzureADOnlyAuthenticationsClient.Get +// method. +type ServerAzureADOnlyAuthenticationsClientGetOptions struct { + // placeholder for future optional parameters +} + +// ServerAzureADOnlyAuthenticationsClientListByServerOptions contains the optional parameters for the ServerAzureADOnlyAuthenticationsClient.NewListByServerPager +// method. +type ServerAzureADOnlyAuthenticationsClientListByServerOptions struct { + // placeholder for future optional parameters +} + +// ServerBlobAuditingPoliciesClientBeginCreateOrUpdateOptions contains the optional parameters for the ServerBlobAuditingPoliciesClient.BeginCreateOrUpdate +// method. +type ServerBlobAuditingPoliciesClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ServerBlobAuditingPoliciesClientGetOptions contains the optional parameters for the ServerBlobAuditingPoliciesClient.Get +// method. +type ServerBlobAuditingPoliciesClientGetOptions struct { + // placeholder for future optional parameters +} + +// ServerBlobAuditingPoliciesClientListByServerOptions contains the optional parameters for the ServerBlobAuditingPoliciesClient.NewListByServerPager +// method. +type ServerBlobAuditingPoliciesClientListByServerOptions struct { + // placeholder for future optional parameters +} + +// ServerConfigurationOptionsClientBeginCreateOrUpdateOptions contains the optional parameters for the ServerConfigurationOptionsClient.BeginCreateOrUpdate +// method. +type ServerConfigurationOptionsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ServerConfigurationOptionsClientGetOptions contains the optional parameters for the ServerConfigurationOptionsClient.Get +// method. +type ServerConfigurationOptionsClientGetOptions struct { + // placeholder for future optional parameters +} + +// ServerConfigurationOptionsClientListByManagedInstanceOptions contains the optional parameters for the ServerConfigurationOptionsClient.NewListByManagedInstancePager +// method. +type ServerConfigurationOptionsClientListByManagedInstanceOptions struct { + // placeholder for future optional parameters +} + +// ServerConnectionPoliciesClientBeginCreateOrUpdateOptions contains the optional parameters for the ServerConnectionPoliciesClient.BeginCreateOrUpdate +// method. +type ServerConnectionPoliciesClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ServerConnectionPoliciesClientGetOptions contains the optional parameters for the ServerConnectionPoliciesClient.Get method. +type ServerConnectionPoliciesClientGetOptions struct { + // placeholder for future optional parameters +} + +// ServerConnectionPoliciesClientListByServerOptions contains the optional parameters for the ServerConnectionPoliciesClient.NewListByServerPager +// method. +type ServerConnectionPoliciesClientListByServerOptions struct { + // placeholder for future optional parameters +} + +// ServerDNSAliasesClientBeginAcquireOptions contains the optional parameters for the ServerDNSAliasesClient.BeginAcquire +// method. +type ServerDNSAliasesClientBeginAcquireOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ServerDNSAliasesClientBeginCreateOrUpdateOptions contains the optional parameters for the ServerDNSAliasesClient.BeginCreateOrUpdate +// method. +type ServerDNSAliasesClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ServerDNSAliasesClientBeginDeleteOptions contains the optional parameters for the ServerDNSAliasesClient.BeginDelete method. +type ServerDNSAliasesClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ServerDNSAliasesClientGetOptions contains the optional parameters for the ServerDNSAliasesClient.Get method. +type ServerDNSAliasesClientGetOptions struct { + // placeholder for future optional parameters +} + +// ServerDNSAliasesClientListByServerOptions contains the optional parameters for the ServerDNSAliasesClient.NewListByServerPager +// method. +type ServerDNSAliasesClientListByServerOptions struct { + // placeholder for future optional parameters +} + +// ServerDevOpsAuditSettingsClientBeginCreateOrUpdateOptions contains the optional parameters for the ServerDevOpsAuditSettingsClient.BeginCreateOrUpdate +// method. +type ServerDevOpsAuditSettingsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ServerDevOpsAuditSettingsClientGetOptions contains the optional parameters for the ServerDevOpsAuditSettingsClient.Get +// method. +type ServerDevOpsAuditSettingsClientGetOptions struct { + // placeholder for future optional parameters +} + +// ServerDevOpsAuditSettingsClientListByServerOptions contains the optional parameters for the ServerDevOpsAuditSettingsClient.NewListByServerPager +// method. +type ServerDevOpsAuditSettingsClientListByServerOptions struct { + // placeholder for future optional parameters +} + +// ServerKeysClientBeginCreateOrUpdateOptions contains the optional parameters for the ServerKeysClient.BeginCreateOrUpdate +// method. +type ServerKeysClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ServerKeysClientBeginDeleteOptions contains the optional parameters for the ServerKeysClient.BeginDelete method. +type ServerKeysClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ServerKeysClientGetOptions contains the optional parameters for the ServerKeysClient.Get method. +type ServerKeysClientGetOptions struct { + // placeholder for future optional parameters +} + +// ServerKeysClientListByServerOptions contains the optional parameters for the ServerKeysClient.NewListByServerPager method. +type ServerKeysClientListByServerOptions struct { + // placeholder for future optional parameters +} + +// ServerOperationsClientListByServerOptions contains the optional parameters for the ServerOperationsClient.NewListByServerPager +// method. +type ServerOperationsClientListByServerOptions struct { + // placeholder for future optional parameters +} + +// ServerSecurityAlertPoliciesClientBeginCreateOrUpdateOptions contains the optional parameters for the ServerSecurityAlertPoliciesClient.BeginCreateOrUpdate +// method. +type ServerSecurityAlertPoliciesClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ServerSecurityAlertPoliciesClientGetOptions contains the optional parameters for the ServerSecurityAlertPoliciesClient.Get +// method. +type ServerSecurityAlertPoliciesClientGetOptions struct { + // placeholder for future optional parameters +} + +// ServerSecurityAlertPoliciesClientListByServerOptions contains the optional parameters for the ServerSecurityAlertPoliciesClient.NewListByServerPager +// method. +type ServerSecurityAlertPoliciesClientListByServerOptions struct { + // placeholder for future optional parameters +} + +// ServerTrustCertificatesClientBeginCreateOrUpdateOptions contains the optional parameters for the ServerTrustCertificatesClient.BeginCreateOrUpdate +// method. +type ServerTrustCertificatesClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ServerTrustCertificatesClientBeginDeleteOptions contains the optional parameters for the ServerTrustCertificatesClient.BeginDelete +// method. +type ServerTrustCertificatesClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ServerTrustCertificatesClientGetOptions contains the optional parameters for the ServerTrustCertificatesClient.Get method. +type ServerTrustCertificatesClientGetOptions struct { + // placeholder for future optional parameters +} + +// ServerTrustCertificatesClientListByInstanceOptions contains the optional parameters for the ServerTrustCertificatesClient.NewListByInstancePager +// method. +type ServerTrustCertificatesClientListByInstanceOptions struct { + // placeholder for future optional parameters +} + +// ServerTrustGroupsClientBeginCreateOrUpdateOptions contains the optional parameters for the ServerTrustGroupsClient.BeginCreateOrUpdate +// method. +type ServerTrustGroupsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ServerTrustGroupsClientBeginDeleteOptions contains the optional parameters for the ServerTrustGroupsClient.BeginDelete +// method. +type ServerTrustGroupsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ServerTrustGroupsClientGetOptions contains the optional parameters for the ServerTrustGroupsClient.Get method. +type ServerTrustGroupsClientGetOptions struct { + // placeholder for future optional parameters +} + +// ServerTrustGroupsClientListByInstanceOptions contains the optional parameters for the ServerTrustGroupsClient.NewListByInstancePager +// method. +type ServerTrustGroupsClientListByInstanceOptions struct { + // placeholder for future optional parameters +} + +// ServerTrustGroupsClientListByLocationOptions contains the optional parameters for the ServerTrustGroupsClient.NewListByLocationPager +// method. +type ServerTrustGroupsClientListByLocationOptions struct { + // placeholder for future optional parameters +} + +// ServerUsagesClientListByServerOptions contains the optional parameters for the ServerUsagesClient.NewListByServerPager +// method. +type ServerUsagesClientListByServerOptions struct { + // placeholder for future optional parameters +} + +// ServerVulnerabilityAssessmentsClientCreateOrUpdateOptions contains the optional parameters for the ServerVulnerabilityAssessmentsClient.CreateOrUpdate +// method. +type ServerVulnerabilityAssessmentsClientCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// ServerVulnerabilityAssessmentsClientDeleteOptions contains the optional parameters for the ServerVulnerabilityAssessmentsClient.Delete +// method. +type ServerVulnerabilityAssessmentsClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// ServerVulnerabilityAssessmentsClientGetOptions contains the optional parameters for the ServerVulnerabilityAssessmentsClient.Get +// method. +type ServerVulnerabilityAssessmentsClientGetOptions struct { + // placeholder for future optional parameters +} + +// ServerVulnerabilityAssessmentsClientListByServerOptions contains the optional parameters for the ServerVulnerabilityAssessmentsClient.NewListByServerPager +// method. +type ServerVulnerabilityAssessmentsClientListByServerOptions struct { + // placeholder for future optional parameters +} + +// ServersClientBeginCreateOrUpdateOptions contains the optional parameters for the ServersClient.BeginCreateOrUpdate method. +type ServersClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ServersClientBeginDeleteOptions contains the optional parameters for the ServersClient.BeginDelete method. +type ServersClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ServersClientBeginImportDatabaseOptions contains the optional parameters for the ServersClient.BeginImportDatabase method. +type ServersClientBeginImportDatabaseOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ServersClientBeginRefreshStatusOptions contains the optional parameters for the ServersClient.BeginRefreshStatus method. +type ServersClientBeginRefreshStatusOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ServersClientBeginUpdateOptions contains the optional parameters for the ServersClient.BeginUpdate method. +type ServersClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ServersClientCheckNameAvailabilityOptions contains the optional parameters for the ServersClient.CheckNameAvailability +// method. +type ServersClientCheckNameAvailabilityOptions struct { + // placeholder for future optional parameters +} + +// ServersClientGetOptions contains the optional parameters for the ServersClient.Get method. +type ServersClientGetOptions struct { + // The child resources to include in the response. + Expand *string +} + +// ServersClientListByResourceGroupOptions contains the optional parameters for the ServersClient.NewListByResourceGroupPager +// method. +type ServersClientListByResourceGroupOptions struct { + // The child resources to include in the response. + Expand *string +} + +// ServersClientListOptions contains the optional parameters for the ServersClient.NewListPager method. +type ServersClientListOptions struct { + // The child resources to include in the response. + Expand *string +} + +// StartStopManagedInstanceSchedulesClientCreateOrUpdateOptions contains the optional parameters for the StartStopManagedInstanceSchedulesClient.CreateOrUpdate +// method. +type StartStopManagedInstanceSchedulesClientCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// StartStopManagedInstanceSchedulesClientDeleteOptions contains the optional parameters for the StartStopManagedInstanceSchedulesClient.Delete +// method. +type StartStopManagedInstanceSchedulesClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// StartStopManagedInstanceSchedulesClientGetOptions contains the optional parameters for the StartStopManagedInstanceSchedulesClient.Get +// method. +type StartStopManagedInstanceSchedulesClientGetOptions struct { + // placeholder for future optional parameters +} + +// StartStopManagedInstanceSchedulesClientListByInstanceOptions contains the optional parameters for the StartStopManagedInstanceSchedulesClient.NewListByInstancePager +// method. +type StartStopManagedInstanceSchedulesClientListByInstanceOptions struct { + // placeholder for future optional parameters +} + +// SubscriptionUsagesClientGetOptions contains the optional parameters for the SubscriptionUsagesClient.Get method. +type SubscriptionUsagesClientGetOptions struct { + // placeholder for future optional parameters +} + +// SubscriptionUsagesClientListByLocationOptions contains the optional parameters for the SubscriptionUsagesClient.NewListByLocationPager +// method. +type SubscriptionUsagesClientListByLocationOptions struct { + // placeholder for future optional parameters +} + +// SynapseLinkWorkspacesClientListByDatabaseOptions contains the optional parameters for the SynapseLinkWorkspacesClient.NewListByDatabasePager +// method. +type SynapseLinkWorkspacesClientListByDatabaseOptions struct { + // placeholder for future optional parameters +} + +// SyncAgentsClientBeginCreateOrUpdateOptions contains the optional parameters for the SyncAgentsClient.BeginCreateOrUpdate +// method. +type SyncAgentsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// SyncAgentsClientBeginDeleteOptions contains the optional parameters for the SyncAgentsClient.BeginDelete method. +type SyncAgentsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// SyncAgentsClientGenerateKeyOptions contains the optional parameters for the SyncAgentsClient.GenerateKey method. +type SyncAgentsClientGenerateKeyOptions struct { + // placeholder for future optional parameters +} + +// SyncAgentsClientGetOptions contains the optional parameters for the SyncAgentsClient.Get method. +type SyncAgentsClientGetOptions struct { + // placeholder for future optional parameters +} + +// SyncAgentsClientListByServerOptions contains the optional parameters for the SyncAgentsClient.NewListByServerPager method. +type SyncAgentsClientListByServerOptions struct { + // placeholder for future optional parameters +} + +// SyncAgentsClientListLinkedDatabasesOptions contains the optional parameters for the SyncAgentsClient.NewListLinkedDatabasesPager +// method. +type SyncAgentsClientListLinkedDatabasesOptions struct { + // placeholder for future optional parameters +} + +// SyncGroupsClientBeginCreateOrUpdateOptions contains the optional parameters for the SyncGroupsClient.BeginCreateOrUpdate +// method. +type SyncGroupsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// SyncGroupsClientBeginDeleteOptions contains the optional parameters for the SyncGroupsClient.BeginDelete method. +type SyncGroupsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// SyncGroupsClientBeginRefreshHubSchemaOptions contains the optional parameters for the SyncGroupsClient.BeginRefreshHubSchema +// method. +type SyncGroupsClientBeginRefreshHubSchemaOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// SyncGroupsClientBeginUpdateOptions contains the optional parameters for the SyncGroupsClient.BeginUpdate method. +type SyncGroupsClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// SyncGroupsClientCancelSyncOptions contains the optional parameters for the SyncGroupsClient.CancelSync method. +type SyncGroupsClientCancelSyncOptions struct { + // placeholder for future optional parameters +} + +// SyncGroupsClientGetOptions contains the optional parameters for the SyncGroupsClient.Get method. +type SyncGroupsClientGetOptions struct { + // placeholder for future optional parameters +} + +// SyncGroupsClientListByDatabaseOptions contains the optional parameters for the SyncGroupsClient.NewListByDatabasePager +// method. +type SyncGroupsClientListByDatabaseOptions struct { + // placeholder for future optional parameters +} + +// SyncGroupsClientListHubSchemasOptions contains the optional parameters for the SyncGroupsClient.NewListHubSchemasPager +// method. +type SyncGroupsClientListHubSchemasOptions struct { + // placeholder for future optional parameters +} + +// SyncGroupsClientListLogsOptions contains the optional parameters for the SyncGroupsClient.NewListLogsPager method. +type SyncGroupsClientListLogsOptions struct { + // The continuation token for this operation. + ContinuationToken *string +} + +// SyncGroupsClientListSyncDatabaseIDsOptions contains the optional parameters for the SyncGroupsClient.NewListSyncDatabaseIDsPager +// method. +type SyncGroupsClientListSyncDatabaseIDsOptions struct { + // placeholder for future optional parameters +} + +// SyncGroupsClientTriggerSyncOptions contains the optional parameters for the SyncGroupsClient.TriggerSync method. +type SyncGroupsClientTriggerSyncOptions struct { + // placeholder for future optional parameters +} + +// SyncMembersClientBeginCreateOrUpdateOptions contains the optional parameters for the SyncMembersClient.BeginCreateOrUpdate +// method. +type SyncMembersClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// SyncMembersClientBeginDeleteOptions contains the optional parameters for the SyncMembersClient.BeginDelete method. +type SyncMembersClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// SyncMembersClientBeginRefreshMemberSchemaOptions contains the optional parameters for the SyncMembersClient.BeginRefreshMemberSchema +// method. +type SyncMembersClientBeginRefreshMemberSchemaOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// SyncMembersClientBeginUpdateOptions contains the optional parameters for the SyncMembersClient.BeginUpdate method. +type SyncMembersClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// SyncMembersClientGetOptions contains the optional parameters for the SyncMembersClient.Get method. +type SyncMembersClientGetOptions struct { + // placeholder for future optional parameters +} + +// SyncMembersClientListBySyncGroupOptions contains the optional parameters for the SyncMembersClient.NewListBySyncGroupPager +// method. +type SyncMembersClientListBySyncGroupOptions struct { + // placeholder for future optional parameters +} + +// SyncMembersClientListMemberSchemasOptions contains the optional parameters for the SyncMembersClient.NewListMemberSchemasPager +// method. +type SyncMembersClientListMemberSchemasOptions struct { + // placeholder for future optional parameters +} + +// TdeCertificatesClientBeginCreateOptions contains the optional parameters for the TdeCertificatesClient.BeginCreate method. +type TdeCertificatesClientBeginCreateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// TimeZonesClientGetOptions contains the optional parameters for the TimeZonesClient.Get method. +type TimeZonesClientGetOptions struct { + // placeholder for future optional parameters +} + +// TimeZonesClientListByLocationOptions contains the optional parameters for the TimeZonesClient.NewListByLocationPager method. +type TimeZonesClientListByLocationOptions struct { + // placeholder for future optional parameters +} + +// TransparentDataEncryptionsClientBeginCreateOrUpdateOptions contains the optional parameters for the TransparentDataEncryptionsClient.BeginCreateOrUpdate +// method. +type TransparentDataEncryptionsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// TransparentDataEncryptionsClientGetOptions contains the optional parameters for the TransparentDataEncryptionsClient.Get +// method. +type TransparentDataEncryptionsClientGetOptions struct { + // placeholder for future optional parameters +} + +// TransparentDataEncryptionsClientListByDatabaseOptions contains the optional parameters for the TransparentDataEncryptionsClient.NewListByDatabasePager +// method. +type TransparentDataEncryptionsClientListByDatabaseOptions struct { + // placeholder for future optional parameters +} + +// UsagesClientListByInstancePoolOptions contains the optional parameters for the UsagesClient.NewListByInstancePoolPager +// method. +type UsagesClientListByInstancePoolOptions struct { + // Optional request parameter to include managed instance usages within the instance pool. + ExpandChildren *bool +} + +// VirtualClustersClientBeginDeleteOptions contains the optional parameters for the VirtualClustersClient.BeginDelete method. +type VirtualClustersClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VirtualClustersClientBeginUpdateDNSServersOptions contains the optional parameters for the VirtualClustersClient.BeginUpdateDNSServers +// method. +type VirtualClustersClientBeginUpdateDNSServersOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VirtualClustersClientBeginUpdateOptions contains the optional parameters for the VirtualClustersClient.BeginUpdate method. +type VirtualClustersClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VirtualClustersClientGetOptions contains the optional parameters for the VirtualClustersClient.Get method. +type VirtualClustersClientGetOptions struct { + // placeholder for future optional parameters +} + +// VirtualClustersClientListByResourceGroupOptions contains the optional parameters for the VirtualClustersClient.NewListByResourceGroupPager +// method. +type VirtualClustersClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// VirtualClustersClientListOptions contains the optional parameters for the VirtualClustersClient.NewListPager method. +type VirtualClustersClientListOptions struct { + // placeholder for future optional parameters +} + +// VirtualNetworkRulesClientBeginCreateOrUpdateOptions contains the optional parameters for the VirtualNetworkRulesClient.BeginCreateOrUpdate +// method. +type VirtualNetworkRulesClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VirtualNetworkRulesClientBeginDeleteOptions contains the optional parameters for the VirtualNetworkRulesClient.BeginDelete +// method. +type VirtualNetworkRulesClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VirtualNetworkRulesClientGetOptions contains the optional parameters for the VirtualNetworkRulesClient.Get method. +type VirtualNetworkRulesClientGetOptions struct { + // placeholder for future optional parameters +} + +// VirtualNetworkRulesClientListByServerOptions contains the optional parameters for the VirtualNetworkRulesClient.NewListByServerPager +// method. +type VirtualNetworkRulesClientListByServerOptions struct { + // placeholder for future optional parameters +} + +// VulnerabilityAssessmentBaselineClientGetOptions contains the optional parameters for the VulnerabilityAssessmentBaselineClient.Get +// method. +type VulnerabilityAssessmentBaselineClientGetOptions struct { + // placeholder for future optional parameters +} + +// VulnerabilityAssessmentBaselineClientListBySQLVulnerabilityAssessmentOptions contains the optional parameters for the VulnerabilityAssessmentBaselineClient.NewListBySQLVulnerabilityAssessmentPager +// method. +type VulnerabilityAssessmentBaselineClientListBySQLVulnerabilityAssessmentOptions struct { + // placeholder for future optional parameters +} + +// VulnerabilityAssessmentBaselinesClientCreateOrUpdateOptions contains the optional parameters for the VulnerabilityAssessmentBaselinesClient.CreateOrUpdate +// method. +type VulnerabilityAssessmentBaselinesClientCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// VulnerabilityAssessmentExecuteScanClientBeginExecuteOptions contains the optional parameters for the VulnerabilityAssessmentExecuteScanClient.BeginExecute +// method. +type VulnerabilityAssessmentExecuteScanClientBeginExecuteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VulnerabilityAssessmentRuleBaselineClientCreateOrUpdateOptions contains the optional parameters for the VulnerabilityAssessmentRuleBaselineClient.CreateOrUpdate +// method. +type VulnerabilityAssessmentRuleBaselineClientCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// VulnerabilityAssessmentRuleBaselineClientGetOptions contains the optional parameters for the VulnerabilityAssessmentRuleBaselineClient.Get +// method. +type VulnerabilityAssessmentRuleBaselineClientGetOptions struct { + // placeholder for future optional parameters +} + +// VulnerabilityAssessmentRuleBaselineClientListByBaselineOptions contains the optional parameters for the VulnerabilityAssessmentRuleBaselineClient.NewListByBaselinePager +// method. +type VulnerabilityAssessmentRuleBaselineClientListByBaselineOptions struct { + // placeholder for future optional parameters +} + +// VulnerabilityAssessmentRuleBaselinesClientDeleteOptions contains the optional parameters for the VulnerabilityAssessmentRuleBaselinesClient.Delete +// method. +type VulnerabilityAssessmentRuleBaselinesClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// VulnerabilityAssessmentScanResultClientGetOptions contains the optional parameters for the VulnerabilityAssessmentScanResultClient.Get +// method. +type VulnerabilityAssessmentScanResultClientGetOptions struct { + // placeholder for future optional parameters +} + +// VulnerabilityAssessmentScanResultClientListByScanOptions contains the optional parameters for the VulnerabilityAssessmentScanResultClient.NewListByScanPager +// method. +type VulnerabilityAssessmentScanResultClientListByScanOptions struct { + // placeholder for future optional parameters +} + +// VulnerabilityAssessmentScansClientGetOptions contains the optional parameters for the VulnerabilityAssessmentScansClient.Get +// method. +type VulnerabilityAssessmentScansClientGetOptions struct { + // placeholder for future optional parameters +} + +// VulnerabilityAssessmentScansClientListBySQLVulnerabilityAssessmentsOptions contains the optional parameters for the VulnerabilityAssessmentScansClient.NewListBySQLVulnerabilityAssessmentsPager +// method. +type VulnerabilityAssessmentScansClientListBySQLVulnerabilityAssessmentsOptions struct { + // placeholder for future optional parameters +} + +// VulnerabilityAssessmentsClientDeleteOptions contains the optional parameters for the VulnerabilityAssessmentsClient.Delete +// method. +type VulnerabilityAssessmentsClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// VulnerabilityAssessmentsSettingsClientCreateOrUpdateOptions contains the optional parameters for the VulnerabilityAssessmentsSettingsClient.CreateOrUpdate +// method. +type VulnerabilityAssessmentsSettingsClientCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// VulnerabilityAssessmentsSettingsClientGetOptions contains the optional parameters for the VulnerabilityAssessmentsSettingsClient.Get +// method. +type VulnerabilityAssessmentsSettingsClientGetOptions struct { + // placeholder for future optional parameters +} + +// VulnerabilityAssessmentsSettingsClientListByServerOptions contains the optional parameters for the VulnerabilityAssessmentsSettingsClient.NewListByServerPager +// method. +type VulnerabilityAssessmentsSettingsClientListByServerOptions struct { + // placeholder for future optional parameters +} + +// WorkloadClassifiersClientBeginCreateOrUpdateOptions contains the optional parameters for the WorkloadClassifiersClient.BeginCreateOrUpdate +// method. +type WorkloadClassifiersClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// WorkloadClassifiersClientBeginDeleteOptions contains the optional parameters for the WorkloadClassifiersClient.BeginDelete +// method. +type WorkloadClassifiersClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// WorkloadClassifiersClientGetOptions contains the optional parameters for the WorkloadClassifiersClient.Get method. +type WorkloadClassifiersClientGetOptions struct { + // placeholder for future optional parameters +} + +// WorkloadClassifiersClientListByWorkloadGroupOptions contains the optional parameters for the WorkloadClassifiersClient.NewListByWorkloadGroupPager +// method. +type WorkloadClassifiersClientListByWorkloadGroupOptions struct { + // placeholder for future optional parameters +} + +// WorkloadGroupsClientBeginCreateOrUpdateOptions contains the optional parameters for the WorkloadGroupsClient.BeginCreateOrUpdate +// method. +type WorkloadGroupsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// WorkloadGroupsClientBeginDeleteOptions contains the optional parameters for the WorkloadGroupsClient.BeginDelete method. +type WorkloadGroupsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// WorkloadGroupsClientGetOptions contains the optional parameters for the WorkloadGroupsClient.Get method. +type WorkloadGroupsClientGetOptions struct { + // placeholder for future optional parameters +} + +// WorkloadGroupsClientListByDatabaseOptions contains the optional parameters for the WorkloadGroupsClient.NewListByDatabasePager +// method. +type WorkloadGroupsClientListByDatabaseOptions struct { + // placeholder for future optional parameters +} diff --git a/sdk/resourcemanager/sql/armsql/outboundfirewallrules_client.go b/sdk/resourcemanager/sql/armsql/outboundfirewallrules_client.go index 72828e56ecb4..68a1072109a8 100644 --- a/sdk/resourcemanager/sql/armsql/outboundfirewallrules_client.go +++ b/sdk/resourcemanager/sql/armsql/outboundfirewallrules_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armsql @@ -47,19 +46,20 @@ func NewOutboundFirewallRulesClient(subscriptionID string, credential azcore.Tok // BeginCreateOrUpdate - Create a outbound firewall rule with a given name. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-02-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. // - options - OutboundFirewallRulesClientBeginCreateOrUpdateOptions contains the optional parameters for the OutboundFirewallRulesClient.BeginCreateOrUpdate // method. -func (client *OutboundFirewallRulesClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, outboundRuleFqdn string, parameters OutboundFirewallRule, options *OutboundFirewallRulesClientBeginCreateOrUpdateOptions) (*runtime.Poller[OutboundFirewallRulesClientCreateOrUpdateResponse], error) { +func (client *OutboundFirewallRulesClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, outboundRuleFqdn string, options *OutboundFirewallRulesClientBeginCreateOrUpdateOptions) (*runtime.Poller[OutboundFirewallRulesClientCreateOrUpdateResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.createOrUpdate(ctx, resourceGroupName, serverName, outboundRuleFqdn, parameters, options) + resp, err := client.createOrUpdate(ctx, resourceGroupName, serverName, outboundRuleFqdn, options) if err != nil { return nil, err } - return runtime.NewPoller[OutboundFirewallRulesClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[OutboundFirewallRulesClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[OutboundFirewallRulesClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -68,24 +68,26 @@ func (client *OutboundFirewallRulesClient) BeginCreateOrUpdate(ctx context.Conte // CreateOrUpdate - Create a outbound firewall rule with a given name. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-02-01-preview -func (client *OutboundFirewallRulesClient) createOrUpdate(ctx context.Context, resourceGroupName string, serverName string, outboundRuleFqdn string, parameters OutboundFirewallRule, options *OutboundFirewallRulesClientBeginCreateOrUpdateOptions) (*http.Response, error) { - req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, serverName, outboundRuleFqdn, parameters, options) +// Generated from API version 2022-11-01-preview +func (client *OutboundFirewallRulesClient) createOrUpdate(ctx context.Context, resourceGroupName string, serverName string, outboundRuleFqdn string, options *OutboundFirewallRulesClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, serverName, outboundRuleFqdn, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *OutboundFirewallRulesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, serverName string, outboundRuleFqdn string, parameters OutboundFirewallRule, options *OutboundFirewallRulesClientBeginCreateOrUpdateOptions) (*policy.Request, error) { +func (client *OutboundFirewallRulesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, serverName string, outboundRuleFqdn string, options *OutboundFirewallRulesClientBeginCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/outboundFirewallRules/{outboundRuleFqdn}" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -108,16 +110,16 @@ func (client *OutboundFirewallRulesClient) createOrUpdateCreateRequest(ctx conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-02-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + return req, nil } // BeginDelete - Deletes a outbound firewall rule with a given name. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-02-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -129,7 +131,8 @@ func (client *OutboundFirewallRulesClient) BeginDelete(ctx context.Context, reso if err != nil { return nil, err } - return runtime.NewPoller[OutboundFirewallRulesClientDeleteResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[OutboundFirewallRulesClientDeleteResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[OutboundFirewallRulesClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -138,20 +141,22 @@ func (client *OutboundFirewallRulesClient) BeginDelete(ctx context.Context, reso // Delete - Deletes a outbound firewall rule with a given name. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-02-01-preview +// Generated from API version 2022-11-01-preview func (client *OutboundFirewallRulesClient) deleteOperation(ctx context.Context, resourceGroupName string, serverName string, outboundRuleFqdn string, options *OutboundFirewallRulesClientBeginDeleteOptions) (*http.Response, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, serverName, outboundRuleFqdn, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteCreateRequest creates the Delete request. @@ -178,7 +183,7 @@ func (client *OutboundFirewallRulesClient) deleteCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-02-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -186,25 +191,28 @@ func (client *OutboundFirewallRulesClient) deleteCreateRequest(ctx context.Conte // Get - Gets an outbound firewall rule. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-02-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. // - options - OutboundFirewallRulesClientGetOptions contains the optional parameters for the OutboundFirewallRulesClient.Get // method. func (client *OutboundFirewallRulesClient) Get(ctx context.Context, resourceGroupName string, serverName string, outboundRuleFqdn string, options *OutboundFirewallRulesClientGetOptions) (OutboundFirewallRulesClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, serverName, outboundRuleFqdn, options) if err != nil { return OutboundFirewallRulesClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return OutboundFirewallRulesClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return OutboundFirewallRulesClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return OutboundFirewallRulesClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -231,7 +239,7 @@ func (client *OutboundFirewallRulesClient) getCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-02-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -248,7 +256,7 @@ func (client *OutboundFirewallRulesClient) getHandleResponse(resp *http.Response // NewListByServerPager - Gets all outbound firewall rules on a server. // -// Generated from API version 2021-02-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -302,7 +310,7 @@ func (client *OutboundFirewallRulesClient) listByServerCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-02-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/sql/armsql/outboundfirewallrules_client_example_test.go b/sdk/resourcemanager/sql/armsql/outboundfirewallrules_client_example_test.go deleted file mode 100644 index 6d1f4e1d9aaf..000000000000 --- a/sdk/resourcemanager/sql/armsql/outboundfirewallrules_client_example_test.go +++ /dev/null @@ -1,143 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsql_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sql/armsql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/OutboundFirewallRuleGet.json -func ExampleOutboundFirewallRulesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewOutboundFirewallRulesClient().Get(ctx, "sqlcrudtest-7398", "sqlcrudtest-4645", "server.database.windows.net", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.OutboundFirewallRule = armsql.OutboundFirewallRule{ - // Name: to.Ptr("server.database.windows.net"), - // Type: to.Ptr("Microsoft.Sql/servers/outboundFirewallRules"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/sqlcrudtest-7398/providers/Microsoft.Sql/servers/sqlcrudtest-4645/outboundFirewallRules/server.datbase.windows.net"), - // Properties: &armsql.OutboundFirewallRuleProperties{ - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/OutboundFirewallRuleCreate.json -func ExampleOutboundFirewallRulesClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewOutboundFirewallRulesClient().BeginCreateOrUpdate(ctx, "sqlcrudtest-7398", "sqlcrudtest-4645", "server.database.windows.net", armsql.OutboundFirewallRule{}, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.OutboundFirewallRule = armsql.OutboundFirewallRule{ - // Name: to.Ptr("server.database.windows.net"), - // Type: to.Ptr("Microsoft.Sql/servers/outboundFirewallRules"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/sqlcrudtest-7398/providers/Microsoft.Sql/servers/sqlcrudtest-4645/outboundFirewallRules/server.datbase.windows.net"), - // Properties: &armsql.OutboundFirewallRuleProperties{ - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/OutboundFirewallRuleDelete.json -func ExampleOutboundFirewallRulesClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewOutboundFirewallRulesClient().BeginDelete(ctx, "sqlcrudtest-7398", "sqlcrudtest-6661", "server.database.windows.net", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/OutboundFirewallRuleList.json -func ExampleOutboundFirewallRulesClient_NewListByServerPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewOutboundFirewallRulesClient().NewListByServerPager("sqlcrudtest-7398", "sqlcrudtest-4645", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.OutboundFirewallRuleListResult = armsql.OutboundFirewallRuleListResult{ - // Value: []*armsql.OutboundFirewallRule{ - // { - // Name: to.Ptr("server.database.windows.net"), - // Type: to.Ptr("Microsoft.Sql/servers/outboundFirewallRules"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/sqlcrudtest-7398/providers/Microsoft.Sql/servers/sqlcrudtest-4645/outboundFirewallRules/server.datbase.windows.net"), - // Properties: &armsql.OutboundFirewallRuleProperties{ - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // }, - // { - // Name: to.Ptr("storage.blob.windows.net"), - // Type: to.Ptr("Microsoft.Sql/servers/outboundFirewallRules"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/sqlcrudtest-7398/providers/Microsoft.Sql/servers/sqlcrudtest-4645/outboundFirewallRules/storage.blob.windows.net"), - // Properties: &armsql.OutboundFirewallRuleProperties{ - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/sql/armsql/privateendpointconnections_client.go b/sdk/resourcemanager/sql/armsql/privateendpointconnections_client.go index 7273c297734c..a292d7626d7d 100644 --- a/sdk/resourcemanager/sql/armsql/privateendpointconnections_client.go +++ b/sdk/resourcemanager/sql/armsql/privateendpointconnections_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armsql @@ -47,7 +46,7 @@ func NewPrivateEndpointConnectionsClient(subscriptionID string, credential azcor // BeginCreateOrUpdate - Approve or reject a private endpoint connection with a given name. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -59,7 +58,8 @@ func (client *PrivateEndpointConnectionsClient) BeginCreateOrUpdate(ctx context. if err != nil { return nil, err } - return runtime.NewPoller[PrivateEndpointConnectionsClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[PrivateEndpointConnectionsClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[PrivateEndpointConnectionsClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -68,20 +68,22 @@ func (client *PrivateEndpointConnectionsClient) BeginCreateOrUpdate(ctx context. // CreateOrUpdate - Approve or reject a private endpoint connection with a given name. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview func (client *PrivateEndpointConnectionsClient) createOrUpdate(ctx context.Context, resourceGroupName string, serverName string, privateEndpointConnectionName string, parameters PrivateEndpointConnection, options *PrivateEndpointConnectionsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, serverName, privateEndpointConnectionName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createOrUpdateCreateRequest creates the CreateOrUpdate request. @@ -108,16 +110,19 @@ func (client *PrivateEndpointConnectionsClient) createOrUpdateCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // BeginDelete - Deletes a private endpoint connection with a given name. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -129,7 +134,8 @@ func (client *PrivateEndpointConnectionsClient) BeginDelete(ctx context.Context, if err != nil { return nil, err } - return runtime.NewPoller[PrivateEndpointConnectionsClientDeleteResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[PrivateEndpointConnectionsClientDeleteResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[PrivateEndpointConnectionsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -138,20 +144,22 @@ func (client *PrivateEndpointConnectionsClient) BeginDelete(ctx context.Context, // Delete - Deletes a private endpoint connection with a given name. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview func (client *PrivateEndpointConnectionsClient) deleteOperation(ctx context.Context, resourceGroupName string, serverName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientBeginDeleteOptions) (*http.Response, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, serverName, privateEndpointConnectionName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteCreateRequest creates the Delete request. @@ -178,7 +186,7 @@ func (client *PrivateEndpointConnectionsClient) deleteCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -186,7 +194,7 @@ func (client *PrivateEndpointConnectionsClient) deleteCreateRequest(ctx context. // Get - Gets a private endpoint connection. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -194,18 +202,21 @@ func (client *PrivateEndpointConnectionsClient) deleteCreateRequest(ctx context. // - options - PrivateEndpointConnectionsClientGetOptions contains the optional parameters for the PrivateEndpointConnectionsClient.Get // method. func (client *PrivateEndpointConnectionsClient) Get(ctx context.Context, resourceGroupName string, serverName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientGetOptions) (PrivateEndpointConnectionsClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, serverName, privateEndpointConnectionName, options) if err != nil { return PrivateEndpointConnectionsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return PrivateEndpointConnectionsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return PrivateEndpointConnectionsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return PrivateEndpointConnectionsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -232,7 +243,7 @@ func (client *PrivateEndpointConnectionsClient) getCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -249,7 +260,7 @@ func (client *PrivateEndpointConnectionsClient) getHandleResponse(resp *http.Res // NewListByServerPager - Gets all private endpoint connections on a server. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -303,7 +314,7 @@ func (client *PrivateEndpointConnectionsClient) listByServerCreateRequest(ctx co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/sql/armsql/privateendpointconnections_client_example_test.go b/sdk/resourcemanager/sql/armsql/privateendpointconnections_client_example_test.go deleted file mode 100644 index 996072745da9..000000000000 --- a/sdk/resourcemanager/sql/armsql/privateendpointconnections_client_example_test.go +++ /dev/null @@ -1,183 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsql_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sql/armsql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/PrivateEndpointConnectionGet.json -func ExamplePrivateEndpointConnectionsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPrivateEndpointConnectionsClient().Get(ctx, "Default", "test-svr", "private-endpoint-connection-name", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.PrivateEndpointConnection = armsql.PrivateEndpointConnection{ - // Name: to.Ptr("private-endpoint-connection-name"), - // Type: to.Ptr("Microsoft.Sql/servers/privateEndpointConnections"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/servers/test-svr/privateEndpointConnections/private-endpoint-connection-name"), - // Properties: &armsql.PrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armsql.PrivateEndpointProperty{ - // ID: to.Ptr("/subscriptions/55555555-6666-7777-8888-999999999999/resourceGroups/Default-Network/providers/Microsoft.Network/privateEndpoints/private-endpoint-name"), - // }, - // PrivateLinkServiceConnectionState: &armsql.PrivateLinkServiceConnectionStateProperty{ - // Description: to.Ptr("Auto-approved"), - // ActionsRequired: to.Ptr(armsql.PrivateLinkServiceConnectionStateActionsRequireNone), - // Status: to.Ptr(armsql.PrivateLinkServiceConnectionStateStatusApproved), - // }, - // ProvisioningState: to.Ptr(armsql.PrivateEndpointProvisioningState("Succeeded")), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/PrivateEndpointConnectionUpdate.json -func ExamplePrivateEndpointConnectionsClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewPrivateEndpointConnectionsClient().BeginCreateOrUpdate(ctx, "Default", "test-svr", "private-endpoint-connection-name", armsql.PrivateEndpointConnection{ - Properties: &armsql.PrivateEndpointConnectionProperties{ - PrivateLinkServiceConnectionState: &armsql.PrivateLinkServiceConnectionStateProperty{ - Description: to.Ptr("Approved by johndoe@contoso.com"), - Status: to.Ptr(armsql.PrivateLinkServiceConnectionStateStatusApproved), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.PrivateEndpointConnection = armsql.PrivateEndpointConnection{ - // Name: to.Ptr("private-endpoint-connection-name"), - // Type: to.Ptr("Microsoft.Sql/servers/privateEndpointConnections"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/servers/test-svr/privateEndpointConnections/private-endpoint-connection-name"), - // Properties: &armsql.PrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armsql.PrivateEndpointProperty{ - // ID: to.Ptr("/subscriptions/55555555-6666-7777-8888-999999999999/resourceGroups/Default-Network/providers/Microsoft.Network/privateEndpoints/private-endpoint-name"), - // }, - // PrivateLinkServiceConnectionState: &armsql.PrivateLinkServiceConnectionStateProperty{ - // Description: to.Ptr("Approved by johndoe@contoso.com"), - // ActionsRequired: to.Ptr(armsql.PrivateLinkServiceConnectionStateActionsRequireNone), - // Status: to.Ptr(armsql.PrivateLinkServiceConnectionStateStatusApproved), - // }, - // ProvisioningState: to.Ptr(armsql.PrivateEndpointProvisioningState("Succeeded")), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/PrivateEndpointConnectionDelete.json -func ExamplePrivateEndpointConnectionsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewPrivateEndpointConnectionsClient().BeginDelete(ctx, "Default", "test-svr", "private-endpoint-connection-name", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/PrivateEndpointConnectionList.json -func ExamplePrivateEndpointConnectionsClient_NewListByServerPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewPrivateEndpointConnectionsClient().NewListByServerPager("Default", "test-svr", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.PrivateEndpointConnectionListResult = armsql.PrivateEndpointConnectionListResult{ - // Value: []*armsql.PrivateEndpointConnection{ - // { - // Name: to.Ptr("private-endpoint-connection-name"), - // Type: to.Ptr("Microsoft.Sql/servers/privateEndpointConnections"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/servers/test-svr/privateEndpointConnections/private-endpoint-connection-name-2"), - // Properties: &armsql.PrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armsql.PrivateEndpointProperty{ - // ID: to.Ptr("/subscriptions/55555555-6666-7777-8888-999999999999/resourceGroups/Default-Network/providers/Microsoft.Network/privateEndpoints/private-endpoint-name"), - // }, - // PrivateLinkServiceConnectionState: &armsql.PrivateLinkServiceConnectionStateProperty{ - // Description: to.Ptr("Auto-approved"), - // ActionsRequired: to.Ptr(armsql.PrivateLinkServiceConnectionStateActionsRequireNone), - // Status: to.Ptr(armsql.PrivateLinkServiceConnectionStateStatusApproved), - // }, - // ProvisioningState: to.Ptr(armsql.PrivateEndpointProvisioningState("Succeeded")), - // }, - // }, - // { - // Name: to.Ptr("private-endpoint-connection-name-2"), - // Type: to.Ptr("Microsoft.Sql/servers/privateEndpointConnections"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/servers/test-svr/privateEndpointConnections/private-endpoint-connection-name-2"), - // Properties: &armsql.PrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armsql.PrivateEndpointProperty{ - // ID: to.Ptr("/subscriptions/55555555-6666-7777-8888-999999999999/resourceGroups/Default-Network/providers/Microsoft.Network/privateEndpoints/private-endpoint-name-2"), - // }, - // PrivateLinkServiceConnectionState: &armsql.PrivateLinkServiceConnectionStateProperty{ - // Description: to.Ptr("Auto-approved"), - // ActionsRequired: to.Ptr(armsql.PrivateLinkServiceConnectionStateActionsRequireNone), - // Status: to.Ptr(armsql.PrivateLinkServiceConnectionStateStatusApproved), - // }, - // ProvisioningState: to.Ptr(armsql.PrivateEndpointProvisioningState("Succeeded")), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/sql/armsql/privatelinkresources_client.go b/sdk/resourcemanager/sql/armsql/privatelinkresources_client.go index 5f188202479f..06e85df582c5 100644 --- a/sdk/resourcemanager/sql/armsql/privatelinkresources_client.go +++ b/sdk/resourcemanager/sql/armsql/privatelinkresources_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armsql @@ -47,7 +46,7 @@ func NewPrivateLinkResourcesClient(subscriptionID string, credential azcore.Toke // Get - Gets a private link resource for SQL server. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -55,18 +54,21 @@ func NewPrivateLinkResourcesClient(subscriptionID string, credential azcore.Toke // - options - PrivateLinkResourcesClientGetOptions contains the optional parameters for the PrivateLinkResourcesClient.Get // method. func (client *PrivateLinkResourcesClient) Get(ctx context.Context, resourceGroupName string, serverName string, groupName string, options *PrivateLinkResourcesClientGetOptions) (PrivateLinkResourcesClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, serverName, groupName, options) if err != nil { return PrivateLinkResourcesClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return PrivateLinkResourcesClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return PrivateLinkResourcesClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return PrivateLinkResourcesClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -93,7 +95,7 @@ func (client *PrivateLinkResourcesClient) getCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -110,7 +112,7 @@ func (client *PrivateLinkResourcesClient) getHandleResponse(resp *http.Response) // NewListByServerPager - Gets the private link resources for SQL server. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -164,7 +166,7 @@ func (client *PrivateLinkResourcesClient) listByServerCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/sql/armsql/privatelinkresources_client_example_test.go b/sdk/resourcemanager/sql/armsql/privatelinkresources_client_example_test.go deleted file mode 100644 index 9a9cbdf0478a..000000000000 --- a/sdk/resourcemanager/sql/armsql/privatelinkresources_client_example_test.go +++ /dev/null @@ -1,86 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsql_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sql/armsql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/PrivateLinkResourcesList.json -func ExamplePrivateLinkResourcesClient_NewListByServerPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewPrivateLinkResourcesClient().NewListByServerPager("Default", "test-svr", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.PrivateLinkResourceListResult = armsql.PrivateLinkResourceListResult{ - // Value: []*armsql.PrivateLinkResource{ - // { - // Name: to.Ptr("plr"), - // Type: to.Ptr("Microsoft.Sql/servers/privateLinkResources"), - // ID: to.Ptr("subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/servers/test-svr/privateLinkResources/plr"), - // Properties: &armsql.PrivateLinkResourceProperties{ - // GroupID: to.Ptr("sqlServer"), - // RequiredMembers: []*string{ - // to.Ptr("sqlServer")}, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/PrivateLinkResourcesGet.json -func ExamplePrivateLinkResourcesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPrivateLinkResourcesClient().Get(ctx, "Default", "test-svr", "plr", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.PrivateLinkResource = armsql.PrivateLinkResource{ - // Name: to.Ptr("plr"), - // Type: to.Ptr("Microsoft.Sql/servers/privateLinkResources"), - // ID: to.Ptr("subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/servers/test-svr/privateLinkResources/plr"), - // Properties: &armsql.PrivateLinkResourceProperties{ - // GroupID: to.Ptr("sqlServer"), - // RequiredMembers: []*string{ - // to.Ptr("sqlServer")}, - // }, - // } -} diff --git a/sdk/resourcemanager/sql/armsql/recommendedsensitivitylabels_client.go b/sdk/resourcemanager/sql/armsql/recommendedsensitivitylabels_client.go index 3fc74b9745a3..b376c79d8f0a 100644 --- a/sdk/resourcemanager/sql/armsql/recommendedsensitivitylabels_client.go +++ b/sdk/resourcemanager/sql/armsql/recommendedsensitivitylabels_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armsql @@ -47,7 +46,7 @@ func NewRecommendedSensitivityLabelsClient(subscriptionID string, credential azc // Update - Update recommended sensitivity labels states of a given database using an operations batch. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -55,16 +54,18 @@ func NewRecommendedSensitivityLabelsClient(subscriptionID string, credential azc // - options - RecommendedSensitivityLabelsClientUpdateOptions contains the optional parameters for the RecommendedSensitivityLabelsClient.Update // method. func (client *RecommendedSensitivityLabelsClient) Update(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters RecommendedSensitivityLabelUpdateList, options *RecommendedSensitivityLabelsClientUpdateOptions) (RecommendedSensitivityLabelsClientUpdateResponse, error) { + var err error req, err := client.updateCreateRequest(ctx, resourceGroupName, serverName, databaseName, parameters, options) if err != nil { return RecommendedSensitivityLabelsClientUpdateResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return RecommendedSensitivityLabelsClientUpdateResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return RecommendedSensitivityLabelsClientUpdateResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return RecommendedSensitivityLabelsClientUpdateResponse{}, err } return RecommendedSensitivityLabelsClientUpdateResponse{}, nil } @@ -93,7 +94,10 @@ func (client *RecommendedSensitivityLabelsClient) updateCreateRequest(ctx contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } diff --git a/sdk/resourcemanager/sql/armsql/recommendedsensitivitylabels_client_example_test.go b/sdk/resourcemanager/sql/armsql/recommendedsensitivitylabels_client_example_test.go deleted file mode 100644 index a0c43549445b..000000000000 --- a/sdk/resourcemanager/sql/armsql/recommendedsensitivitylabels_client_example_test.go +++ /dev/null @@ -1,62 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsql_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sql/armsql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SensitivityLabelsRecommendedUpdate.json -func ExampleRecommendedSensitivityLabelsClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewRecommendedSensitivityLabelsClient().Update(ctx, "myRG", "myServer", "myDatabase", armsql.RecommendedSensitivityLabelUpdateList{ - Operations: []*armsql.RecommendedSensitivityLabelUpdate{ - { - Properties: &armsql.RecommendedSensitivityLabelUpdateProperties{ - Schema: to.Ptr("dbo"), - Column: to.Ptr("column1"), - Op: to.Ptr(armsql.RecommendedSensitivityLabelUpdateKindEnable), - Table: to.Ptr("table1"), - }, - }, - { - Properties: &armsql.RecommendedSensitivityLabelUpdateProperties{ - Schema: to.Ptr("dbo"), - Column: to.Ptr("column2"), - Op: to.Ptr(armsql.RecommendedSensitivityLabelUpdateKindEnable), - Table: to.Ptr("table2"), - }, - }, - { - Properties: &armsql.RecommendedSensitivityLabelUpdateProperties{ - Schema: to.Ptr("dbo"), - Column: to.Ptr("column3"), - Op: to.Ptr(armsql.RecommendedSensitivityLabelUpdateKindDisable), - Table: to.Ptr("table1"), - }, - }}, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/sql/armsql/recoverabledatabases_client.go b/sdk/resourcemanager/sql/armsql/recoverabledatabases_client.go index c9d7c4d41d87..b745884e979c 100644 --- a/sdk/resourcemanager/sql/armsql/recoverabledatabases_client.go +++ b/sdk/resourcemanager/sql/armsql/recoverabledatabases_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armsql @@ -44,38 +43,37 @@ func NewRecoverableDatabasesClient(subscriptionID string, credential azcore.Toke return client, nil } -// Get - Gets a recoverable database, which is a resource representing a database's geo backup +// Get - Gets a recoverable database. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2014-04-01 +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. -// - databaseName - The name of the database +// - databaseName - The name of the database. // - options - RecoverableDatabasesClientGetOptions contains the optional parameters for the RecoverableDatabasesClient.Get // method. func (client *RecoverableDatabasesClient) Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string, options *RecoverableDatabasesClientGetOptions) (RecoverableDatabasesClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, serverName, databaseName, options) if err != nil { return RecoverableDatabasesClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return RecoverableDatabasesClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return RecoverableDatabasesClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return RecoverableDatabasesClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. func (client *RecoverableDatabasesClient) getCreateRequest(ctx context.Context, resourceGroupName string, serverName string, databaseName string, options *RecoverableDatabasesClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/recoverableDatabases/{databaseName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") } @@ -88,12 +86,22 @@ func (client *RecoverableDatabasesClient) getCreateRequest(ctx context.Context, return nil, errors.New("parameter databaseName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{databaseName}", url.PathEscape(databaseName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2014-04-01") + if options != nil && options.Expand != nil { + reqQP.Set("$expand", *options.Expand) + } + if options != nil && options.Filter != nil { + reqQP.Set("$filter", *options.Filter) + } + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -108,9 +116,9 @@ func (client *RecoverableDatabasesClient) getHandleResponse(resp *http.Response) return result, nil } -// NewListByServerPager - Gets a list of recoverable databases +// NewListByServerPager - Gets a list of recoverable databases. // -// Generated from API version 2014-04-01 +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -119,10 +127,16 @@ func (client *RecoverableDatabasesClient) getHandleResponse(resp *http.Response) func (client *RecoverableDatabasesClient) NewListByServerPager(resourceGroupName string, serverName string, options *RecoverableDatabasesClientListByServerOptions) *runtime.Pager[RecoverableDatabasesClientListByServerResponse] { return runtime.NewPager(runtime.PagingHandler[RecoverableDatabasesClientListByServerResponse]{ More: func(page RecoverableDatabasesClientListByServerResponse) bool { - return false + return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *RecoverableDatabasesClientListByServerResponse) (RecoverableDatabasesClientListByServerResponse, error) { - req, err := client.listByServerCreateRequest(ctx, resourceGroupName, serverName, options) + var req *policy.Request + var err error + if page == nil { + req, err = client.listByServerCreateRequest(ctx, resourceGroupName, serverName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } if err != nil { return RecoverableDatabasesClientListByServerResponse{}, err } @@ -141,10 +155,6 @@ func (client *RecoverableDatabasesClient) NewListByServerPager(resourceGroupName // listByServerCreateRequest creates the ListByServer request. func (client *RecoverableDatabasesClient) listByServerCreateRequest(ctx context.Context, resourceGroupName string, serverName string, options *RecoverableDatabasesClientListByServerOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/recoverableDatabases" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") } @@ -153,12 +163,16 @@ func (client *RecoverableDatabasesClient) listByServerCreateRequest(ctx context. return nil, errors.New("parameter serverName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{serverName}", url.PathEscape(serverName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2014-04-01") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/sql/armsql/recoverabledatabases_client_example_test.go b/sdk/resourcemanager/sql/armsql/recoverabledatabases_client_example_test.go deleted file mode 100644 index 43afa4d9c7e6..000000000000 --- a/sdk/resourcemanager/sql/armsql/recoverabledatabases_client_example_test.go +++ /dev/null @@ -1,106 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsql_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sql/armsql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/stable/2014-04-01-legacy/examples/RecoverableDatabaseGet.json -func ExampleRecoverableDatabasesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewRecoverableDatabasesClient().Get(ctx, "recoverabledatabasetest-6852", "recoverabledatabasetest-2080", "recoverabledatabasetest-9187", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RecoverableDatabase = armsql.RecoverableDatabase{ - // Name: to.Ptr("recoverabledatabasetest-9187"), - // Type: to.Ptr("Microsoft.Sql/servers/recoverabledatabases"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/recoverabledatabasetest-6852/providers/Microsoft.Sql/servers/recoverabledatabasetest-2080/recoverabledatabases/recoverabledatabasetest-9187"), - // Properties: &armsql.RecoverableDatabaseProperties{ - // Edition: to.Ptr("Basic"), - // LastAvailableBackupDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-05-26T01:06:29.78Z"); return t}()), - // ServiceLevelObjective: to.Ptr("Basic"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/stable/2014-04-01-legacy/examples/RecoverableDatabaseList.json -func ExampleRecoverableDatabasesClient_NewListByServerPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewRecoverableDatabasesClient().NewListByServerPager("recoverabledatabasetest-1234", "recoverabledatabasetest-7177", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.RecoverableDatabaseListResult = armsql.RecoverableDatabaseListResult{ - // Value: []*armsql.RecoverableDatabase{ - // { - // Name: to.Ptr("recoverabledatabasetest-1235"), - // Type: to.Ptr("Microsoft.Sql/servers/recoverabledatabases"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/recoverabledatabasetest-1234/providers/Microsoft.Sql/servers/recoverabledatabasetest-7177/recoverabledatabases/recoverabledatabasetest-1235"), - // Properties: &armsql.RecoverableDatabaseProperties{ - // Edition: to.Ptr("Standard"), - // LastAvailableBackupDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-05-26T01:06:29.78Z"); return t}()), - // ServiceLevelObjective: to.Ptr("S0"), - // }, - // }, - // { - // Name: to.Ptr("recoverabledatabasetest-9231"), - // Type: to.Ptr("Microsoft.Sql/servers/recoverabledatabases"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/recoverabledatabasetest-1234/providers/Microsoft.Sql/servers/recoverabledatabasetest-7177/recoverabledatabases/recoverabledatabasetest-9231"), - // Properties: &armsql.RecoverableDatabaseProperties{ - // Edition: to.Ptr("Premium"), - // LastAvailableBackupDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-05-26T03:20:31.78Z"); return t}()), - // ServiceLevelObjective: to.Ptr("P1"), - // }, - // }, - // { - // Name: to.Ptr("recoverabledatabasetest-0342"), - // Type: to.Ptr("Microsoft.Sql/servers/recoverabledatabases"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/recoverabledatabasetest-1234/providers/Microsoft.Sql/servers/recoverabledatabasetest-7177/recoverabledatabases/recoverabledatabasetest-0342"), - // Properties: &armsql.RecoverableDatabaseProperties{ - // Edition: to.Ptr("Basic"), - // LastAvailableBackupDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-05-24T02:06:18.78Z"); return t}()), - // ServiceLevelObjective: to.Ptr("Basic"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/sql/armsql/recoverablemanageddatabases_client.go b/sdk/resourcemanager/sql/armsql/recoverablemanageddatabases_client.go index 5dc1a6867846..a91351cb4e19 100644 --- a/sdk/resourcemanager/sql/armsql/recoverablemanageddatabases_client.go +++ b/sdk/resourcemanager/sql/armsql/recoverablemanageddatabases_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armsql @@ -47,25 +46,28 @@ func NewRecoverableManagedDatabasesClient(subscriptionID string, credential azco // Get - Gets a recoverable managed database. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - managedInstanceName - The name of the managed instance. // - options - RecoverableManagedDatabasesClientGetOptions contains the optional parameters for the RecoverableManagedDatabasesClient.Get // method. func (client *RecoverableManagedDatabasesClient) Get(ctx context.Context, resourceGroupName string, managedInstanceName string, recoverableDatabaseName string, options *RecoverableManagedDatabasesClientGetOptions) (RecoverableManagedDatabasesClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, managedInstanceName, recoverableDatabaseName, options) if err != nil { return RecoverableManagedDatabasesClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return RecoverableManagedDatabasesClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return RecoverableManagedDatabasesClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return RecoverableManagedDatabasesClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -92,7 +94,7 @@ func (client *RecoverableManagedDatabasesClient) getCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -109,7 +111,7 @@ func (client *RecoverableManagedDatabasesClient) getHandleResponse(resp *http.Re // NewListByInstancePager - Gets a list of recoverable managed databases. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - managedInstanceName - The name of the managed instance. @@ -163,7 +165,7 @@ func (client *RecoverableManagedDatabasesClient) listByInstanceCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/sql/armsql/recoverablemanageddatabases_client_example_test.go b/sdk/resourcemanager/sql/armsql/recoverablemanageddatabases_client_example_test.go deleted file mode 100644 index 28e21010fbf4..000000000000 --- a/sdk/resourcemanager/sql/armsql/recoverablemanageddatabases_client_example_test.go +++ /dev/null @@ -1,90 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsql_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sql/armsql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ListRecoverableManagedDatabasesByServer.json -func ExampleRecoverableManagedDatabasesClient_NewListByInstancePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewRecoverableManagedDatabasesClient().NewListByInstancePager("Test1", "managedInstance", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.RecoverableManagedDatabaseListResult = armsql.RecoverableManagedDatabaseListResult{ - // Value: []*armsql.RecoverableManagedDatabase{ - // { - // Name: to.Ptr("testdb"), - // Type: to.Ptr("Microsoft.Sql/managedInstances/recoverableDaatabases"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/managedInstances/testsvr/recoverableDaatabases/testdb"), - // Properties: &armsql.RecoverableManagedDatabaseProperties{ - // LastAvailableBackupDate: to.Ptr("2017-05-26T01:06:29.78Z"), - // }, - // }, - // { - // Name: to.Ptr("testdb2"), - // Type: to.Ptr("Microsoft.Sql/managedInstances/recoverableDaatabases"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/managedInstances/testsvr/recoverableDaatabases/testdb2"), - // Properties: &armsql.RecoverableManagedDatabaseProperties{ - // LastAvailableBackupDate: to.Ptr("2018-04-26T02:17:23.44Z"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/GetRecoverableManagedDatabase.json -func ExampleRecoverableManagedDatabasesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewRecoverableManagedDatabasesClient().Get(ctx, "Test1", "managedInstance", "testdb", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RecoverableManagedDatabase = armsql.RecoverableManagedDatabase{ - // Name: to.Ptr("testdb"), - // Type: to.Ptr("Microsoft.Sql/managedInstances/recoverableDatabases"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/managedInstances/testsvr/recoverableDatabases/testdb"), - // Properties: &armsql.RecoverableManagedDatabaseProperties{ - // LastAvailableBackupDate: to.Ptr("2017-05-26T01:06:29.78Z"), - // }, - // } -} diff --git a/sdk/resourcemanager/sql/armsql/replicationlinks_client.go b/sdk/resourcemanager/sql/armsql/replicationlinks_client.go index 87e24cf4408c..fce04e21b3df 100644 --- a/sdk/resourcemanager/sql/armsql/replicationlinks_client.go +++ b/sdk/resourcemanager/sql/armsql/replicationlinks_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armsql @@ -44,32 +43,52 @@ func NewReplicationLinksClient(subscriptionID string, credential azcore.TokenCre return client, nil } -// Delete - Deletes the replication link. +// BeginDelete - Deletes the replication link. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. // - databaseName - The name of the database. -// - options - ReplicationLinksClientDeleteOptions contains the optional parameters for the ReplicationLinksClient.Delete method. -func (client *ReplicationLinksClient) Delete(ctx context.Context, resourceGroupName string, serverName string, databaseName string, linkID string, options *ReplicationLinksClientDeleteOptions) (ReplicationLinksClientDeleteResponse, error) { +// - options - ReplicationLinksClientBeginDeleteOptions contains the optional parameters for the ReplicationLinksClient.BeginDelete +// method. +func (client *ReplicationLinksClient) BeginDelete(ctx context.Context, resourceGroupName string, serverName string, databaseName string, linkID string, options *ReplicationLinksClientBeginDeleteOptions) (*runtime.Poller[ReplicationLinksClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, serverName, databaseName, linkID, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller[ReplicationLinksClientDeleteResponse](resp, client.internal.Pipeline(), nil) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[ReplicationLinksClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Delete - Deletes the replication link. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-11-01-preview +func (client *ReplicationLinksClient) deleteOperation(ctx context.Context, resourceGroupName string, serverName string, databaseName string, linkID string, options *ReplicationLinksClientBeginDeleteOptions) (*http.Response, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, serverName, databaseName, linkID, options) if err != nil { - return ReplicationLinksClientDeleteResponse{}, err + return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { - return ReplicationLinksClientDeleteResponse{}, err + return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ReplicationLinksClientDeleteResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return ReplicationLinksClientDeleteResponse{}, nil + return httpResp, nil } // deleteCreateRequest creates the Delete request. -func (client *ReplicationLinksClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, serverName string, databaseName string, linkID string, options *ReplicationLinksClientDeleteOptions) (*policy.Request, error) { +func (client *ReplicationLinksClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, serverName string, databaseName string, linkID string, options *ReplicationLinksClientBeginDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/replicationLinks/{linkId}" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -96,7 +115,7 @@ func (client *ReplicationLinksClient) deleteCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -104,7 +123,7 @@ func (client *ReplicationLinksClient) deleteCreateRequest(ctx context.Context, r // BeginFailover - Fails over from the current primary server to this server. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -118,7 +137,8 @@ func (client *ReplicationLinksClient) BeginFailover(ctx context.Context, resourc if err != nil { return nil, err } - return runtime.NewPoller[ReplicationLinksClientFailoverResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[ReplicationLinksClientFailoverResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[ReplicationLinksClientFailoverResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -127,20 +147,22 @@ func (client *ReplicationLinksClient) BeginFailover(ctx context.Context, resourc // Failover - Fails over from the current primary server to this server. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-11-01-preview +// Generated from API version 2022-11-01-preview func (client *ReplicationLinksClient) failover(ctx context.Context, resourceGroupName string, serverName string, databaseName string, linkID string, options *ReplicationLinksClientBeginFailoverOptions) (*http.Response, error) { + var err error req, err := client.failoverCreateRequest(ctx, resourceGroupName, serverName, databaseName, linkID, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // failoverCreateRequest creates the Failover request. @@ -171,7 +193,7 @@ func (client *ReplicationLinksClient) failoverCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -180,7 +202,7 @@ func (client *ReplicationLinksClient) failoverCreateRequest(ctx context.Context, // BeginFailoverAllowDataLoss - Fails over from the current primary server to this server allowing data loss. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -194,7 +216,8 @@ func (client *ReplicationLinksClient) BeginFailoverAllowDataLoss(ctx context.Con if err != nil { return nil, err } - return runtime.NewPoller[ReplicationLinksClientFailoverAllowDataLossResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[ReplicationLinksClientFailoverAllowDataLossResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[ReplicationLinksClientFailoverAllowDataLossResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -203,20 +226,22 @@ func (client *ReplicationLinksClient) BeginFailoverAllowDataLoss(ctx context.Con // FailoverAllowDataLoss - Fails over from the current primary server to this server allowing data loss. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-11-01-preview +// Generated from API version 2022-11-01-preview func (client *ReplicationLinksClient) failoverAllowDataLoss(ctx context.Context, resourceGroupName string, serverName string, databaseName string, linkID string, options *ReplicationLinksClientBeginFailoverAllowDataLossOptions) (*http.Response, error) { + var err error req, err := client.failoverAllowDataLossCreateRequest(ctx, resourceGroupName, serverName, databaseName, linkID, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // failoverAllowDataLossCreateRequest creates the FailoverAllowDataLoss request. @@ -247,7 +272,7 @@ func (client *ReplicationLinksClient) failoverAllowDataLossCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -256,7 +281,7 @@ func (client *ReplicationLinksClient) failoverAllowDataLossCreateRequest(ctx con // Get - Gets a replication link. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -264,18 +289,21 @@ func (client *ReplicationLinksClient) failoverAllowDataLossCreateRequest(ctx con // - linkID - The name of the replication link. // - options - ReplicationLinksClientGetOptions contains the optional parameters for the ReplicationLinksClient.Get method. func (client *ReplicationLinksClient) Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string, linkID string, options *ReplicationLinksClientGetOptions) (ReplicationLinksClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, serverName, databaseName, linkID, options) if err != nil { return ReplicationLinksClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ReplicationLinksClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ReplicationLinksClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ReplicationLinksClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -306,7 +334,7 @@ func (client *ReplicationLinksClient) getCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -323,7 +351,7 @@ func (client *ReplicationLinksClient) getHandleResponse(resp *http.Response) (Re // NewListByDatabasePager - Gets a list of replication links on database. // -// Generated from API version 2021-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -382,7 +410,7 @@ func (client *ReplicationLinksClient) listByDatabaseCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -399,7 +427,7 @@ func (client *ReplicationLinksClient) listByDatabaseHandleResponse(resp *http.Re // NewListByServerPager - Gets a list of replication links. // -// Generated from API version 2021-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -453,7 +481,7 @@ func (client *ReplicationLinksClient) listByServerCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/sql/armsql/replicationlinks_client_example_test.go b/sdk/resourcemanager/sql/armsql/replicationlinks_client_example_test.go deleted file mode 100644 index 5af2b579e485..000000000000 --- a/sdk/resourcemanager/sql/armsql/replicationlinks_client_example_test.go +++ /dev/null @@ -1,295 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsql_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sql/armsql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/ReplicationLinkListByDatabase.json -func ExampleReplicationLinksClient_NewListByDatabasePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewReplicationLinksClient().NewListByDatabasePager("Default", "sourcesvr", "tetha-db", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ReplicationLinkListResult = armsql.ReplicationLinkListResult{ - // Value: []*armsql.ReplicationLink{ - // { - // Name: to.Ptr("fb92de60-eb87-4a58-b250-3362d0cfdf26"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/servers/sourcesvr/databases/tetha-db/replicationLinks/fb92de60-eb87-4a58-b250-3362d0cfdf26"), - // Properties: &armsql.ReplicationLinkProperties{ - // IsTerminationAllowed: to.Ptr(true), - // LinkType: to.Ptr(armsql.ReplicationLinkTypeGEO), - // PartnerDatabase: to.Ptr("tetha-db"), - // PartnerLocation: to.Ptr("Japan East"), - // PartnerRole: to.Ptr(armsql.ReplicationRoleSecondary), - // PartnerServer: to.Ptr("testsvr"), - // PercentComplete: to.Ptr[int32](100), - // ReplicationMode: to.Ptr("ASYNC"), - // ReplicationState: to.Ptr(armsql.ReplicationStateCATCHUP), - // Role: to.Ptr(armsql.ReplicationRolePrimary), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-06-21T08:11:46.907Z"); return t}()), - // }, - // }, - // { - // Name: to.Ptr("6ad1eefc-18a2-4fcb-94f3-4b654ba788d7"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/servers/sourcesvr/databases/tetha-db/replicationLinks/6ad1eefc-18a2-4fcb-94f3-4b654ba788d7"), - // Properties: &armsql.ReplicationLinkProperties{ - // IsTerminationAllowed: to.Ptr(true), - // LinkType: to.Ptr(armsql.ReplicationLinkTypeGEO), - // PartnerDatabase: to.Ptr("tetha-db"), - // PartnerLocation: to.Ptr("Japan East"), - // PartnerRole: to.Ptr(armsql.ReplicationRoleSecondary), - // PartnerServer: to.Ptr("targetsvr"), - // PercentComplete: to.Ptr[int32](100), - // ReplicationMode: to.Ptr("ASYNC"), - // ReplicationState: to.Ptr(armsql.ReplicationStateCATCHUP), - // Role: to.Ptr(armsql.ReplicationRolePrimary), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-06-21T08:11:34.423Z"); return t}()), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/ReplicationLinkGet.json -func ExampleReplicationLinksClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewReplicationLinksClient().Get(ctx, "Default", "sourcesvr", "gamma-db", "4891ca10-ebd0-47d7-9182-c722651780fb", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ReplicationLink = armsql.ReplicationLink{ - // Name: to.Ptr("4891ca10-ebd0-47d7-9182-c722651780fb"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/servers/sourcesvr/databases/gamma-db/replicationLinks/4891ca10-ebd0-47d7-9182-c722651780fb"), - // Properties: &armsql.ReplicationLinkProperties{ - // IsTerminationAllowed: to.Ptr(true), - // LinkType: to.Ptr(armsql.ReplicationLinkTypeGEO), - // PartnerDatabase: to.Ptr("gamma-db"), - // PartnerLocation: to.Ptr("Japan East"), - // PartnerRole: to.Ptr(armsql.ReplicationRoleSecondary), - // PartnerServer: to.Ptr("testsvr"), - // PercentComplete: to.Ptr[int32](100), - // ReplicationMode: to.Ptr("ASYNC"), - // ReplicationState: to.Ptr(armsql.ReplicationStateCATCHUP), - // Role: to.Ptr(armsql.ReplicationRolePrimary), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-06-21T08:12:43.783Z"); return t}()), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/ReplicationLinkDelete.json -func ExampleReplicationLinksClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewReplicationLinksClient().Delete(ctx, "Default", "sourcesvr", "gamma-db", "4891ca10-ebd0-47d7-9182-c722651780fb", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/ReplicationLinkFailover.json -func ExampleReplicationLinksClient_BeginFailover() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewReplicationLinksClient().BeginFailover(ctx, "Default", "sourcesvr", "gamma-db", "4891ca10-ebd0-47d7-9182-c722651780fb", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ReplicationLink = armsql.ReplicationLink{ - // Name: to.Ptr("4891ca10-ebd0-47d7-9182-c722651780fb"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/servers/sourcesvr/databases/gamma-db/replicationLinks/4891ca10-ebd0-47d7-9182-c722651780fb"), - // Properties: &armsql.ReplicationLinkProperties{ - // IsTerminationAllowed: to.Ptr(true), - // LinkType: to.Ptr(armsql.ReplicationLinkTypeGEO), - // PartnerDatabase: to.Ptr("gamma-db"), - // PartnerLocation: to.Ptr("Japan East"), - // PartnerRole: to.Ptr(armsql.ReplicationRoleSecondary), - // PartnerServer: to.Ptr("testsvr"), - // PercentComplete: to.Ptr[int32](100), - // ReplicationMode: to.Ptr("ASYNC"), - // ReplicationState: to.Ptr(armsql.ReplicationStateCATCHUP), - // Role: to.Ptr(armsql.ReplicationRolePrimary), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-06-21T08:12:43.783Z"); return t}()), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/ReplicationLinkFailoverAllowDataLoss.json -func ExampleReplicationLinksClient_BeginFailoverAllowDataLoss() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewReplicationLinksClient().BeginFailoverAllowDataLoss(ctx, "Default", "sourcesvr", "gamma-db", "4891ca10-ebd0-47d7-9182-c722651780fb", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ReplicationLink = armsql.ReplicationLink{ - // Name: to.Ptr("4891ca10-ebd0-47d7-9182-c722651780fb"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/servers/sourcesvr/databases/gamma-db/replicationLinks/4891ca10-ebd0-47d7-9182-c722651780fb"), - // Properties: &armsql.ReplicationLinkProperties{ - // IsTerminationAllowed: to.Ptr(true), - // LinkType: to.Ptr(armsql.ReplicationLinkTypeGEO), - // PartnerDatabase: to.Ptr("gamma-db"), - // PartnerLocation: to.Ptr("Japan East"), - // PartnerRole: to.Ptr(armsql.ReplicationRoleSecondary), - // PartnerServer: to.Ptr("testsvr"), - // PercentComplete: to.Ptr[int32](100), - // ReplicationMode: to.Ptr("ASYNC"), - // ReplicationState: to.Ptr(armsql.ReplicationStateCATCHUP), - // Role: to.Ptr(armsql.ReplicationRolePrimary), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-06-21T08:12:43.783Z"); return t}()), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/ReplicationLinkListByServer.json -func ExampleReplicationLinksClient_NewListByServerPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewReplicationLinksClient().NewListByServerPager("Default", "sourcesvr", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ReplicationLinkListResult = armsql.ReplicationLinkListResult{ - // Value: []*armsql.ReplicationLink{ - // { - // Name: to.Ptr("fb92de60-eb87-4a58-b250-3362d0cfdf26"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-Onebox/providers/Microsoft.Sql/servers/sourcesvr/databases/tetha-db/replicationLinks/fb92de60-eb87-4a58-b250-3362d0cfdf26"), - // Properties: &armsql.ReplicationLinkProperties{ - // IsTerminationAllowed: to.Ptr(true), - // LinkType: to.Ptr(armsql.ReplicationLinkTypeGEO), - // PartnerDatabase: to.Ptr("tetha-db"), - // PartnerLocation: to.Ptr("Japan East"), - // PartnerRole: to.Ptr(armsql.ReplicationRoleSecondary), - // PartnerServer: to.Ptr("testsvr"), - // PercentComplete: to.Ptr[int32](100), - // ReplicationMode: to.Ptr("ASYNC"), - // ReplicationState: to.Ptr(armsql.ReplicationStateCATCHUP), - // Role: to.Ptr(armsql.ReplicationRolePrimary), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-06-21T08:11:46.907Z"); return t}()), - // }, - // }, - // { - // Name: to.Ptr("6ad1eefc-18a2-4fcb-94f3-4b654ba788d7"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-Onebox/providers/Microsoft.Sql/servers/sourcesvr/databases/tetha-db/replicationLinks/6ad1eefc-18a2-4fcb-94f3-4b654ba788d7"), - // Properties: &armsql.ReplicationLinkProperties{ - // IsTerminationAllowed: to.Ptr(true), - // LinkType: to.Ptr(armsql.ReplicationLinkTypeGEO), - // PartnerDatabase: to.Ptr("tetha-db"), - // PartnerLocation: to.Ptr("Japan East"), - // PartnerRole: to.Ptr(armsql.ReplicationRoleSecondary), - // PartnerServer: to.Ptr("targetsvr"), - // PercentComplete: to.Ptr[int32](100), - // ReplicationMode: to.Ptr("ASYNC"), - // ReplicationState: to.Ptr(armsql.ReplicationStateCATCHUP), - // Role: to.Ptr(armsql.ReplicationRolePrimary), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-06-21T08:11:34.423Z"); return t}()), - // }, - // }, - // { - // Name: to.Ptr("4891ca10-ebd0-47d7-9182-c722651780fb"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-Onebox/providers/Microsoft.Sql/servers/sourcesvr/databases/gamma-db/replicationLinks/4891ca10-ebd0-47d7-9182-c722651780fb"), - // Properties: &armsql.ReplicationLinkProperties{ - // IsTerminationAllowed: to.Ptr(true), - // LinkType: to.Ptr(armsql.ReplicationLinkTypeGEO), - // PartnerDatabase: to.Ptr("gamma-db"), - // PartnerLocation: to.Ptr("Japan East"), - // PartnerRole: to.Ptr(armsql.ReplicationRoleSecondary), - // PartnerServer: to.Ptr("testsvr"), - // PercentComplete: to.Ptr[int32](100), - // ReplicationMode: to.Ptr("ASYNC"), - // ReplicationState: to.Ptr(armsql.ReplicationStateCATCHUP), - // Role: to.Ptr(armsql.ReplicationRolePrimary), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-06-21T08:12:43.783Z"); return t}()), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/sql/armsql/response_types.go b/sdk/resourcemanager/sql/armsql/response_types.go index b48e7f63e374..6fba08ad8843 100644 --- a/sdk/resourcemanager/sql/armsql/response_types.go +++ b/sdk/resourcemanager/sql/armsql/response_types.go @@ -3,94 +3,110 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armsql // AgentClientCreateOrUpdateResponse contains the response from method AgentClient.CreateOrUpdate. type AgentClientCreateOrUpdateResponse struct { + // A recoverable managed database resource. AgentConfiguration } // AgentClientGetResponse contains the response from method AgentClient.Get. type AgentClientGetResponse struct { + // A recoverable managed database resource. AgentConfiguration } // BackupShortTermRetentionPoliciesClientCreateOrUpdateResponse contains the response from method BackupShortTermRetentionPoliciesClient.BeginCreateOrUpdate. type BackupShortTermRetentionPoliciesClientCreateOrUpdateResponse struct { + // A short term retention policy. BackupShortTermRetentionPolicy } // BackupShortTermRetentionPoliciesClientGetResponse contains the response from method BackupShortTermRetentionPoliciesClient.Get. type BackupShortTermRetentionPoliciesClientGetResponse struct { + // A short term retention policy. BackupShortTermRetentionPolicy } // BackupShortTermRetentionPoliciesClientListByDatabaseResponse contains the response from method BackupShortTermRetentionPoliciesClient.NewListByDatabasePager. type BackupShortTermRetentionPoliciesClientListByDatabaseResponse struct { + // A list of short term retention policies. BackupShortTermRetentionPolicyListResult } // BackupShortTermRetentionPoliciesClientUpdateResponse contains the response from method BackupShortTermRetentionPoliciesClient.BeginUpdate. type BackupShortTermRetentionPoliciesClientUpdateResponse struct { + // A short term retention policy. BackupShortTermRetentionPolicy } // CapabilitiesClientListByLocationResponse contains the response from method CapabilitiesClient.ListByLocation. type CapabilitiesClientListByLocationResponse struct { + // The location capability. LocationCapabilities } // DataMaskingPoliciesClientCreateOrUpdateResponse contains the response from method DataMaskingPoliciesClient.CreateOrUpdate. type DataMaskingPoliciesClientCreateOrUpdateResponse struct { + // A database data masking policy. DataMaskingPolicy } // DataMaskingPoliciesClientGetResponse contains the response from method DataMaskingPoliciesClient.Get. type DataMaskingPoliciesClientGetResponse struct { + // A database data masking policy. DataMaskingPolicy } // DataMaskingRulesClientCreateOrUpdateResponse contains the response from method DataMaskingRulesClient.CreateOrUpdate. type DataMaskingRulesClientCreateOrUpdateResponse struct { + // A database data masking rule. DataMaskingRule } // DataMaskingRulesClientListByDatabaseResponse contains the response from method DataMaskingRulesClient.NewListByDatabasePager. type DataMaskingRulesClientListByDatabaseResponse struct { + // The list of database data masking rules. DataMaskingRuleListResult } // DataWarehouseUserActivitiesClientGetResponse contains the response from method DataWarehouseUserActivitiesClient.Get. type DataWarehouseUserActivitiesClientGetResponse struct { + // User activities of a data warehouse DataWarehouseUserActivities } // DataWarehouseUserActivitiesClientListByDatabaseResponse contains the response from method DataWarehouseUserActivitiesClient.NewListByDatabasePager. type DataWarehouseUserActivitiesClientListByDatabaseResponse struct { + // User activities of a data warehouse DataWarehouseUserActivitiesListResult } // DatabaseAdvancedThreatProtectionSettingsClientCreateOrUpdateResponse contains the response from method DatabaseAdvancedThreatProtectionSettingsClient.CreateOrUpdate. type DatabaseAdvancedThreatProtectionSettingsClientCreateOrUpdateResponse struct { + // A database Advanced Threat Protection. DatabaseAdvancedThreatProtection } // DatabaseAdvancedThreatProtectionSettingsClientGetResponse contains the response from method DatabaseAdvancedThreatProtectionSettingsClient.Get. type DatabaseAdvancedThreatProtectionSettingsClientGetResponse struct { + // A database Advanced Threat Protection. DatabaseAdvancedThreatProtection } // DatabaseAdvancedThreatProtectionSettingsClientListByDatabaseResponse contains the response from method DatabaseAdvancedThreatProtectionSettingsClient.NewListByDatabasePager. type DatabaseAdvancedThreatProtectionSettingsClientListByDatabaseResponse struct { + // A list of the database's Advanced Threat Protection configurations. DatabaseAdvancedThreatProtectionListResult } // DatabaseAdvisorsClientGetResponse contains the response from method DatabaseAdvisorsClient.Get. type DatabaseAdvisorsClientGetResponse struct { + // Database, Server or Elastic Pool Advisor. Advisor } @@ -102,51 +118,71 @@ type DatabaseAdvisorsClientListByDatabaseResponse struct { // DatabaseAdvisorsClientUpdateResponse contains the response from method DatabaseAdvisorsClient.Update. type DatabaseAdvisorsClientUpdateResponse struct { + // Database, Server or Elastic Pool Advisor. Advisor } // DatabaseAutomaticTuningClientGetResponse contains the response from method DatabaseAutomaticTuningClient.Get. type DatabaseAutomaticTuningClientGetResponse struct { + // Database-level Automatic Tuning. DatabaseAutomaticTuning } // DatabaseAutomaticTuningClientUpdateResponse contains the response from method DatabaseAutomaticTuningClient.Update. type DatabaseAutomaticTuningClientUpdateResponse struct { + // Database-level Automatic Tuning. DatabaseAutomaticTuning } // DatabaseBlobAuditingPoliciesClientCreateOrUpdateResponse contains the response from method DatabaseBlobAuditingPoliciesClient.CreateOrUpdate. type DatabaseBlobAuditingPoliciesClientCreateOrUpdateResponse struct { + // A database blob auditing policy. DatabaseBlobAuditingPolicy } // DatabaseBlobAuditingPoliciesClientGetResponse contains the response from method DatabaseBlobAuditingPoliciesClient.Get. type DatabaseBlobAuditingPoliciesClientGetResponse struct { + // A database blob auditing policy. DatabaseBlobAuditingPolicy } // DatabaseBlobAuditingPoliciesClientListByDatabaseResponse contains the response from method DatabaseBlobAuditingPoliciesClient.NewListByDatabasePager. type DatabaseBlobAuditingPoliciesClientListByDatabaseResponse struct { + // A list of database auditing settings. DatabaseBlobAuditingPolicyListResult } // DatabaseColumnsClientGetResponse contains the response from method DatabaseColumnsClient.Get. type DatabaseColumnsClientGetResponse struct { + // A database column resource. DatabaseColumn } // DatabaseColumnsClientListByDatabaseResponse contains the response from method DatabaseColumnsClient.NewListByDatabasePager. type DatabaseColumnsClientListByDatabaseResponse struct { + // A list of database columns. DatabaseColumnListResult } // DatabaseColumnsClientListByTableResponse contains the response from method DatabaseColumnsClient.NewListByTablePager. type DatabaseColumnsClientListByTableResponse struct { + // A list of database columns. DatabaseColumnListResult } +// DatabaseEncryptionProtectorsClientRevalidateResponse contains the response from method DatabaseEncryptionProtectorsClient.BeginRevalidate. +type DatabaseEncryptionProtectorsClientRevalidateResponse struct { + // placeholder for future response values +} + +// DatabaseEncryptionProtectorsClientRevertResponse contains the response from method DatabaseEncryptionProtectorsClient.BeginRevert. +type DatabaseEncryptionProtectorsClientRevertResponse struct { + // placeholder for future response values +} + // DatabaseExtensionsClientCreateOrUpdateResponse contains the response from method DatabaseExtensionsClient.BeginCreateOrUpdate. type DatabaseExtensionsClientCreateOrUpdateResponse struct { + // An Extension operation result resource. ImportExportExtensionsOperationResult } @@ -157,6 +193,7 @@ type DatabaseExtensionsClientGetResponse struct { // DatabaseExtensionsClientListByDatabaseResponse contains the response from method DatabaseExtensionsClient.NewListByDatabasePager. type DatabaseExtensionsClientListByDatabaseResponse struct { + // Import export operation extensions list. ImportExportExtensionsOperationListResult } @@ -167,11 +204,13 @@ type DatabaseOperationsClientCancelResponse struct { // DatabaseOperationsClientListByDatabaseResponse contains the response from method DatabaseOperationsClient.NewListByDatabasePager. type DatabaseOperationsClientListByDatabaseResponse struct { + // The response to a list database operations request DatabaseOperationListResult } // DatabaseRecommendedActionsClientGetResponse contains the response from method DatabaseRecommendedActionsClient.Get. type DatabaseRecommendedActionsClientGetResponse struct { + // Database, Server or Elastic Pool Recommended Action. RecommendedAction } @@ -183,51 +222,144 @@ type DatabaseRecommendedActionsClientListByDatabaseAdvisorResponse struct { // DatabaseRecommendedActionsClientUpdateResponse contains the response from method DatabaseRecommendedActionsClient.Update. type DatabaseRecommendedActionsClientUpdateResponse struct { + // Database, Server or Elastic Pool Recommended Action. RecommendedAction } +// DatabaseSQLVulnerabilityAssessmentBaselinesClientCreateOrUpdateResponse contains the response from method DatabaseSQLVulnerabilityAssessmentBaselinesClient.CreateOrUpdate. +type DatabaseSQLVulnerabilityAssessmentBaselinesClientCreateOrUpdateResponse struct { + // A database sql vulnerability assessment baseline set. + DatabaseSQLVulnerabilityAssessmentBaselineSet +} + +// DatabaseSQLVulnerabilityAssessmentBaselinesClientGetResponse contains the response from method DatabaseSQLVulnerabilityAssessmentBaselinesClient.Get. +type DatabaseSQLVulnerabilityAssessmentBaselinesClientGetResponse struct { + // A database sql vulnerability assessment baseline set. + DatabaseSQLVulnerabilityAssessmentBaselineSet +} + +// DatabaseSQLVulnerabilityAssessmentBaselinesClientListBySQLVulnerabilityAssessmentResponse contains the response from method +// DatabaseSQLVulnerabilityAssessmentBaselinesClient.NewListBySQLVulnerabilityAssessmentPager. +type DatabaseSQLVulnerabilityAssessmentBaselinesClientListBySQLVulnerabilityAssessmentResponse struct { + // A list of SQL Vulnerability Assessments baseline set. + DatabaseSQLVulnerabilityAssessmentBaselineSetListResult +} + +// DatabaseSQLVulnerabilityAssessmentExecuteScanClientExecuteResponse contains the response from method DatabaseSQLVulnerabilityAssessmentExecuteScanClient.BeginExecute. +type DatabaseSQLVulnerabilityAssessmentExecuteScanClientExecuteResponse struct { + // placeholder for future response values +} + +// DatabaseSQLVulnerabilityAssessmentRuleBaselinesClientCreateOrUpdateResponse contains the response from method DatabaseSQLVulnerabilityAssessmentRuleBaselinesClient.CreateOrUpdate. +type DatabaseSQLVulnerabilityAssessmentRuleBaselinesClientCreateOrUpdateResponse struct { + // A database sql vulnerability assessment rule baseline. + DatabaseSQLVulnerabilityAssessmentRuleBaseline +} + +// DatabaseSQLVulnerabilityAssessmentRuleBaselinesClientDeleteResponse contains the response from method DatabaseSQLVulnerabilityAssessmentRuleBaselinesClient.Delete. +type DatabaseSQLVulnerabilityAssessmentRuleBaselinesClientDeleteResponse struct { + // placeholder for future response values +} + +// DatabaseSQLVulnerabilityAssessmentRuleBaselinesClientGetResponse contains the response from method DatabaseSQLVulnerabilityAssessmentRuleBaselinesClient.Get. +type DatabaseSQLVulnerabilityAssessmentRuleBaselinesClientGetResponse struct { + // A database sql vulnerability assessment rule baseline. + DatabaseSQLVulnerabilityAssessmentRuleBaseline +} + +// DatabaseSQLVulnerabilityAssessmentRuleBaselinesClientListByBaselineResponse contains the response from method DatabaseSQLVulnerabilityAssessmentRuleBaselinesClient.NewListByBaselinePager. +type DatabaseSQLVulnerabilityAssessmentRuleBaselinesClientListByBaselineResponse struct { + // A list of SQL Vulnerability Assessments rule baseline. + DatabaseSQLVulnerabilityAssessmentRuleBaselineListResult +} + +// DatabaseSQLVulnerabilityAssessmentScanResultClientGetResponse contains the response from method DatabaseSQLVulnerabilityAssessmentScanResultClient.Get. +type DatabaseSQLVulnerabilityAssessmentScanResultClientGetResponse struct { + VulnerabilityAssessmentScanResults +} + +// DatabaseSQLVulnerabilityAssessmentScanResultClientListByScanResponse contains the response from method DatabaseSQLVulnerabilityAssessmentScanResultClient.NewListByScanPager. +type DatabaseSQLVulnerabilityAssessmentScanResultClientListByScanResponse struct { + // A list of vulnerability assessment scan results. + VulnerabilityAssessmentScanListResult +} + +// DatabaseSQLVulnerabilityAssessmentScansClientGetResponse contains the response from method DatabaseSQLVulnerabilityAssessmentScansClient.Get. +type DatabaseSQLVulnerabilityAssessmentScansClientGetResponse struct { + // A vulnerability assessment scan record. + VulnerabilityAssessmentScanRecordForSQL +} + +// DatabaseSQLVulnerabilityAssessmentScansClientListBySQLVulnerabilityAssessmentsResponse contains the response from method +// DatabaseSQLVulnerabilityAssessmentScansClient.NewListBySQLVulnerabilityAssessmentsPager. +type DatabaseSQLVulnerabilityAssessmentScansClientListBySQLVulnerabilityAssessmentsResponse struct { + // A list of vulnerability assessment scan records. + VulnerabilityAssessmentScanRecordForSQLListResult +} + +// DatabaseSQLVulnerabilityAssessmentsSettingsClientGetResponse contains the response from method DatabaseSQLVulnerabilityAssessmentsSettingsClient.Get. +type DatabaseSQLVulnerabilityAssessmentsSettingsClientGetResponse struct { + // A SQL Vulnerability Assessment. + VulnerabilityAssessment +} + +// DatabaseSQLVulnerabilityAssessmentsSettingsClientListByDatabaseResponse contains the response from method DatabaseSQLVulnerabilityAssessmentsSettingsClient.NewListByDatabasePager. +type DatabaseSQLVulnerabilityAssessmentsSettingsClientListByDatabaseResponse struct { + // A list of SQL Vulnerability Assessments. + VulnerabilityAssessmentListResult +} + // DatabaseSchemasClientGetResponse contains the response from method DatabaseSchemasClient.Get. type DatabaseSchemasClientGetResponse struct { + // A database schema resource. DatabaseSchema } // DatabaseSchemasClientListByDatabaseResponse contains the response from method DatabaseSchemasClient.NewListByDatabasePager. type DatabaseSchemasClientListByDatabaseResponse struct { + // A list of database schemas. DatabaseSchemaListResult } // DatabaseSecurityAlertPoliciesClientCreateOrUpdateResponse contains the response from method DatabaseSecurityAlertPoliciesClient.CreateOrUpdate. type DatabaseSecurityAlertPoliciesClientCreateOrUpdateResponse struct { + // A database security alert policy. DatabaseSecurityAlertPolicy } // DatabaseSecurityAlertPoliciesClientGetResponse contains the response from method DatabaseSecurityAlertPoliciesClient.Get. type DatabaseSecurityAlertPoliciesClientGetResponse struct { + // A database security alert policy. DatabaseSecurityAlertPolicy } // DatabaseSecurityAlertPoliciesClientListByDatabaseResponse contains the response from method DatabaseSecurityAlertPoliciesClient.NewListByDatabasePager. type DatabaseSecurityAlertPoliciesClientListByDatabaseResponse struct { + // A list of the database's security alert policies. DatabaseSecurityAlertListResult } // DatabaseTablesClientGetResponse contains the response from method DatabaseTablesClient.Get. type DatabaseTablesClientGetResponse struct { + // A database table resource. DatabaseTable } // DatabaseTablesClientListBySchemaResponse contains the response from method DatabaseTablesClient.NewListBySchemaPager. type DatabaseTablesClientListBySchemaResponse struct { + // A list of database tables. DatabaseTableListResult } // DatabaseUsagesClientListByDatabaseResponse contains the response from method DatabaseUsagesClient.NewListByDatabasePager. type DatabaseUsagesClientListByDatabaseResponse struct { + // A list of database usage metrics. DatabaseUsageListResult } // DatabaseVulnerabilityAssessmentRuleBaselinesClientCreateOrUpdateResponse contains the response from method DatabaseVulnerabilityAssessmentRuleBaselinesClient.CreateOrUpdate. type DatabaseVulnerabilityAssessmentRuleBaselinesClientCreateOrUpdateResponse struct { + // A database vulnerability assessment rule baseline. DatabaseVulnerabilityAssessmentRuleBaseline } @@ -238,16 +370,19 @@ type DatabaseVulnerabilityAssessmentRuleBaselinesClientDeleteResponse struct { // DatabaseVulnerabilityAssessmentRuleBaselinesClientGetResponse contains the response from method DatabaseVulnerabilityAssessmentRuleBaselinesClient.Get. type DatabaseVulnerabilityAssessmentRuleBaselinesClientGetResponse struct { + // A database vulnerability assessment rule baseline. DatabaseVulnerabilityAssessmentRuleBaseline } // DatabaseVulnerabilityAssessmentScansClientExportResponse contains the response from method DatabaseVulnerabilityAssessmentScansClient.Export. type DatabaseVulnerabilityAssessmentScansClientExportResponse struct { + // A database Vulnerability Assessment scan export resource. DatabaseVulnerabilityAssessmentScansExport } // DatabaseVulnerabilityAssessmentScansClientGetResponse contains the response from method DatabaseVulnerabilityAssessmentScansClient.Get. type DatabaseVulnerabilityAssessmentScansClientGetResponse struct { + // A vulnerability assessment scan record. VulnerabilityAssessmentScanRecord } @@ -258,11 +393,13 @@ type DatabaseVulnerabilityAssessmentScansClientInitiateScanResponse struct { // DatabaseVulnerabilityAssessmentScansClientListByDatabaseResponse contains the response from method DatabaseVulnerabilityAssessmentScansClient.NewListByDatabasePager. type DatabaseVulnerabilityAssessmentScansClientListByDatabaseResponse struct { + // A list of vulnerability assessment scan records. VulnerabilityAssessmentScanRecordListResult } // DatabaseVulnerabilityAssessmentsClientCreateOrUpdateResponse contains the response from method DatabaseVulnerabilityAssessmentsClient.CreateOrUpdate. type DatabaseVulnerabilityAssessmentsClientCreateOrUpdateResponse struct { + // A database vulnerability assessment. DatabaseVulnerabilityAssessment } @@ -273,16 +410,19 @@ type DatabaseVulnerabilityAssessmentsClientDeleteResponse struct { // DatabaseVulnerabilityAssessmentsClientGetResponse contains the response from method DatabaseVulnerabilityAssessmentsClient.Get. type DatabaseVulnerabilityAssessmentsClientGetResponse struct { + // A database vulnerability assessment. DatabaseVulnerabilityAssessment } // DatabaseVulnerabilityAssessmentsClientListByDatabaseResponse contains the response from method DatabaseVulnerabilityAssessmentsClient.NewListByDatabasePager. type DatabaseVulnerabilityAssessmentsClientListByDatabaseResponse struct { + // A list of the database's vulnerability assessments. DatabaseVulnerabilityAssessmentListResult } // DatabasesClientCreateOrUpdateResponse contains the response from method DatabasesClient.BeginCreateOrUpdate. type DatabasesClientCreateOrUpdateResponse struct { + // A database resource. Database } @@ -293,6 +433,7 @@ type DatabasesClientDeleteResponse struct { // DatabasesClientExportResponse contains the response from method DatabasesClient.BeginExport. type DatabasesClientExportResponse struct { + // An ImportExport operation result resource. ImportExportOperationResult } @@ -303,41 +444,37 @@ type DatabasesClientFailoverResponse struct { // DatabasesClientGetResponse contains the response from method DatabasesClient.Get. type DatabasesClientGetResponse struct { + // A database resource. Database } // DatabasesClientImportResponse contains the response from method DatabasesClient.BeginImport. type DatabasesClientImportResponse struct { + // An ImportExport operation result resource. ImportExportOperationResult } // DatabasesClientListByElasticPoolResponse contains the response from method DatabasesClient.NewListByElasticPoolPager. type DatabasesClientListByElasticPoolResponse struct { + // A list of databases. DatabaseListResult } // DatabasesClientListByServerResponse contains the response from method DatabasesClient.NewListByServerPager. type DatabasesClientListByServerResponse struct { + // A list of databases. DatabaseListResult } // DatabasesClientListInaccessibleByServerResponse contains the response from method DatabasesClient.NewListInaccessibleByServerPager. type DatabasesClientListInaccessibleByServerResponse struct { + // A list of databases. DatabaseListResult } -// DatabasesClientListMetricDefinitionsResponse contains the response from method DatabasesClient.NewListMetricDefinitionsPager. -type DatabasesClientListMetricDefinitionsResponse struct { - MetricDefinitionListResult -} - -// DatabasesClientListMetricsResponse contains the response from method DatabasesClient.NewListMetricsPager. -type DatabasesClientListMetricsResponse struct { - MetricListResult -} - // DatabasesClientPauseResponse contains the response from method DatabasesClient.BeginPause. type DatabasesClientPauseResponse struct { + // A database resource. Database } @@ -348,11 +485,13 @@ type DatabasesClientRenameResponse struct { // DatabasesClientResumeResponse contains the response from method DatabasesClient.BeginResume. type DatabasesClientResumeResponse struct { + // A database resource. Database } // DatabasesClientUpdateResponse contains the response from method DatabasesClient.BeginUpdate. type DatabasesClientUpdateResponse struct { + // A database resource. Database } @@ -363,26 +502,31 @@ type DatabasesClientUpgradeDataWarehouseResponse struct { // DeletedServersClientGetResponse contains the response from method DeletedServersClient.Get. type DeletedServersClientGetResponse struct { + // A deleted server. DeletedServer } // DeletedServersClientListByLocationResponse contains the response from method DeletedServersClient.NewListByLocationPager. type DeletedServersClientListByLocationResponse struct { + // A list of deleted servers. DeletedServerListResult } // DeletedServersClientListResponse contains the response from method DeletedServersClient.NewListPager. type DeletedServersClientListResponse struct { + // A list of deleted servers. DeletedServerListResult } // DeletedServersClientRecoverResponse contains the response from method DeletedServersClient.BeginRecover. type DeletedServersClientRecoverResponse struct { + // A deleted server. DeletedServer } // DistributedAvailabilityGroupsClientCreateOrUpdateResponse contains the response from method DistributedAvailabilityGroupsClient.BeginCreateOrUpdate. type DistributedAvailabilityGroupsClientCreateOrUpdateResponse struct { + // Distributed availability group between box and Sql Managed Instance. DistributedAvailabilityGroup } @@ -393,27 +537,26 @@ type DistributedAvailabilityGroupsClientDeleteResponse struct { // DistributedAvailabilityGroupsClientGetResponse contains the response from method DistributedAvailabilityGroupsClient.Get. type DistributedAvailabilityGroupsClientGetResponse struct { + // Distributed availability group between box and Sql Managed Instance. DistributedAvailabilityGroup } // DistributedAvailabilityGroupsClientListByInstanceResponse contains the response from method DistributedAvailabilityGroupsClient.NewListByInstancePager. type DistributedAvailabilityGroupsClientListByInstanceResponse struct { + // A list of distributed availability groups in instance. DistributedAvailabilityGroupsListResult } -// DistributedAvailabilityGroupsClientUpdateResponse contains the response from method DistributedAvailabilityGroupsClient.BeginUpdate. -type DistributedAvailabilityGroupsClientUpdateResponse struct { +// DistributedAvailabilityGroupsClientSetRoleResponse contains the response from method DistributedAvailabilityGroupsClient.BeginSetRole. +type DistributedAvailabilityGroupsClientSetRoleResponse struct { + // Distributed availability group between box and Sql Managed Instance. DistributedAvailabilityGroup } -// ElasticPoolActivitiesClientListByElasticPoolResponse contains the response from method ElasticPoolActivitiesClient.NewListByElasticPoolPager. -type ElasticPoolActivitiesClientListByElasticPoolResponse struct { - ElasticPoolActivityListResult -} - -// ElasticPoolDatabaseActivitiesClientListByElasticPoolResponse contains the response from method ElasticPoolDatabaseActivitiesClient.NewListByElasticPoolPager. -type ElasticPoolDatabaseActivitiesClientListByElasticPoolResponse struct { - ElasticPoolDatabaseActivityListResult +// DistributedAvailabilityGroupsClientUpdateResponse contains the response from method DistributedAvailabilityGroupsClient.BeginUpdate. +type DistributedAvailabilityGroupsClientUpdateResponse struct { + // Distributed availability group between box and Sql Managed Instance. + DistributedAvailabilityGroup } // ElasticPoolOperationsClientCancelResponse contains the response from method ElasticPoolOperationsClient.Cancel. @@ -423,11 +566,13 @@ type ElasticPoolOperationsClientCancelResponse struct { // ElasticPoolOperationsClientListByElasticPoolResponse contains the response from method ElasticPoolOperationsClient.NewListByElasticPoolPager. type ElasticPoolOperationsClientListByElasticPoolResponse struct { + // The response to a list elastic pool operations request ElasticPoolOperationListResult } // ElasticPoolsClientCreateOrUpdateResponse contains the response from method ElasticPoolsClient.BeginCreateOrUpdate. type ElasticPoolsClientCreateOrUpdateResponse struct { + // An elastic pool. ElasticPool } @@ -443,41 +588,37 @@ type ElasticPoolsClientFailoverResponse struct { // ElasticPoolsClientGetResponse contains the response from method ElasticPoolsClient.Get. type ElasticPoolsClientGetResponse struct { + // An elastic pool. ElasticPool } // ElasticPoolsClientListByServerResponse contains the response from method ElasticPoolsClient.NewListByServerPager. type ElasticPoolsClientListByServerResponse struct { + // The result of an elastic pool list request. ElasticPoolListResult } -// ElasticPoolsClientListMetricDefinitionsResponse contains the response from method ElasticPoolsClient.NewListMetricDefinitionsPager. -type ElasticPoolsClientListMetricDefinitionsResponse struct { - MetricDefinitionListResult -} - -// ElasticPoolsClientListMetricsResponse contains the response from method ElasticPoolsClient.NewListMetricsPager. -type ElasticPoolsClientListMetricsResponse struct { - MetricListResult -} - // ElasticPoolsClientUpdateResponse contains the response from method ElasticPoolsClient.BeginUpdate. type ElasticPoolsClientUpdateResponse struct { + // An elastic pool. ElasticPool } // EncryptionProtectorsClientCreateOrUpdateResponse contains the response from method EncryptionProtectorsClient.BeginCreateOrUpdate. type EncryptionProtectorsClientCreateOrUpdateResponse struct { + // The server encryption protector. EncryptionProtector } // EncryptionProtectorsClientGetResponse contains the response from method EncryptionProtectorsClient.Get. type EncryptionProtectorsClientGetResponse struct { + // The server encryption protector. EncryptionProtector } // EncryptionProtectorsClientListByServerResponse contains the response from method EncryptionProtectorsClient.NewListByServerPager. type EncryptionProtectorsClientListByServerResponse struct { + // A list of server encryption protectors. EncryptionProtectorListResult } @@ -488,46 +629,55 @@ type EncryptionProtectorsClientRevalidateResponse struct { // EndpointCertificatesClientGetResponse contains the response from method EndpointCertificatesClient.Get. type EndpointCertificatesClientGetResponse struct { + // Certificate used on an endpoint on the Managed Instance. EndpointCertificate } // EndpointCertificatesClientListByInstanceResponse contains the response from method EndpointCertificatesClient.NewListByInstancePager. type EndpointCertificatesClientListByInstanceResponse struct { + // A list of endpoint certificates on the target instance. EndpointCertificateListResult } // ExtendedDatabaseBlobAuditingPoliciesClientCreateOrUpdateResponse contains the response from method ExtendedDatabaseBlobAuditingPoliciesClient.CreateOrUpdate. type ExtendedDatabaseBlobAuditingPoliciesClientCreateOrUpdateResponse struct { + // An extended database blob auditing policy. ExtendedDatabaseBlobAuditingPolicy } // ExtendedDatabaseBlobAuditingPoliciesClientGetResponse contains the response from method ExtendedDatabaseBlobAuditingPoliciesClient.Get. type ExtendedDatabaseBlobAuditingPoliciesClientGetResponse struct { + // An extended database blob auditing policy. ExtendedDatabaseBlobAuditingPolicy } // ExtendedDatabaseBlobAuditingPoliciesClientListByDatabaseResponse contains the response from method ExtendedDatabaseBlobAuditingPoliciesClient.NewListByDatabasePager. type ExtendedDatabaseBlobAuditingPoliciesClientListByDatabaseResponse struct { + // A list of database extended auditing settings. ExtendedDatabaseBlobAuditingPolicyListResult } // ExtendedServerBlobAuditingPoliciesClientCreateOrUpdateResponse contains the response from method ExtendedServerBlobAuditingPoliciesClient.BeginCreateOrUpdate. type ExtendedServerBlobAuditingPoliciesClientCreateOrUpdateResponse struct { + // An extended server blob auditing policy. ExtendedServerBlobAuditingPolicy } // ExtendedServerBlobAuditingPoliciesClientGetResponse contains the response from method ExtendedServerBlobAuditingPoliciesClient.Get. type ExtendedServerBlobAuditingPoliciesClientGetResponse struct { + // An extended server blob auditing policy. ExtendedServerBlobAuditingPolicy } // ExtendedServerBlobAuditingPoliciesClientListByServerResponse contains the response from method ExtendedServerBlobAuditingPoliciesClient.NewListByServerPager. type ExtendedServerBlobAuditingPoliciesClientListByServerResponse struct { + // A list of server extended auditing settings. ExtendedServerBlobAuditingPolicyListResult } // FailoverGroupsClientCreateOrUpdateResponse contains the response from method FailoverGroupsClient.BeginCreateOrUpdate. type FailoverGroupsClientCreateOrUpdateResponse struct { + // A failover group. FailoverGroup } @@ -538,31 +688,43 @@ type FailoverGroupsClientDeleteResponse struct { // FailoverGroupsClientFailoverResponse contains the response from method FailoverGroupsClient.BeginFailover. type FailoverGroupsClientFailoverResponse struct { + // A failover group. FailoverGroup } // FailoverGroupsClientForceFailoverAllowDataLossResponse contains the response from method FailoverGroupsClient.BeginForceFailoverAllowDataLoss. type FailoverGroupsClientForceFailoverAllowDataLossResponse struct { + // A failover group. FailoverGroup } // FailoverGroupsClientGetResponse contains the response from method FailoverGroupsClient.Get. type FailoverGroupsClientGetResponse struct { + // A failover group. FailoverGroup } // FailoverGroupsClientListByServerResponse contains the response from method FailoverGroupsClient.NewListByServerPager. type FailoverGroupsClientListByServerResponse struct { + // A list of failover groups. FailoverGroupListResult } +// FailoverGroupsClientTryPlannedBeforeForcedFailoverResponse contains the response from method FailoverGroupsClient.BeginTryPlannedBeforeForcedFailover. +type FailoverGroupsClientTryPlannedBeforeForcedFailoverResponse struct { + // A failover group. + FailoverGroup +} + // FailoverGroupsClientUpdateResponse contains the response from method FailoverGroupsClient.BeginUpdate. type FailoverGroupsClientUpdateResponse struct { + // A failover group. FailoverGroup } // FirewallRulesClientCreateOrUpdateResponse contains the response from method FirewallRulesClient.CreateOrUpdate. type FirewallRulesClientCreateOrUpdateResponse struct { + // A server firewall rule. FirewallRule } @@ -573,36 +735,43 @@ type FirewallRulesClientDeleteResponse struct { // FirewallRulesClientGetResponse contains the response from method FirewallRulesClient.Get. type FirewallRulesClientGetResponse struct { + // A server firewall rule. FirewallRule } // FirewallRulesClientListByServerResponse contains the response from method FirewallRulesClient.NewListByServerPager. type FirewallRulesClientListByServerResponse struct { + // The response to a list firewall rules request FirewallRuleListResult } // FirewallRulesClientReplaceResponse contains the response from method FirewallRulesClient.Replace. type FirewallRulesClientReplaceResponse struct { + // A server firewall rule. FirewallRule } // GeoBackupPoliciesClientCreateOrUpdateResponse contains the response from method GeoBackupPoliciesClient.CreateOrUpdate. type GeoBackupPoliciesClientCreateOrUpdateResponse struct { + // A Geo backup policy. GeoBackupPolicy } // GeoBackupPoliciesClientGetResponse contains the response from method GeoBackupPoliciesClient.Get. type GeoBackupPoliciesClientGetResponse struct { + // A Geo backup policy. GeoBackupPolicy } -// GeoBackupPoliciesClientListByDatabaseResponse contains the response from method GeoBackupPoliciesClient.NewListByDatabasePager. -type GeoBackupPoliciesClientListByDatabaseResponse struct { +// GeoBackupPoliciesClientListResponse contains the response from method GeoBackupPoliciesClient.NewListPager. +type GeoBackupPoliciesClientListResponse struct { + // The list of geo backup policies. GeoBackupPolicyListResult } // IPv6FirewallRulesClientCreateOrUpdateResponse contains the response from method IPv6FirewallRulesClient.CreateOrUpdate. type IPv6FirewallRulesClientCreateOrUpdateResponse struct { + // An IPv6 server firewall rule. IPv6FirewallRule } @@ -613,16 +782,19 @@ type IPv6FirewallRulesClientDeleteResponse struct { // IPv6FirewallRulesClientGetResponse contains the response from method IPv6FirewallRulesClient.Get. type IPv6FirewallRulesClientGetResponse struct { + // An IPv6 server firewall rule. IPv6FirewallRule } // IPv6FirewallRulesClientListByServerResponse contains the response from method IPv6FirewallRulesClient.NewListByServerPager. type IPv6FirewallRulesClientListByServerResponse struct { + // The response to a list IPv6 firewall rules request IPv6FirewallRuleListResult } // InstanceFailoverGroupsClientCreateOrUpdateResponse contains the response from method InstanceFailoverGroupsClient.BeginCreateOrUpdate. type InstanceFailoverGroupsClientCreateOrUpdateResponse struct { + // An instance failover group. InstanceFailoverGroup } @@ -633,26 +805,31 @@ type InstanceFailoverGroupsClientDeleteResponse struct { // InstanceFailoverGroupsClientFailoverResponse contains the response from method InstanceFailoverGroupsClient.BeginFailover. type InstanceFailoverGroupsClientFailoverResponse struct { + // An instance failover group. InstanceFailoverGroup } // InstanceFailoverGroupsClientForceFailoverAllowDataLossResponse contains the response from method InstanceFailoverGroupsClient.BeginForceFailoverAllowDataLoss. type InstanceFailoverGroupsClientForceFailoverAllowDataLossResponse struct { + // An instance failover group. InstanceFailoverGroup } // InstanceFailoverGroupsClientGetResponse contains the response from method InstanceFailoverGroupsClient.Get. type InstanceFailoverGroupsClientGetResponse struct { + // An instance failover group. InstanceFailoverGroup } // InstanceFailoverGroupsClientListByLocationResponse contains the response from method InstanceFailoverGroupsClient.NewListByLocationPager. type InstanceFailoverGroupsClientListByLocationResponse struct { + // A list of instance failover groups. InstanceFailoverGroupListResult } // InstancePoolsClientCreateOrUpdateResponse contains the response from method InstancePoolsClient.BeginCreateOrUpdate. type InstancePoolsClientCreateOrUpdateResponse struct { + // An Azure SQL instance pool. InstancePool } @@ -663,26 +840,31 @@ type InstancePoolsClientDeleteResponse struct { // InstancePoolsClientGetResponse contains the response from method InstancePoolsClient.Get. type InstancePoolsClientGetResponse struct { + // An Azure SQL instance pool. InstancePool } // InstancePoolsClientListByResourceGroupResponse contains the response from method InstancePoolsClient.NewListByResourceGroupPager. type InstancePoolsClientListByResourceGroupResponse struct { + // A list of Azure SQL instance pools. InstancePoolListResult } // InstancePoolsClientListResponse contains the response from method InstancePoolsClient.NewListPager. type InstancePoolsClientListResponse struct { + // A list of Azure SQL instance pools. InstancePoolListResult } // InstancePoolsClientUpdateResponse contains the response from method InstancePoolsClient.BeginUpdate. type InstancePoolsClientUpdateResponse struct { + // An Azure SQL instance pool. InstancePool } // JobAgentsClientCreateOrUpdateResponse contains the response from method JobAgentsClient.BeginCreateOrUpdate. type JobAgentsClientCreateOrUpdateResponse struct { + // An Azure SQL job agent. JobAgent } @@ -693,21 +875,25 @@ type JobAgentsClientDeleteResponse struct { // JobAgentsClientGetResponse contains the response from method JobAgentsClient.Get. type JobAgentsClientGetResponse struct { + // An Azure SQL job agent. JobAgent } // JobAgentsClientListByServerResponse contains the response from method JobAgentsClient.NewListByServerPager. type JobAgentsClientListByServerResponse struct { + // A list of Azure SQL job agents. JobAgentListResult } // JobAgentsClientUpdateResponse contains the response from method JobAgentsClient.BeginUpdate. type JobAgentsClientUpdateResponse struct { + // An Azure SQL job agent. JobAgent } // JobCredentialsClientCreateOrUpdateResponse contains the response from method JobCredentialsClient.CreateOrUpdate. type JobCredentialsClientCreateOrUpdateResponse struct { + // A stored credential that can be used by a job to connect to target databases. JobCredential } @@ -718,11 +904,13 @@ type JobCredentialsClientDeleteResponse struct { // JobCredentialsClientGetResponse contains the response from method JobCredentialsClient.Get. type JobCredentialsClientGetResponse struct { + // A stored credential that can be used by a job to connect to target databases. JobCredential } // JobCredentialsClientListByAgentResponse contains the response from method JobCredentialsClient.NewListByAgentPager. type JobCredentialsClientListByAgentResponse struct { + // A list of job credentials. JobCredentialListResult } @@ -733,41 +921,49 @@ type JobExecutionsClientCancelResponse struct { // JobExecutionsClientCreateOrUpdateResponse contains the response from method JobExecutionsClient.BeginCreateOrUpdate. type JobExecutionsClientCreateOrUpdateResponse struct { + // An execution of a job JobExecution } // JobExecutionsClientCreateResponse contains the response from method JobExecutionsClient.BeginCreate. type JobExecutionsClientCreateResponse struct { + // An execution of a job JobExecution } // JobExecutionsClientGetResponse contains the response from method JobExecutionsClient.Get. type JobExecutionsClientGetResponse struct { + // An execution of a job JobExecution } // JobExecutionsClientListByAgentResponse contains the response from method JobExecutionsClient.NewListByAgentPager. type JobExecutionsClientListByAgentResponse struct { + // A list of job executions. JobExecutionListResult } // JobExecutionsClientListByJobResponse contains the response from method JobExecutionsClient.NewListByJobPager. type JobExecutionsClientListByJobResponse struct { + // A list of job executions. JobExecutionListResult } // JobStepExecutionsClientGetResponse contains the response from method JobStepExecutionsClient.Get. type JobStepExecutionsClientGetResponse struct { + // An execution of a job JobExecution } // JobStepExecutionsClientListByJobExecutionResponse contains the response from method JobStepExecutionsClient.NewListByJobExecutionPager. type JobStepExecutionsClientListByJobExecutionResponse struct { + // A list of job executions. JobExecutionListResult } // JobStepsClientCreateOrUpdateResponse contains the response from method JobStepsClient.CreateOrUpdate. type JobStepsClientCreateOrUpdateResponse struct { + // A job step. JobStep } @@ -778,41 +974,49 @@ type JobStepsClientDeleteResponse struct { // JobStepsClientGetByVersionResponse contains the response from method JobStepsClient.GetByVersion. type JobStepsClientGetByVersionResponse struct { + // A job step. JobStep } // JobStepsClientGetResponse contains the response from method JobStepsClient.Get. type JobStepsClientGetResponse struct { + // A job step. JobStep } // JobStepsClientListByJobResponse contains the response from method JobStepsClient.NewListByJobPager. type JobStepsClientListByJobResponse struct { + // A list of job steps. JobStepListResult } // JobStepsClientListByVersionResponse contains the response from method JobStepsClient.NewListByVersionPager. type JobStepsClientListByVersionResponse struct { + // A list of job steps. JobStepListResult } // JobTargetExecutionsClientGetResponse contains the response from method JobTargetExecutionsClient.Get. type JobTargetExecutionsClientGetResponse struct { + // An execution of a job JobExecution } // JobTargetExecutionsClientListByJobExecutionResponse contains the response from method JobTargetExecutionsClient.NewListByJobExecutionPager. type JobTargetExecutionsClientListByJobExecutionResponse struct { + // A list of job executions. JobExecutionListResult } // JobTargetExecutionsClientListByStepResponse contains the response from method JobTargetExecutionsClient.NewListByStepPager. type JobTargetExecutionsClientListByStepResponse struct { + // A list of job executions. JobExecutionListResult } // JobTargetGroupsClientCreateOrUpdateResponse contains the response from method JobTargetGroupsClient.CreateOrUpdate. type JobTargetGroupsClientCreateOrUpdateResponse struct { + // A group of job targets. JobTargetGroup } @@ -823,26 +1027,31 @@ type JobTargetGroupsClientDeleteResponse struct { // JobTargetGroupsClientGetResponse contains the response from method JobTargetGroupsClient.Get. type JobTargetGroupsClientGetResponse struct { + // A group of job targets. JobTargetGroup } // JobTargetGroupsClientListByAgentResponse contains the response from method JobTargetGroupsClient.NewListByAgentPager. type JobTargetGroupsClientListByAgentResponse struct { + // A list of target groups. JobTargetGroupListResult } // JobVersionsClientGetResponse contains the response from method JobVersionsClient.Get. type JobVersionsClientGetResponse struct { + // A job version. JobVersion } // JobVersionsClientListByJobResponse contains the response from method JobVersionsClient.NewListByJobPager. type JobVersionsClientListByJobResponse struct { + // A list of job versions. JobVersionListResult } // JobsClientCreateOrUpdateResponse contains the response from method JobsClient.CreateOrUpdate. type JobsClientCreateOrUpdateResponse struct { + // A job. Job } @@ -853,41 +1062,49 @@ type JobsClientDeleteResponse struct { // JobsClientGetResponse contains the response from method JobsClient.Get. type JobsClientGetResponse struct { + // A job. Job } // JobsClientListByAgentResponse contains the response from method JobsClient.NewListByAgentPager. type JobsClientListByAgentResponse struct { + // A list of jobs. JobListResult } // LedgerDigestUploadsClientCreateOrUpdateResponse contains the response from method LedgerDigestUploadsClient.BeginCreateOrUpdate. type LedgerDigestUploadsClientCreateOrUpdateResponse struct { + // Azure SQL Database ledger digest upload settings. LedgerDigestUploads } // LedgerDigestUploadsClientDisableResponse contains the response from method LedgerDigestUploadsClient.BeginDisable. type LedgerDigestUploadsClientDisableResponse struct { + // Azure SQL Database ledger digest upload settings. LedgerDigestUploads } // LedgerDigestUploadsClientGetResponse contains the response from method LedgerDigestUploadsClient.Get. type LedgerDigestUploadsClientGetResponse struct { + // Azure SQL Database ledger digest upload settings. LedgerDigestUploads } // LedgerDigestUploadsClientListByDatabaseResponse contains the response from method LedgerDigestUploadsClient.NewListByDatabasePager. type LedgerDigestUploadsClientListByDatabaseResponse struct { + // A list of ledger digest upload settings. LedgerDigestUploadsListResult } // LongTermRetentionBackupsClientCopyByResourceGroupResponse contains the response from method LongTermRetentionBackupsClient.BeginCopyByResourceGroup. type LongTermRetentionBackupsClientCopyByResourceGroupResponse struct { + // A LongTermRetentionBackup operation result resource. LongTermRetentionBackupOperationResult } // LongTermRetentionBackupsClientCopyResponse contains the response from method LongTermRetentionBackupsClient.BeginCopy. type LongTermRetentionBackupsClientCopyResponse struct { + // A LongTermRetentionBackup operation result resource. LongTermRetentionBackupOperationResult } @@ -903,51 +1120,61 @@ type LongTermRetentionBackupsClientDeleteResponse struct { // LongTermRetentionBackupsClientGetByResourceGroupResponse contains the response from method LongTermRetentionBackupsClient.GetByResourceGroup. type LongTermRetentionBackupsClientGetByResourceGroupResponse struct { + // A long term retention backup. LongTermRetentionBackup } // LongTermRetentionBackupsClientGetResponse contains the response from method LongTermRetentionBackupsClient.Get. type LongTermRetentionBackupsClientGetResponse struct { + // A long term retention backup. LongTermRetentionBackup } // LongTermRetentionBackupsClientListByDatabaseResponse contains the response from method LongTermRetentionBackupsClient.NewListByDatabasePager. type LongTermRetentionBackupsClientListByDatabaseResponse struct { + // A list of long term retention backups. LongTermRetentionBackupListResult } // LongTermRetentionBackupsClientListByLocationResponse contains the response from method LongTermRetentionBackupsClient.NewListByLocationPager. type LongTermRetentionBackupsClientListByLocationResponse struct { + // A list of long term retention backups. LongTermRetentionBackupListResult } // LongTermRetentionBackupsClientListByResourceGroupDatabaseResponse contains the response from method LongTermRetentionBackupsClient.NewListByResourceGroupDatabasePager. type LongTermRetentionBackupsClientListByResourceGroupDatabaseResponse struct { + // A list of long term retention backups. LongTermRetentionBackupListResult } // LongTermRetentionBackupsClientListByResourceGroupLocationResponse contains the response from method LongTermRetentionBackupsClient.NewListByResourceGroupLocationPager. type LongTermRetentionBackupsClientListByResourceGroupLocationResponse struct { + // A list of long term retention backups. LongTermRetentionBackupListResult } // LongTermRetentionBackupsClientListByResourceGroupServerResponse contains the response from method LongTermRetentionBackupsClient.NewListByResourceGroupServerPager. type LongTermRetentionBackupsClientListByResourceGroupServerResponse struct { + // A list of long term retention backups. LongTermRetentionBackupListResult } // LongTermRetentionBackupsClientListByServerResponse contains the response from method LongTermRetentionBackupsClient.NewListByServerPager. type LongTermRetentionBackupsClientListByServerResponse struct { + // A list of long term retention backups. LongTermRetentionBackupListResult } // LongTermRetentionBackupsClientUpdateByResourceGroupResponse contains the response from method LongTermRetentionBackupsClient.BeginUpdateByResourceGroup. type LongTermRetentionBackupsClientUpdateByResourceGroupResponse struct { + // A LongTermRetentionBackup operation result resource. LongTermRetentionBackupOperationResult } // LongTermRetentionBackupsClientUpdateResponse contains the response from method LongTermRetentionBackupsClient.BeginUpdate. type LongTermRetentionBackupsClientUpdateResponse struct { + // A LongTermRetentionBackup operation result resource. LongTermRetentionBackupOperationResult } @@ -963,61 +1190,73 @@ type LongTermRetentionManagedInstanceBackupsClientDeleteResponse struct { // LongTermRetentionManagedInstanceBackupsClientGetByResourceGroupResponse contains the response from method LongTermRetentionManagedInstanceBackupsClient.GetByResourceGroup. type LongTermRetentionManagedInstanceBackupsClientGetByResourceGroupResponse struct { + // A long term retention backup for a managed database. ManagedInstanceLongTermRetentionBackup } // LongTermRetentionManagedInstanceBackupsClientGetResponse contains the response from method LongTermRetentionManagedInstanceBackupsClient.Get. type LongTermRetentionManagedInstanceBackupsClientGetResponse struct { + // A long term retention backup for a managed database. ManagedInstanceLongTermRetentionBackup } // LongTermRetentionManagedInstanceBackupsClientListByDatabaseResponse contains the response from method LongTermRetentionManagedInstanceBackupsClient.NewListByDatabasePager. type LongTermRetentionManagedInstanceBackupsClientListByDatabaseResponse struct { + // A list of long term retention backups for managed database(s). ManagedInstanceLongTermRetentionBackupListResult } // LongTermRetentionManagedInstanceBackupsClientListByInstanceResponse contains the response from method LongTermRetentionManagedInstanceBackupsClient.NewListByInstancePager. type LongTermRetentionManagedInstanceBackupsClientListByInstanceResponse struct { + // A list of long term retention backups for managed database(s). ManagedInstanceLongTermRetentionBackupListResult } // LongTermRetentionManagedInstanceBackupsClientListByLocationResponse contains the response from method LongTermRetentionManagedInstanceBackupsClient.NewListByLocationPager. type LongTermRetentionManagedInstanceBackupsClientListByLocationResponse struct { + // A list of long term retention backups for managed database(s). ManagedInstanceLongTermRetentionBackupListResult } // LongTermRetentionManagedInstanceBackupsClientListByResourceGroupDatabaseResponse contains the response from method LongTermRetentionManagedInstanceBackupsClient.NewListByResourceGroupDatabasePager. type LongTermRetentionManagedInstanceBackupsClientListByResourceGroupDatabaseResponse struct { + // A list of long term retention backups for managed database(s). ManagedInstanceLongTermRetentionBackupListResult } // LongTermRetentionManagedInstanceBackupsClientListByResourceGroupInstanceResponse contains the response from method LongTermRetentionManagedInstanceBackupsClient.NewListByResourceGroupInstancePager. type LongTermRetentionManagedInstanceBackupsClientListByResourceGroupInstanceResponse struct { + // A list of long term retention backups for managed database(s). ManagedInstanceLongTermRetentionBackupListResult } // LongTermRetentionManagedInstanceBackupsClientListByResourceGroupLocationResponse contains the response from method LongTermRetentionManagedInstanceBackupsClient.NewListByResourceGroupLocationPager. type LongTermRetentionManagedInstanceBackupsClientListByResourceGroupLocationResponse struct { + // A list of long term retention backups for managed database(s). ManagedInstanceLongTermRetentionBackupListResult } // LongTermRetentionPoliciesClientCreateOrUpdateResponse contains the response from method LongTermRetentionPoliciesClient.BeginCreateOrUpdate. type LongTermRetentionPoliciesClientCreateOrUpdateResponse struct { + // A long term retention policy. LongTermRetentionPolicy } // LongTermRetentionPoliciesClientGetResponse contains the response from method LongTermRetentionPoliciesClient.Get. type LongTermRetentionPoliciesClientGetResponse struct { + // A long term retention policy. LongTermRetentionPolicy } // LongTermRetentionPoliciesClientListByDatabaseResponse contains the response from method LongTermRetentionPoliciesClient.NewListByDatabasePager. type LongTermRetentionPoliciesClientListByDatabaseResponse struct { + // A list of long term retention policies. LongTermRetentionPolicyListResult } // MaintenanceWindowOptionsClientGetResponse contains the response from method MaintenanceWindowOptionsClient.Get. type MaintenanceWindowOptionsClientGetResponse struct { + // Maintenance window options. MaintenanceWindowOptions } @@ -1028,51 +1267,91 @@ type MaintenanceWindowsClientCreateOrUpdateResponse struct { // MaintenanceWindowsClientGetResponse contains the response from method MaintenanceWindowsClient.Get. type MaintenanceWindowsClientGetResponse struct { + // Maintenance windows. MaintenanceWindows } // ManagedBackupShortTermRetentionPoliciesClientCreateOrUpdateResponse contains the response from method ManagedBackupShortTermRetentionPoliciesClient.BeginCreateOrUpdate. type ManagedBackupShortTermRetentionPoliciesClientCreateOrUpdateResponse struct { + // A short term retention policy. ManagedBackupShortTermRetentionPolicy } // ManagedBackupShortTermRetentionPoliciesClientGetResponse contains the response from method ManagedBackupShortTermRetentionPoliciesClient.Get. type ManagedBackupShortTermRetentionPoliciesClientGetResponse struct { + // A short term retention policy. ManagedBackupShortTermRetentionPolicy } // ManagedBackupShortTermRetentionPoliciesClientListByDatabaseResponse contains the response from method ManagedBackupShortTermRetentionPoliciesClient.NewListByDatabasePager. type ManagedBackupShortTermRetentionPoliciesClientListByDatabaseResponse struct { + // A list of short term retention policies. ManagedBackupShortTermRetentionPolicyListResult } // ManagedBackupShortTermRetentionPoliciesClientUpdateResponse contains the response from method ManagedBackupShortTermRetentionPoliciesClient.BeginUpdate. type ManagedBackupShortTermRetentionPoliciesClientUpdateResponse struct { + // A short term retention policy. ManagedBackupShortTermRetentionPolicy } +// ManagedDatabaseAdvancedThreatProtectionSettingsClientCreateOrUpdateResponse contains the response from method ManagedDatabaseAdvancedThreatProtectionSettingsClient.CreateOrUpdate. +type ManagedDatabaseAdvancedThreatProtectionSettingsClientCreateOrUpdateResponse struct { + // A managed database Advanced Threat Protection. + ManagedDatabaseAdvancedThreatProtection +} + +// ManagedDatabaseAdvancedThreatProtectionSettingsClientGetResponse contains the response from method ManagedDatabaseAdvancedThreatProtectionSettingsClient.Get. +type ManagedDatabaseAdvancedThreatProtectionSettingsClientGetResponse struct { + // A managed database Advanced Threat Protection. + ManagedDatabaseAdvancedThreatProtection +} + +// ManagedDatabaseAdvancedThreatProtectionSettingsClientListByDatabaseResponse contains the response from method ManagedDatabaseAdvancedThreatProtectionSettingsClient.NewListByDatabasePager. +type ManagedDatabaseAdvancedThreatProtectionSettingsClientListByDatabaseResponse struct { + // A list of the managed database's Advanced Threat Protection settings. + ManagedDatabaseAdvancedThreatProtectionListResult +} + // ManagedDatabaseColumnsClientGetResponse contains the response from method ManagedDatabaseColumnsClient.Get. type ManagedDatabaseColumnsClientGetResponse struct { + // A database column resource. DatabaseColumn } // ManagedDatabaseColumnsClientListByDatabaseResponse contains the response from method ManagedDatabaseColumnsClient.NewListByDatabasePager. type ManagedDatabaseColumnsClientListByDatabaseResponse struct { + // A list of database columns. DatabaseColumnListResult } // ManagedDatabaseColumnsClientListByTableResponse contains the response from method ManagedDatabaseColumnsClient.NewListByTablePager. type ManagedDatabaseColumnsClientListByTableResponse struct { + // A list of database columns. DatabaseColumnListResult } +// ManagedDatabaseMoveOperationsClientGetResponse contains the response from method ManagedDatabaseMoveOperationsClient.Get. +type ManagedDatabaseMoveOperationsClientGetResponse struct { + // A managed database move operation. + ManagedDatabaseMoveOperationResult +} + +// ManagedDatabaseMoveOperationsClientListByLocationResponse contains the response from method ManagedDatabaseMoveOperationsClient.NewListByLocationPager. +type ManagedDatabaseMoveOperationsClientListByLocationResponse struct { + // List of managed database move operations. + ManagedDatabaseMoveOperationListResult +} + // ManagedDatabaseQueriesClientGetResponse contains the response from method ManagedDatabaseQueriesClient.Get. type ManagedDatabaseQueriesClientGetResponse struct { + // Database query. ManagedInstanceQuery } // ManagedDatabaseQueriesClientListByQueryResponse contains the response from method ManagedDatabaseQueriesClient.NewListByQueryPager. type ManagedDatabaseQueriesClientListByQueryResponse struct { + // Execution statistics for one particular query ManagedInstanceQueryStatistics } @@ -1083,41 +1362,49 @@ type ManagedDatabaseRecommendedSensitivityLabelsClientUpdateResponse struct { // ManagedDatabaseRestoreDetailsClientGetResponse contains the response from method ManagedDatabaseRestoreDetailsClient.Get. type ManagedDatabaseRestoreDetailsClientGetResponse struct { + // A managed database restore details. ManagedDatabaseRestoreDetailsResult } // ManagedDatabaseSchemasClientGetResponse contains the response from method ManagedDatabaseSchemasClient.Get. type ManagedDatabaseSchemasClientGetResponse struct { + // A database schema resource. DatabaseSchema } // ManagedDatabaseSchemasClientListByDatabaseResponse contains the response from method ManagedDatabaseSchemasClient.NewListByDatabasePager. type ManagedDatabaseSchemasClientListByDatabaseResponse struct { + // A list of database schemas. DatabaseSchemaListResult } // ManagedDatabaseSecurityAlertPoliciesClientCreateOrUpdateResponse contains the response from method ManagedDatabaseSecurityAlertPoliciesClient.CreateOrUpdate. type ManagedDatabaseSecurityAlertPoliciesClientCreateOrUpdateResponse struct { + // A managed database security alert policy. ManagedDatabaseSecurityAlertPolicy } // ManagedDatabaseSecurityAlertPoliciesClientGetResponse contains the response from method ManagedDatabaseSecurityAlertPoliciesClient.Get. type ManagedDatabaseSecurityAlertPoliciesClientGetResponse struct { + // A managed database security alert policy. ManagedDatabaseSecurityAlertPolicy } // ManagedDatabaseSecurityAlertPoliciesClientListByDatabaseResponse contains the response from method ManagedDatabaseSecurityAlertPoliciesClient.NewListByDatabasePager. type ManagedDatabaseSecurityAlertPoliciesClientListByDatabaseResponse struct { + // A list of the managed database's security alert policies. ManagedDatabaseSecurityAlertPolicyListResult } // ManagedDatabaseSecurityEventsClientListByDatabaseResponse contains the response from method ManagedDatabaseSecurityEventsClient.NewListByDatabasePager. type ManagedDatabaseSecurityEventsClientListByDatabaseResponse struct { + // A list of security events. SecurityEventCollection } // ManagedDatabaseSensitivityLabelsClientCreateOrUpdateResponse contains the response from method ManagedDatabaseSensitivityLabelsClient.CreateOrUpdate. type ManagedDatabaseSensitivityLabelsClientCreateOrUpdateResponse struct { + // A sensitivity label. SensitivityLabel } @@ -1138,16 +1425,25 @@ type ManagedDatabaseSensitivityLabelsClientEnableRecommendationResponse struct { // ManagedDatabaseSensitivityLabelsClientGetResponse contains the response from method ManagedDatabaseSensitivityLabelsClient.Get. type ManagedDatabaseSensitivityLabelsClientGetResponse struct { + // A sensitivity label. SensitivityLabel } +// ManagedDatabaseSensitivityLabelsClientListByDatabaseResponse contains the response from method ManagedDatabaseSensitivityLabelsClient.NewListByDatabasePager. +type ManagedDatabaseSensitivityLabelsClientListByDatabaseResponse struct { + // A list of sensitivity labels. + SensitivityLabelListResult +} + // ManagedDatabaseSensitivityLabelsClientListCurrentByDatabaseResponse contains the response from method ManagedDatabaseSensitivityLabelsClient.NewListCurrentByDatabasePager. type ManagedDatabaseSensitivityLabelsClientListCurrentByDatabaseResponse struct { + // A list of sensitivity labels. SensitivityLabelListResult } // ManagedDatabaseSensitivityLabelsClientListRecommendedByDatabaseResponse contains the response from method ManagedDatabaseSensitivityLabelsClient.NewListRecommendedByDatabasePager. type ManagedDatabaseSensitivityLabelsClientListRecommendedByDatabaseResponse struct { + // A list of sensitivity labels. SensitivityLabelListResult } @@ -1158,32 +1454,38 @@ type ManagedDatabaseSensitivityLabelsClientUpdateResponse struct { // ManagedDatabaseTablesClientGetResponse contains the response from method ManagedDatabaseTablesClient.Get. type ManagedDatabaseTablesClientGetResponse struct { + // A database table resource. DatabaseTable } // ManagedDatabaseTablesClientListBySchemaResponse contains the response from method ManagedDatabaseTablesClient.NewListBySchemaPager. type ManagedDatabaseTablesClientListBySchemaResponse struct { + // A list of database tables. DatabaseTableListResult } // ManagedDatabaseTransparentDataEncryptionClientCreateOrUpdateResponse contains the response from method ManagedDatabaseTransparentDataEncryptionClient.CreateOrUpdate. type ManagedDatabaseTransparentDataEncryptionClientCreateOrUpdateResponse struct { + // A managed database transparent data encryption state. ManagedTransparentDataEncryption } // ManagedDatabaseTransparentDataEncryptionClientGetResponse contains the response from method ManagedDatabaseTransparentDataEncryptionClient.Get. type ManagedDatabaseTransparentDataEncryptionClientGetResponse struct { + // A managed database transparent data encryption state. ManagedTransparentDataEncryption } // ManagedDatabaseTransparentDataEncryptionClientListByDatabaseResponse contains the response from method ManagedDatabaseTransparentDataEncryptionClient.NewListByDatabasePager. type ManagedDatabaseTransparentDataEncryptionClientListByDatabaseResponse struct { + // A list of managed transparent data encryptions ManagedTransparentDataEncryptionListResult } // ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClientCreateOrUpdateResponse contains the response from method ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient.CreateOrUpdate. type ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClientCreateOrUpdateResponse struct { - DatabaseVulnerabilityAssessmentRuleBaseline + // A database vulnerability assessment rule baseline. + DatabaseVulnerabilityAssessmentRuleBaselineAutoGenerated } // ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClientDeleteResponse contains the response from method ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient.Delete. @@ -1193,16 +1495,19 @@ type ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClientDeleteResponse str // ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClientGetResponse contains the response from method ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient.Get. type ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClientGetResponse struct { - DatabaseVulnerabilityAssessmentRuleBaseline + // A database vulnerability assessment rule baseline. + DatabaseVulnerabilityAssessmentRuleBaselineAutoGenerated } // ManagedDatabaseVulnerabilityAssessmentScansClientExportResponse contains the response from method ManagedDatabaseVulnerabilityAssessmentScansClient.Export. type ManagedDatabaseVulnerabilityAssessmentScansClientExportResponse struct { + // A database Vulnerability Assessment scan export resource. DatabaseVulnerabilityAssessmentScansExport } // ManagedDatabaseVulnerabilityAssessmentScansClientGetResponse contains the response from method ManagedDatabaseVulnerabilityAssessmentScansClient.Get. type ManagedDatabaseVulnerabilityAssessmentScansClientGetResponse struct { + // A vulnerability assessment scan record. VulnerabilityAssessmentScanRecord } @@ -1213,11 +1518,13 @@ type ManagedDatabaseVulnerabilityAssessmentScansClientInitiateScanResponse struc // ManagedDatabaseVulnerabilityAssessmentScansClientListByDatabaseResponse contains the response from method ManagedDatabaseVulnerabilityAssessmentScansClient.NewListByDatabasePager. type ManagedDatabaseVulnerabilityAssessmentScansClientListByDatabaseResponse struct { + // A list of vulnerability assessment scan records. VulnerabilityAssessmentScanRecordListResult } // ManagedDatabaseVulnerabilityAssessmentsClientCreateOrUpdateResponse contains the response from method ManagedDatabaseVulnerabilityAssessmentsClient.CreateOrUpdate. type ManagedDatabaseVulnerabilityAssessmentsClientCreateOrUpdateResponse struct { + // A database vulnerability assessment. DatabaseVulnerabilityAssessment } @@ -1228,14 +1535,26 @@ type ManagedDatabaseVulnerabilityAssessmentsClientDeleteResponse struct { // ManagedDatabaseVulnerabilityAssessmentsClientGetResponse contains the response from method ManagedDatabaseVulnerabilityAssessmentsClient.Get. type ManagedDatabaseVulnerabilityAssessmentsClientGetResponse struct { + // A database vulnerability assessment. DatabaseVulnerabilityAssessment } // ManagedDatabaseVulnerabilityAssessmentsClientListByDatabaseResponse contains the response from method ManagedDatabaseVulnerabilityAssessmentsClient.NewListByDatabasePager. type ManagedDatabaseVulnerabilityAssessmentsClientListByDatabaseResponse struct { + // A list of the database's vulnerability assessments. DatabaseVulnerabilityAssessmentListResult } +// ManagedDatabasesClientCancelMoveResponse contains the response from method ManagedDatabasesClient.BeginCancelMove. +type ManagedDatabasesClientCancelMoveResponse struct { + // placeholder for future response values +} + +// ManagedDatabasesClientCompleteMoveResponse contains the response from method ManagedDatabasesClient.BeginCompleteMove. +type ManagedDatabasesClientCompleteMoveResponse struct { + // placeholder for future response values +} + // ManagedDatabasesClientCompleteRestoreResponse contains the response from method ManagedDatabasesClient.BeginCompleteRestore. type ManagedDatabasesClientCompleteRestoreResponse struct { // placeholder for future response values @@ -1243,6 +1562,7 @@ type ManagedDatabasesClientCompleteRestoreResponse struct { // ManagedDatabasesClientCreateOrUpdateResponse contains the response from method ManagedDatabasesClient.BeginCreateOrUpdate. type ManagedDatabasesClientCreateOrUpdateResponse struct { + // A managed database resource. ManagedDatabase } @@ -1253,26 +1573,36 @@ type ManagedDatabasesClientDeleteResponse struct { // ManagedDatabasesClientGetResponse contains the response from method ManagedDatabasesClient.Get. type ManagedDatabasesClientGetResponse struct { + // A managed database resource. ManagedDatabase } // ManagedDatabasesClientListByInstanceResponse contains the response from method ManagedDatabasesClient.NewListByInstancePager. type ManagedDatabasesClientListByInstanceResponse struct { + // A list of managed databases. ManagedDatabaseListResult } // ManagedDatabasesClientListInaccessibleByInstanceResponse contains the response from method ManagedDatabasesClient.NewListInaccessibleByInstancePager. type ManagedDatabasesClientListInaccessibleByInstanceResponse struct { + // A list of managed databases. ManagedDatabaseListResult } +// ManagedDatabasesClientStartMoveResponse contains the response from method ManagedDatabasesClient.BeginStartMove. +type ManagedDatabasesClientStartMoveResponse struct { + // placeholder for future response values +} + // ManagedDatabasesClientUpdateResponse contains the response from method ManagedDatabasesClient.BeginUpdate. type ManagedDatabasesClientUpdateResponse struct { + // A managed database resource. ManagedDatabase } // ManagedInstanceAdministratorsClientCreateOrUpdateResponse contains the response from method ManagedInstanceAdministratorsClient.BeginCreateOrUpdate. type ManagedInstanceAdministratorsClientCreateOrUpdateResponse struct { + // An Azure SQL managed instance administrator. ManagedInstanceAdministrator } @@ -1283,16 +1613,37 @@ type ManagedInstanceAdministratorsClientDeleteResponse struct { // ManagedInstanceAdministratorsClientGetResponse contains the response from method ManagedInstanceAdministratorsClient.Get. type ManagedInstanceAdministratorsClientGetResponse struct { + // An Azure SQL managed instance administrator. ManagedInstanceAdministrator } // ManagedInstanceAdministratorsClientListByInstanceResponse contains the response from method ManagedInstanceAdministratorsClient.NewListByInstancePager. type ManagedInstanceAdministratorsClientListByInstanceResponse struct { + // A list of managed instance administrators. ManagedInstanceAdministratorListResult } +// ManagedInstanceAdvancedThreatProtectionSettingsClientCreateOrUpdateResponse contains the response from method ManagedInstanceAdvancedThreatProtectionSettingsClient.BeginCreateOrUpdate. +type ManagedInstanceAdvancedThreatProtectionSettingsClientCreateOrUpdateResponse struct { + // A managed instance Advanced Threat Protection. + ManagedInstanceAdvancedThreatProtection +} + +// ManagedInstanceAdvancedThreatProtectionSettingsClientGetResponse contains the response from method ManagedInstanceAdvancedThreatProtectionSettingsClient.Get. +type ManagedInstanceAdvancedThreatProtectionSettingsClientGetResponse struct { + // A managed instance Advanced Threat Protection. + ManagedInstanceAdvancedThreatProtection +} + +// ManagedInstanceAdvancedThreatProtectionSettingsClientListByInstanceResponse contains the response from method ManagedInstanceAdvancedThreatProtectionSettingsClient.NewListByInstancePager. +type ManagedInstanceAdvancedThreatProtectionSettingsClientListByInstanceResponse struct { + // A list of the managed instance's Advanced Threat Protection settings. + ManagedInstanceAdvancedThreatProtectionListResult +} + // ManagedInstanceAzureADOnlyAuthenticationsClientCreateOrUpdateResponse contains the response from method ManagedInstanceAzureADOnlyAuthenticationsClient.BeginCreateOrUpdate. type ManagedInstanceAzureADOnlyAuthenticationsClientCreateOrUpdateResponse struct { + // Azure Active Directory only authentication. ManagedInstanceAzureADOnlyAuthentication } @@ -1303,26 +1654,49 @@ type ManagedInstanceAzureADOnlyAuthenticationsClientDeleteResponse struct { // ManagedInstanceAzureADOnlyAuthenticationsClientGetResponse contains the response from method ManagedInstanceAzureADOnlyAuthenticationsClient.Get. type ManagedInstanceAzureADOnlyAuthenticationsClientGetResponse struct { + // Azure Active Directory only authentication. ManagedInstanceAzureADOnlyAuthentication } // ManagedInstanceAzureADOnlyAuthenticationsClientListByInstanceResponse contains the response from method ManagedInstanceAzureADOnlyAuthenticationsClient.NewListByInstancePager. type ManagedInstanceAzureADOnlyAuthenticationsClientListByInstanceResponse struct { + // A list of active directory only authentications. ManagedInstanceAzureADOnlyAuthListResult } +// ManagedInstanceDtcsClientCreateOrUpdateResponse contains the response from method ManagedInstanceDtcsClient.BeginCreateOrUpdate. +type ManagedInstanceDtcsClientCreateOrUpdateResponse struct { + // SQL Managed Instance DTC + ManagedInstanceDtc +} + +// ManagedInstanceDtcsClientGetResponse contains the response from method ManagedInstanceDtcsClient.Get. +type ManagedInstanceDtcsClientGetResponse struct { + // SQL Managed Instance DTC + ManagedInstanceDtc +} + +// ManagedInstanceDtcsClientListByManagedInstanceResponse contains the response from method ManagedInstanceDtcsClient.NewListByManagedInstancePager. +type ManagedInstanceDtcsClientListByManagedInstanceResponse struct { + // A list of managed instance's DTCs. + ManagedInstanceDtcListResult +} + // ManagedInstanceEncryptionProtectorsClientCreateOrUpdateResponse contains the response from method ManagedInstanceEncryptionProtectorsClient.BeginCreateOrUpdate. type ManagedInstanceEncryptionProtectorsClientCreateOrUpdateResponse struct { + // The managed instance encryption protector. ManagedInstanceEncryptionProtector } // ManagedInstanceEncryptionProtectorsClientGetResponse contains the response from method ManagedInstanceEncryptionProtectorsClient.Get. type ManagedInstanceEncryptionProtectorsClientGetResponse struct { + // The managed instance encryption protector. ManagedInstanceEncryptionProtector } // ManagedInstanceEncryptionProtectorsClientListByInstanceResponse contains the response from method ManagedInstanceEncryptionProtectorsClient.NewListByInstancePager. type ManagedInstanceEncryptionProtectorsClientListByInstanceResponse struct { + // A list of managed instance encryption protectors. ManagedInstanceEncryptionProtectorListResult } @@ -1333,6 +1707,7 @@ type ManagedInstanceEncryptionProtectorsClientRevalidateResponse struct { // ManagedInstanceKeysClientCreateOrUpdateResponse contains the response from method ManagedInstanceKeysClient.BeginCreateOrUpdate. type ManagedInstanceKeysClientCreateOrUpdateResponse struct { + // A managed instance key. ManagedInstanceKey } @@ -1343,26 +1718,37 @@ type ManagedInstanceKeysClientDeleteResponse struct { // ManagedInstanceKeysClientGetResponse contains the response from method ManagedInstanceKeysClient.Get. type ManagedInstanceKeysClientGetResponse struct { + // A managed instance key. ManagedInstanceKey } // ManagedInstanceKeysClientListByInstanceResponse contains the response from method ManagedInstanceKeysClient.NewListByInstancePager. type ManagedInstanceKeysClientListByInstanceResponse struct { + // A list of managed instance keys. ManagedInstanceKeyListResult } // ManagedInstanceLongTermRetentionPoliciesClientCreateOrUpdateResponse contains the response from method ManagedInstanceLongTermRetentionPoliciesClient.BeginCreateOrUpdate. type ManagedInstanceLongTermRetentionPoliciesClientCreateOrUpdateResponse struct { + // A long term retention policy. + ManagedInstanceLongTermRetentionPolicy +} + +// ManagedInstanceLongTermRetentionPoliciesClientDeleteResponse contains the response from method ManagedInstanceLongTermRetentionPoliciesClient.BeginDelete. +type ManagedInstanceLongTermRetentionPoliciesClientDeleteResponse struct { + // A long term retention policy. ManagedInstanceLongTermRetentionPolicy } // ManagedInstanceLongTermRetentionPoliciesClientGetResponse contains the response from method ManagedInstanceLongTermRetentionPoliciesClient.Get. type ManagedInstanceLongTermRetentionPoliciesClientGetResponse struct { + // A long term retention policy. ManagedInstanceLongTermRetentionPolicy } // ManagedInstanceLongTermRetentionPoliciesClientListByDatabaseResponse contains the response from method ManagedInstanceLongTermRetentionPoliciesClient.NewListByDatabasePager. type ManagedInstanceLongTermRetentionPoliciesClientListByDatabaseResponse struct { + // A list of long term retention policies. ManagedInstanceLongTermRetentionPolicyListResult } @@ -1373,16 +1759,19 @@ type ManagedInstanceOperationsClientCancelResponse struct { // ManagedInstanceOperationsClientGetResponse contains the response from method ManagedInstanceOperationsClient.Get. type ManagedInstanceOperationsClientGetResponse struct { + // A managed instance operation. ManagedInstanceOperation } // ManagedInstanceOperationsClientListByManagedInstanceResponse contains the response from method ManagedInstanceOperationsClient.NewListByManagedInstancePager. type ManagedInstanceOperationsClientListByManagedInstanceResponse struct { + // The response to a list managed instance operations request ManagedInstanceOperationListResult } // ManagedInstancePrivateEndpointConnectionsClientCreateOrUpdateResponse contains the response from method ManagedInstancePrivateEndpointConnectionsClient.BeginCreateOrUpdate. type ManagedInstancePrivateEndpointConnectionsClientCreateOrUpdateResponse struct { + // A private endpoint connection ManagedInstancePrivateEndpointConnection } @@ -1393,21 +1782,25 @@ type ManagedInstancePrivateEndpointConnectionsClientDeleteResponse struct { // ManagedInstancePrivateEndpointConnectionsClientGetResponse contains the response from method ManagedInstancePrivateEndpointConnectionsClient.Get. type ManagedInstancePrivateEndpointConnectionsClientGetResponse struct { + // A private endpoint connection ManagedInstancePrivateEndpointConnection } // ManagedInstancePrivateEndpointConnectionsClientListByManagedInstanceResponse contains the response from method ManagedInstancePrivateEndpointConnectionsClient.NewListByManagedInstancePager. type ManagedInstancePrivateEndpointConnectionsClientListByManagedInstanceResponse struct { + // A list of private endpoint connections. ManagedInstancePrivateEndpointConnectionListResult } // ManagedInstancePrivateLinkResourcesClientGetResponse contains the response from method ManagedInstancePrivateLinkResourcesClient.Get. type ManagedInstancePrivateLinkResourcesClientGetResponse struct { + // A private link resource ManagedInstancePrivateLink } // ManagedInstancePrivateLinkResourcesClientListByManagedInstanceResponse contains the response from method ManagedInstancePrivateLinkResourcesClient.NewListByManagedInstancePager. type ManagedInstancePrivateLinkResourcesClientListByManagedInstanceResponse struct { + // A list of private link resources ManagedInstancePrivateLinkListResult } @@ -1418,6 +1811,7 @@ type ManagedInstanceTdeCertificatesClientCreateResponse struct { // ManagedInstanceVulnerabilityAssessmentsClientCreateOrUpdateResponse contains the response from method ManagedInstanceVulnerabilityAssessmentsClient.CreateOrUpdate. type ManagedInstanceVulnerabilityAssessmentsClientCreateOrUpdateResponse struct { + // A managed instance vulnerability assessment. ManagedInstanceVulnerabilityAssessment } @@ -1428,16 +1822,19 @@ type ManagedInstanceVulnerabilityAssessmentsClientDeleteResponse struct { // ManagedInstanceVulnerabilityAssessmentsClientGetResponse contains the response from method ManagedInstanceVulnerabilityAssessmentsClient.Get. type ManagedInstanceVulnerabilityAssessmentsClientGetResponse struct { + // A managed instance vulnerability assessment. ManagedInstanceVulnerabilityAssessment } // ManagedInstanceVulnerabilityAssessmentsClientListByInstanceResponse contains the response from method ManagedInstanceVulnerabilityAssessmentsClient.NewListByInstancePager. type ManagedInstanceVulnerabilityAssessmentsClientListByInstanceResponse struct { + // A list of the ManagedInstance's vulnerability assessments. ManagedInstanceVulnerabilityAssessmentListResult } // ManagedInstancesClientCreateOrUpdateResponse contains the response from method ManagedInstancesClient.BeginCreateOrUpdate. type ManagedInstancesClientCreateOrUpdateResponse struct { + // An Azure SQL managed instance. ManagedInstance } @@ -1453,79 +1850,183 @@ type ManagedInstancesClientFailoverResponse struct { // ManagedInstancesClientGetResponse contains the response from method ManagedInstancesClient.Get. type ManagedInstancesClientGetResponse struct { + // An Azure SQL managed instance. ManagedInstance } // ManagedInstancesClientListByInstancePoolResponse contains the response from method ManagedInstancesClient.NewListByInstancePoolPager. type ManagedInstancesClientListByInstancePoolResponse struct { + // A list of managed instances. ManagedInstanceListResult } // ManagedInstancesClientListByManagedInstanceResponse contains the response from method ManagedInstancesClient.NewListByManagedInstancePager. type ManagedInstancesClientListByManagedInstanceResponse struct { + // A list of top resource consuming queries on managed instance TopQueriesListResult } // ManagedInstancesClientListByResourceGroupResponse contains the response from method ManagedInstancesClient.NewListByResourceGroupPager. type ManagedInstancesClientListByResourceGroupResponse struct { + // A list of managed instances. ManagedInstanceListResult } +// ManagedInstancesClientListOutboundNetworkDependenciesByManagedInstanceResponse contains the response from method ManagedInstancesClient.NewListOutboundNetworkDependenciesByManagedInstancePager. +type ManagedInstancesClientListOutboundNetworkDependenciesByManagedInstanceResponse struct { + // A collection of endpoints that the managed instance service requires outbound network access to. + OutboundEnvironmentEndpointCollection +} + // ManagedInstancesClientListResponse contains the response from method ManagedInstancesClient.NewListPager. type ManagedInstancesClientListResponse struct { + // A list of managed instances. ManagedInstanceListResult } +// ManagedInstancesClientStartResponse contains the response from method ManagedInstancesClient.BeginStart. +type ManagedInstancesClientStartResponse struct { + // An Azure SQL managed instance. + ManagedInstance +} + +// ManagedInstancesClientStopResponse contains the response from method ManagedInstancesClient.BeginStop. +type ManagedInstancesClientStopResponse struct { + // An Azure SQL managed instance. + ManagedInstance +} + // ManagedInstancesClientUpdateResponse contains the response from method ManagedInstancesClient.BeginUpdate. type ManagedInstancesClientUpdateResponse struct { + // An Azure SQL managed instance. ManagedInstance } +// ManagedLedgerDigestUploadsClientCreateOrUpdateResponse contains the response from method ManagedLedgerDigestUploadsClient.BeginCreateOrUpdate. +type ManagedLedgerDigestUploadsClientCreateOrUpdateResponse struct { + // Azure SQL Database ledger digest upload settings. + ManagedLedgerDigestUploads +} + +// ManagedLedgerDigestUploadsClientDisableResponse contains the response from method ManagedLedgerDigestUploadsClient.BeginDisable. +type ManagedLedgerDigestUploadsClientDisableResponse struct { + // Azure SQL Database ledger digest upload settings. + ManagedLedgerDigestUploads +} + +// ManagedLedgerDigestUploadsClientGetResponse contains the response from method ManagedLedgerDigestUploadsClient.Get. +type ManagedLedgerDigestUploadsClientGetResponse struct { + // Azure SQL Database ledger digest upload settings. + ManagedLedgerDigestUploads +} + +// ManagedLedgerDigestUploadsClientListByDatabaseResponse contains the response from method ManagedLedgerDigestUploadsClient.NewListByDatabasePager. +type ManagedLedgerDigestUploadsClientListByDatabaseResponse struct { + // A list of ledger digest upload settings. + ManagedLedgerDigestUploadsListResult +} + // ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClientCreateOrUpdateResponse contains the response from // method ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClient.BeginCreateOrUpdate. type ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClientCreateOrUpdateResponse struct { + // A short term retention policy. ManagedBackupShortTermRetentionPolicy } // ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClientGetResponse contains the response from method ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClient.Get. type ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClientGetResponse struct { + // A short term retention policy. ManagedBackupShortTermRetentionPolicy } // ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClientListByRestorableDroppedDatabaseResponse contains // the response from method ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClient.NewListByRestorableDroppedDatabasePager. type ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClientListByRestorableDroppedDatabaseResponse struct { + // A list of short term retention policies. ManagedBackupShortTermRetentionPolicyListResult } // ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClientUpdateResponse contains the response from method // ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClient.BeginUpdate. type ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClientUpdateResponse struct { + // A short term retention policy. ManagedBackupShortTermRetentionPolicy } +// ManagedServerDNSAliasesClientAcquireResponse contains the response from method ManagedServerDNSAliasesClient.BeginAcquire. +type ManagedServerDNSAliasesClientAcquireResponse struct { + // A managed server DNS alias. + ManagedServerDNSAlias +} + +// ManagedServerDNSAliasesClientCreateOrUpdateResponse contains the response from method ManagedServerDNSAliasesClient.BeginCreateOrUpdate. +type ManagedServerDNSAliasesClientCreateOrUpdateResponse struct { + // A managed server DNS alias. + ManagedServerDNSAlias +} + +// ManagedServerDNSAliasesClientDeleteResponse contains the response from method ManagedServerDNSAliasesClient.BeginDelete. +type ManagedServerDNSAliasesClientDeleteResponse struct { + // placeholder for future response values +} + +// ManagedServerDNSAliasesClientGetResponse contains the response from method ManagedServerDNSAliasesClient.Get. +type ManagedServerDNSAliasesClientGetResponse struct { + // A managed server DNS alias. + ManagedServerDNSAlias +} + +// ManagedServerDNSAliasesClientListByManagedInstanceResponse contains the response from method ManagedServerDNSAliasesClient.NewListByManagedInstancePager. +type ManagedServerDNSAliasesClientListByManagedInstanceResponse struct { + // A list of managed server DNS aliases. + ManagedServerDNSAliasListResult +} + // ManagedServerSecurityAlertPoliciesClientCreateOrUpdateResponse contains the response from method ManagedServerSecurityAlertPoliciesClient.BeginCreateOrUpdate. type ManagedServerSecurityAlertPoliciesClientCreateOrUpdateResponse struct { + // A managed server security alert policy. ManagedServerSecurityAlertPolicy } // ManagedServerSecurityAlertPoliciesClientGetResponse contains the response from method ManagedServerSecurityAlertPoliciesClient.Get. type ManagedServerSecurityAlertPoliciesClientGetResponse struct { + // A managed server security alert policy. ManagedServerSecurityAlertPolicy } // ManagedServerSecurityAlertPoliciesClientListByInstanceResponse contains the response from method ManagedServerSecurityAlertPoliciesClient.NewListByInstancePager. type ManagedServerSecurityAlertPoliciesClientListByInstanceResponse struct { + // A list of the managed Server's security alert policies. ManagedServerSecurityAlertPolicyListResult } +// NetworkSecurityPerimeterConfigurationsClientGetResponse contains the response from method NetworkSecurityPerimeterConfigurationsClient.Get. +type NetworkSecurityPerimeterConfigurationsClientGetResponse struct { + // NSP Configuration for a server. + NetworkSecurityPerimeterConfiguration +} + +// NetworkSecurityPerimeterConfigurationsClientListByServerResponse contains the response from method NetworkSecurityPerimeterConfigurationsClient.NewListByServerPager. +type NetworkSecurityPerimeterConfigurationsClientListByServerResponse struct { + // A list of NSP configurations for a server. + NetworkSecurityPerimeterConfigurationListResult +} + +// NetworkSecurityPerimeterConfigurationsClientReconcileResponse contains the response from method NetworkSecurityPerimeterConfigurationsClient.BeginReconcile. +type NetworkSecurityPerimeterConfigurationsClientReconcileResponse struct { + // NSP Configuration for a server. + NetworkSecurityPerimeterConfiguration +} + // OperationsClientListResponse contains the response from method OperationsClient.NewListPager. type OperationsClientListResponse struct { + // Result of the request to list SQL operations. OperationListResult } // OutboundFirewallRulesClientCreateOrUpdateResponse contains the response from method OutboundFirewallRulesClient.BeginCreateOrUpdate. type OutboundFirewallRulesClientCreateOrUpdateResponse struct { + // An Azure SQL DB Server Outbound Firewall Rule. OutboundFirewallRule } @@ -1536,16 +2037,19 @@ type OutboundFirewallRulesClientDeleteResponse struct { // OutboundFirewallRulesClientGetResponse contains the response from method OutboundFirewallRulesClient.Get. type OutboundFirewallRulesClientGetResponse struct { + // An Azure SQL DB Server Outbound Firewall Rule. OutboundFirewallRule } // OutboundFirewallRulesClientListByServerResponse contains the response from method OutboundFirewallRulesClient.NewListByServerPager. type OutboundFirewallRulesClientListByServerResponse struct { + // A list of outbound rules. OutboundFirewallRuleListResult } // PrivateEndpointConnectionsClientCreateOrUpdateResponse contains the response from method PrivateEndpointConnectionsClient.BeginCreateOrUpdate. type PrivateEndpointConnectionsClientCreateOrUpdateResponse struct { + // A private endpoint connection PrivateEndpointConnection } @@ -1556,21 +2060,25 @@ type PrivateEndpointConnectionsClientDeleteResponse struct { // PrivateEndpointConnectionsClientGetResponse contains the response from method PrivateEndpointConnectionsClient.Get. type PrivateEndpointConnectionsClientGetResponse struct { + // A private endpoint connection PrivateEndpointConnection } // PrivateEndpointConnectionsClientListByServerResponse contains the response from method PrivateEndpointConnectionsClient.NewListByServerPager. type PrivateEndpointConnectionsClientListByServerResponse struct { + // A list of private endpoint connections. PrivateEndpointConnectionListResult } // PrivateLinkResourcesClientGetResponse contains the response from method PrivateLinkResourcesClient.Get. type PrivateLinkResourcesClientGetResponse struct { + // A private link resource PrivateLinkResource } // PrivateLinkResourcesClientListByServerResponse contains the response from method PrivateLinkResourcesClient.NewListByServerPager. type PrivateLinkResourcesClientListByServerResponse struct { + // A list of private link resources PrivateLinkResourceListResult } @@ -1581,76 +2089,90 @@ type RecommendedSensitivityLabelsClientUpdateResponse struct { // RecoverableDatabasesClientGetResponse contains the response from method RecoverableDatabasesClient.Get. type RecoverableDatabasesClientGetResponse struct { + // A recoverable database resource. RecoverableDatabase } // RecoverableDatabasesClientListByServerResponse contains the response from method RecoverableDatabasesClient.NewListByServerPager. type RecoverableDatabasesClientListByServerResponse struct { + // A list of recoverable databases. RecoverableDatabaseListResult } // RecoverableManagedDatabasesClientGetResponse contains the response from method RecoverableManagedDatabasesClient.Get. type RecoverableManagedDatabasesClientGetResponse struct { + // A recoverable managed database resource. RecoverableManagedDatabase } // RecoverableManagedDatabasesClientListByInstanceResponse contains the response from method RecoverableManagedDatabasesClient.NewListByInstancePager. type RecoverableManagedDatabasesClientListByInstanceResponse struct { + // A list of recoverable managed databases. RecoverableManagedDatabaseListResult } -// ReplicationLinksClientDeleteResponse contains the response from method ReplicationLinksClient.Delete. +// ReplicationLinksClientDeleteResponse contains the response from method ReplicationLinksClient.BeginDelete. type ReplicationLinksClientDeleteResponse struct { // placeholder for future response values } // ReplicationLinksClientFailoverAllowDataLossResponse contains the response from method ReplicationLinksClient.BeginFailoverAllowDataLoss. type ReplicationLinksClientFailoverAllowDataLossResponse struct { + // A replication link. ReplicationLink } // ReplicationLinksClientFailoverResponse contains the response from method ReplicationLinksClient.BeginFailover. type ReplicationLinksClientFailoverResponse struct { + // A replication link. ReplicationLink } // ReplicationLinksClientGetResponse contains the response from method ReplicationLinksClient.Get. type ReplicationLinksClientGetResponse struct { + // A replication link. ReplicationLink } // ReplicationLinksClientListByDatabaseResponse contains the response from method ReplicationLinksClient.NewListByDatabasePager. type ReplicationLinksClientListByDatabaseResponse struct { + // A list of replication links. ReplicationLinkListResult } // ReplicationLinksClientListByServerResponse contains the response from method ReplicationLinksClient.NewListByServerPager. type ReplicationLinksClientListByServerResponse struct { + // A list of replication links. ReplicationLinkListResult } // RestorableDroppedDatabasesClientGetResponse contains the response from method RestorableDroppedDatabasesClient.Get. type RestorableDroppedDatabasesClientGetResponse struct { + // A restorable dropped database resource. RestorableDroppedDatabase } // RestorableDroppedDatabasesClientListByServerResponse contains the response from method RestorableDroppedDatabasesClient.NewListByServerPager. type RestorableDroppedDatabasesClientListByServerResponse struct { + // A list of restorable dropped databases. RestorableDroppedDatabaseListResult } // RestorableDroppedManagedDatabasesClientGetResponse contains the response from method RestorableDroppedManagedDatabasesClient.Get. type RestorableDroppedManagedDatabasesClientGetResponse struct { + // A restorable dropped managed database resource. RestorableDroppedManagedDatabase } // RestorableDroppedManagedDatabasesClientListByInstanceResponse contains the response from method RestorableDroppedManagedDatabasesClient.NewListByInstancePager. type RestorableDroppedManagedDatabasesClientListByInstanceResponse struct { + // A list of restorable dropped managed databases. RestorableDroppedManagedDatabaseListResult } // RestorePointsClientCreateResponse contains the response from method RestorePointsClient.BeginCreate. type RestorePointsClientCreateResponse struct { + // Database restore points. RestorePoint } @@ -1661,16 +2183,19 @@ type RestorePointsClientDeleteResponse struct { // RestorePointsClientGetResponse contains the response from method RestorePointsClient.Get. type RestorePointsClientGetResponse struct { + // Database restore points. RestorePoint } // RestorePointsClientListByDatabaseResponse contains the response from method RestorePointsClient.NewListByDatabasePager. type RestorePointsClientListByDatabaseResponse struct { + // A list of long term retention backups. RestorePointListResult } // SensitivityLabelsClientCreateOrUpdateResponse contains the response from method SensitivityLabelsClient.CreateOrUpdate. type SensitivityLabelsClientCreateOrUpdateResponse struct { + // A sensitivity label. SensitivityLabel } @@ -1691,16 +2216,25 @@ type SensitivityLabelsClientEnableRecommendationResponse struct { // SensitivityLabelsClientGetResponse contains the response from method SensitivityLabelsClient.Get. type SensitivityLabelsClientGetResponse struct { + // A sensitivity label. SensitivityLabel } +// SensitivityLabelsClientListByDatabaseResponse contains the response from method SensitivityLabelsClient.NewListByDatabasePager. +type SensitivityLabelsClientListByDatabaseResponse struct { + // A list of sensitivity labels. + SensitivityLabelListResult +} + // SensitivityLabelsClientListCurrentByDatabaseResponse contains the response from method SensitivityLabelsClient.NewListCurrentByDatabasePager. type SensitivityLabelsClientListCurrentByDatabaseResponse struct { + // A list of sensitivity labels. SensitivityLabelListResult } // SensitivityLabelsClientListRecommendedByDatabaseResponse contains the response from method SensitivityLabelsClient.NewListRecommendedByDatabasePager. type SensitivityLabelsClientListRecommendedByDatabaseResponse struct { + // A list of sensitivity labels. SensitivityLabelListResult } @@ -1711,21 +2245,25 @@ type SensitivityLabelsClientUpdateResponse struct { // ServerAdvancedThreatProtectionSettingsClientCreateOrUpdateResponse contains the response from method ServerAdvancedThreatProtectionSettingsClient.BeginCreateOrUpdate. type ServerAdvancedThreatProtectionSettingsClientCreateOrUpdateResponse struct { + // A server Advanced Threat Protection. ServerAdvancedThreatProtection } // ServerAdvancedThreatProtectionSettingsClientGetResponse contains the response from method ServerAdvancedThreatProtectionSettingsClient.Get. type ServerAdvancedThreatProtectionSettingsClientGetResponse struct { + // A server Advanced Threat Protection. ServerAdvancedThreatProtection } // ServerAdvancedThreatProtectionSettingsClientListByServerResponse contains the response from method ServerAdvancedThreatProtectionSettingsClient.NewListByServerPager. type ServerAdvancedThreatProtectionSettingsClientListByServerResponse struct { + // A list of the server's Advanced Threat Protection configurations. LogicalServerAdvancedThreatProtectionListResult } // ServerAdvisorsClientGetResponse contains the response from method ServerAdvisorsClient.Get. type ServerAdvisorsClientGetResponse struct { + // Database, Server or Elastic Pool Advisor. Advisor } @@ -1737,21 +2275,25 @@ type ServerAdvisorsClientListByServerResponse struct { // ServerAdvisorsClientUpdateResponse contains the response from method ServerAdvisorsClient.Update. type ServerAdvisorsClientUpdateResponse struct { + // Database, Server or Elastic Pool Advisor. Advisor } // ServerAutomaticTuningClientGetResponse contains the response from method ServerAutomaticTuningClient.Get. type ServerAutomaticTuningClientGetResponse struct { + // Server-level Automatic Tuning. ServerAutomaticTuning } // ServerAutomaticTuningClientUpdateResponse contains the response from method ServerAutomaticTuningClient.Update. type ServerAutomaticTuningClientUpdateResponse struct { + // Server-level Automatic Tuning. ServerAutomaticTuning } // ServerAzureADAdministratorsClientCreateOrUpdateResponse contains the response from method ServerAzureADAdministratorsClient.BeginCreateOrUpdate. type ServerAzureADAdministratorsClientCreateOrUpdateResponse struct { + // Azure Active Directory administrator. ServerAzureADAdministrator } @@ -1762,16 +2304,19 @@ type ServerAzureADAdministratorsClientDeleteResponse struct { // ServerAzureADAdministratorsClientGetResponse contains the response from method ServerAzureADAdministratorsClient.Get. type ServerAzureADAdministratorsClientGetResponse struct { + // Azure Active Directory administrator. ServerAzureADAdministrator } // ServerAzureADAdministratorsClientListByServerResponse contains the response from method ServerAzureADAdministratorsClient.NewListByServerPager. type ServerAzureADAdministratorsClientListByServerResponse struct { + // A list of active directory administrators. AdministratorListResult } // ServerAzureADOnlyAuthenticationsClientCreateOrUpdateResponse contains the response from method ServerAzureADOnlyAuthenticationsClient.BeginCreateOrUpdate. type ServerAzureADOnlyAuthenticationsClientCreateOrUpdateResponse struct { + // Azure Active Directory only authentication. ServerAzureADOnlyAuthentication } @@ -1782,71 +2327,79 @@ type ServerAzureADOnlyAuthenticationsClientDeleteResponse struct { // ServerAzureADOnlyAuthenticationsClientGetResponse contains the response from method ServerAzureADOnlyAuthenticationsClient.Get. type ServerAzureADOnlyAuthenticationsClientGetResponse struct { + // Azure Active Directory only authentication. ServerAzureADOnlyAuthentication } // ServerAzureADOnlyAuthenticationsClientListByServerResponse contains the response from method ServerAzureADOnlyAuthenticationsClient.NewListByServerPager. type ServerAzureADOnlyAuthenticationsClientListByServerResponse struct { + // A list of active directory only authentications. AzureADOnlyAuthListResult } // ServerBlobAuditingPoliciesClientCreateOrUpdateResponse contains the response from method ServerBlobAuditingPoliciesClient.BeginCreateOrUpdate. type ServerBlobAuditingPoliciesClientCreateOrUpdateResponse struct { + // A server blob auditing policy. ServerBlobAuditingPolicy } // ServerBlobAuditingPoliciesClientGetResponse contains the response from method ServerBlobAuditingPoliciesClient.Get. type ServerBlobAuditingPoliciesClientGetResponse struct { + // A server blob auditing policy. ServerBlobAuditingPolicy } // ServerBlobAuditingPoliciesClientListByServerResponse contains the response from method ServerBlobAuditingPoliciesClient.NewListByServerPager. type ServerBlobAuditingPoliciesClientListByServerResponse struct { + // A list of server auditing settings. ServerBlobAuditingPolicyListResult } -// ServerCommunicationLinksClientCreateOrUpdateResponse contains the response from method ServerCommunicationLinksClient.BeginCreateOrUpdate. -type ServerCommunicationLinksClientCreateOrUpdateResponse struct { - ServerCommunicationLink -} - -// ServerCommunicationLinksClientDeleteResponse contains the response from method ServerCommunicationLinksClient.Delete. -type ServerCommunicationLinksClientDeleteResponse struct { - // placeholder for future response values +// ServerConfigurationOptionsClientCreateOrUpdateResponse contains the response from method ServerConfigurationOptionsClient.BeginCreateOrUpdate. +type ServerConfigurationOptionsClientCreateOrUpdateResponse struct { + // A server configuration option + ServerConfigurationOption } -// ServerCommunicationLinksClientGetResponse contains the response from method ServerCommunicationLinksClient.Get. -type ServerCommunicationLinksClientGetResponse struct { - ServerCommunicationLink +// ServerConfigurationOptionsClientGetResponse contains the response from method ServerConfigurationOptionsClient.Get. +type ServerConfigurationOptionsClientGetResponse struct { + // A server configuration option + ServerConfigurationOption } -// ServerCommunicationLinksClientListByServerResponse contains the response from method ServerCommunicationLinksClient.NewListByServerPager. -type ServerCommunicationLinksClientListByServerResponse struct { - ServerCommunicationLinkListResult +// ServerConfigurationOptionsClientListByManagedInstanceResponse contains the response from method ServerConfigurationOptionsClient.NewListByManagedInstancePager. +type ServerConfigurationOptionsClientListByManagedInstanceResponse struct { + // A list of server configuration options. + ServerConfigurationOptionListResult } // ServerConnectionPoliciesClientCreateOrUpdateResponse contains the response from method ServerConnectionPoliciesClient.BeginCreateOrUpdate. type ServerConnectionPoliciesClientCreateOrUpdateResponse struct { + // A server connection policy ServerConnectionPolicy } // ServerConnectionPoliciesClientGetResponse contains the response from method ServerConnectionPoliciesClient.Get. type ServerConnectionPoliciesClientGetResponse struct { + // A server connection policy ServerConnectionPolicy } // ServerConnectionPoliciesClientListByServerResponse contains the response from method ServerConnectionPoliciesClient.NewListByServerPager. type ServerConnectionPoliciesClientListByServerResponse struct { + // A list of server connection policy objects. ServerConnectionPolicyListResult } // ServerDNSAliasesClientAcquireResponse contains the response from method ServerDNSAliasesClient.BeginAcquire. type ServerDNSAliasesClientAcquireResponse struct { + // A server DNS alias. ServerDNSAlias } // ServerDNSAliasesClientCreateOrUpdateResponse contains the response from method ServerDNSAliasesClient.BeginCreateOrUpdate. type ServerDNSAliasesClientCreateOrUpdateResponse struct { + // A server DNS alias. ServerDNSAlias } @@ -1857,31 +2410,37 @@ type ServerDNSAliasesClientDeleteResponse struct { // ServerDNSAliasesClientGetResponse contains the response from method ServerDNSAliasesClient.Get. type ServerDNSAliasesClientGetResponse struct { + // A server DNS alias. ServerDNSAlias } // ServerDNSAliasesClientListByServerResponse contains the response from method ServerDNSAliasesClient.NewListByServerPager. type ServerDNSAliasesClientListByServerResponse struct { + // A list of server DNS aliases. ServerDNSAliasListResult } // ServerDevOpsAuditSettingsClientCreateOrUpdateResponse contains the response from method ServerDevOpsAuditSettingsClient.BeginCreateOrUpdate. type ServerDevOpsAuditSettingsClientCreateOrUpdateResponse struct { + // A server DevOps auditing settings. ServerDevOpsAuditingSettings } // ServerDevOpsAuditSettingsClientGetResponse contains the response from method ServerDevOpsAuditSettingsClient.Get. type ServerDevOpsAuditSettingsClientGetResponse struct { + // A server DevOps auditing settings. ServerDevOpsAuditingSettings } // ServerDevOpsAuditSettingsClientListByServerResponse contains the response from method ServerDevOpsAuditSettingsClient.NewListByServerPager. type ServerDevOpsAuditSettingsClientListByServerResponse struct { + // A list of server DevOps audit settings. ServerDevOpsAuditSettingsListResult } // ServerKeysClientCreateOrUpdateResponse contains the response from method ServerKeysClient.BeginCreateOrUpdate. type ServerKeysClientCreateOrUpdateResponse struct { + // A server key. ServerKey } @@ -1892,36 +2451,43 @@ type ServerKeysClientDeleteResponse struct { // ServerKeysClientGetResponse contains the response from method ServerKeysClient.Get. type ServerKeysClientGetResponse struct { + // A server key. ServerKey } // ServerKeysClientListByServerResponse contains the response from method ServerKeysClient.NewListByServerPager. type ServerKeysClientListByServerResponse struct { + // A list of server keys. ServerKeyListResult } // ServerOperationsClientListByServerResponse contains the response from method ServerOperationsClient.NewListByServerPager. type ServerOperationsClientListByServerResponse struct { + // The response to a list server operations request ServerOperationListResult } // ServerSecurityAlertPoliciesClientCreateOrUpdateResponse contains the response from method ServerSecurityAlertPoliciesClient.BeginCreateOrUpdate. type ServerSecurityAlertPoliciesClientCreateOrUpdateResponse struct { + // A server security alert policy. ServerSecurityAlertPolicy } // ServerSecurityAlertPoliciesClientGetResponse contains the response from method ServerSecurityAlertPoliciesClient.Get. type ServerSecurityAlertPoliciesClientGetResponse struct { + // A server security alert policy. ServerSecurityAlertPolicy } // ServerSecurityAlertPoliciesClientListByServerResponse contains the response from method ServerSecurityAlertPoliciesClient.NewListByServerPager. type ServerSecurityAlertPoliciesClientListByServerResponse struct { + // A list of the server's security alert policies. LogicalServerSecurityAlertPolicyListResult } // ServerTrustCertificatesClientCreateOrUpdateResponse contains the response from method ServerTrustCertificatesClient.BeginCreateOrUpdate. type ServerTrustCertificatesClientCreateOrUpdateResponse struct { + // Server trust certificate imported from box to enable connection between box and Sql Managed Instance. ServerTrustCertificate } @@ -1932,16 +2498,19 @@ type ServerTrustCertificatesClientDeleteResponse struct { // ServerTrustCertificatesClientGetResponse contains the response from method ServerTrustCertificatesClient.Get. type ServerTrustCertificatesClientGetResponse struct { + // Server trust certificate imported from box to enable connection between box and Sql Managed Instance. ServerTrustCertificate } // ServerTrustCertificatesClientListByInstanceResponse contains the response from method ServerTrustCertificatesClient.NewListByInstancePager. type ServerTrustCertificatesClientListByInstanceResponse struct { + // A list of server trust certificates in instance. ServerTrustCertificatesListResult } // ServerTrustGroupsClientCreateOrUpdateResponse contains the response from method ServerTrustGroupsClient.BeginCreateOrUpdate. type ServerTrustGroupsClientCreateOrUpdateResponse struct { + // A server trust group. ServerTrustGroup } @@ -1952,26 +2521,31 @@ type ServerTrustGroupsClientDeleteResponse struct { // ServerTrustGroupsClientGetResponse contains the response from method ServerTrustGroupsClient.Get. type ServerTrustGroupsClientGetResponse struct { + // A server trust group. ServerTrustGroup } // ServerTrustGroupsClientListByInstanceResponse contains the response from method ServerTrustGroupsClient.NewListByInstancePager. type ServerTrustGroupsClientListByInstanceResponse struct { + // A list of server trust groups. ServerTrustGroupListResult } // ServerTrustGroupsClientListByLocationResponse contains the response from method ServerTrustGroupsClient.NewListByLocationPager. type ServerTrustGroupsClientListByLocationResponse struct { + // A list of server trust groups. ServerTrustGroupListResult } // ServerUsagesClientListByServerResponse contains the response from method ServerUsagesClient.NewListByServerPager. type ServerUsagesClientListByServerResponse struct { + // A list of server usage metrics. ServerUsageListResult } // ServerVulnerabilityAssessmentsClientCreateOrUpdateResponse contains the response from method ServerVulnerabilityAssessmentsClient.CreateOrUpdate. type ServerVulnerabilityAssessmentsClientCreateOrUpdateResponse struct { + // A server vulnerability assessment. ServerVulnerabilityAssessment } @@ -1982,21 +2556,25 @@ type ServerVulnerabilityAssessmentsClientDeleteResponse struct { // ServerVulnerabilityAssessmentsClientGetResponse contains the response from method ServerVulnerabilityAssessmentsClient.Get. type ServerVulnerabilityAssessmentsClientGetResponse struct { + // A server vulnerability assessment. ServerVulnerabilityAssessment } // ServerVulnerabilityAssessmentsClientListByServerResponse contains the response from method ServerVulnerabilityAssessmentsClient.NewListByServerPager. type ServerVulnerabilityAssessmentsClientListByServerResponse struct { + // A list of the server's vulnerability assessments. ServerVulnerabilityAssessmentListResult } // ServersClientCheckNameAvailabilityResponse contains the response from method ServersClient.CheckNameAvailability. type ServersClientCheckNameAvailabilityResponse struct { + // The result of a name availability check. CheckNameAvailabilityResponse } // ServersClientCreateOrUpdateResponse contains the response from method ServersClient.BeginCreateOrUpdate. type ServersClientCreateOrUpdateResponse struct { + // An Azure SQL Database server. Server } @@ -2007,51 +2585,84 @@ type ServersClientDeleteResponse struct { // ServersClientGetResponse contains the response from method ServersClient.Get. type ServersClientGetResponse struct { + // An Azure SQL Database server. Server } // ServersClientImportDatabaseResponse contains the response from method ServersClient.BeginImportDatabase. type ServersClientImportDatabaseResponse struct { + // An ImportExport operation result resource. ImportExportOperationResult } // ServersClientListByResourceGroupResponse contains the response from method ServersClient.NewListByResourceGroupPager. type ServersClientListByResourceGroupResponse struct { + // A list of servers. ServerListResult } // ServersClientListResponse contains the response from method ServersClient.NewListPager. type ServersClientListResponse struct { + // A list of servers. ServerListResult } +// ServersClientRefreshStatusResponse contains the response from method ServersClient.BeginRefreshStatus. +type ServersClientRefreshStatusResponse struct { + // An RefreshExternalGovernanceStatus operation result resource. + RefreshExternalGovernanceStatusOperationResult +} + // ServersClientUpdateResponse contains the response from method ServersClient.BeginUpdate. type ServersClientUpdateResponse struct { + // An Azure SQL Database server. Server } -// ServiceObjectivesClientGetResponse contains the response from method ServiceObjectivesClient.Get. -type ServiceObjectivesClientGetResponse struct { - ServiceObjective +// StartStopManagedInstanceSchedulesClientCreateOrUpdateResponse contains the response from method StartStopManagedInstanceSchedulesClient.CreateOrUpdate. +type StartStopManagedInstanceSchedulesClientCreateOrUpdateResponse struct { + // Managed instance's Start/Stop schedule. + StartStopManagedInstanceSchedule +} + +// StartStopManagedInstanceSchedulesClientDeleteResponse contains the response from method StartStopManagedInstanceSchedulesClient.Delete. +type StartStopManagedInstanceSchedulesClientDeleteResponse struct { + // placeholder for future response values } -// ServiceObjectivesClientListByServerResponse contains the response from method ServiceObjectivesClient.NewListByServerPager. -type ServiceObjectivesClientListByServerResponse struct { - ServiceObjectiveListResult +// StartStopManagedInstanceSchedulesClientGetResponse contains the response from method StartStopManagedInstanceSchedulesClient.Get. +type StartStopManagedInstanceSchedulesClientGetResponse struct { + // Managed instance's Start/Stop schedule. + StartStopManagedInstanceSchedule +} + +// StartStopManagedInstanceSchedulesClientListByInstanceResponse contains the response from method StartStopManagedInstanceSchedulesClient.NewListByInstancePager. +type StartStopManagedInstanceSchedulesClientListByInstanceResponse struct { + // Managed instance's Start/Stop schedule list result. + StartStopManagedInstanceScheduleListResult } // SubscriptionUsagesClientGetResponse contains the response from method SubscriptionUsagesClient.Get. type SubscriptionUsagesClientGetResponse struct { + // Usage Metric of a Subscription in a Location. SubscriptionUsage } // SubscriptionUsagesClientListByLocationResponse contains the response from method SubscriptionUsagesClient.NewListByLocationPager. type SubscriptionUsagesClientListByLocationResponse struct { + // A list of subscription usage metrics in a location. SubscriptionUsageListResult } +// SynapseLinkWorkspacesClientListByDatabaseResponse contains the response from method SynapseLinkWorkspacesClient.NewListByDatabasePager. +type SynapseLinkWorkspacesClientListByDatabaseResponse struct { + // A list of synapselink workspaces + SynapseLinkWorkspaceListResult +} + // SyncAgentsClientCreateOrUpdateResponse contains the response from method SyncAgentsClient.BeginCreateOrUpdate. type SyncAgentsClientCreateOrUpdateResponse struct { + // An Azure SQL Database sync agent. SyncAgent } @@ -2062,21 +2673,25 @@ type SyncAgentsClientDeleteResponse struct { // SyncAgentsClientGenerateKeyResponse contains the response from method SyncAgentsClient.GenerateKey. type SyncAgentsClientGenerateKeyResponse struct { + // Properties of an Azure SQL Database sync agent key. SyncAgentKeyProperties } // SyncAgentsClientGetResponse contains the response from method SyncAgentsClient.Get. type SyncAgentsClientGetResponse struct { + // An Azure SQL Database sync agent. SyncAgent } // SyncAgentsClientListByServerResponse contains the response from method SyncAgentsClient.NewListByServerPager. type SyncAgentsClientListByServerResponse struct { + // A list of sync agents. SyncAgentListResult } // SyncAgentsClientListLinkedDatabasesResponse contains the response from method SyncAgentsClient.NewListLinkedDatabasesPager. type SyncAgentsClientListLinkedDatabasesResponse struct { + // A list of sync agent linked databases. SyncAgentLinkedDatabaseListResult } @@ -2087,6 +2702,7 @@ type SyncGroupsClientCancelSyncResponse struct { // SyncGroupsClientCreateOrUpdateResponse contains the response from method SyncGroupsClient.BeginCreateOrUpdate. type SyncGroupsClientCreateOrUpdateResponse struct { + // An Azure SQL Database sync group. SyncGroup } @@ -2097,26 +2713,31 @@ type SyncGroupsClientDeleteResponse struct { // SyncGroupsClientGetResponse contains the response from method SyncGroupsClient.Get. type SyncGroupsClientGetResponse struct { + // An Azure SQL Database sync group. SyncGroup } // SyncGroupsClientListByDatabaseResponse contains the response from method SyncGroupsClient.NewListByDatabasePager. type SyncGroupsClientListByDatabaseResponse struct { + // A list of sync groups. SyncGroupListResult } // SyncGroupsClientListHubSchemasResponse contains the response from method SyncGroupsClient.NewListHubSchemasPager. type SyncGroupsClientListHubSchemasResponse struct { + // A list of sync schema properties. SyncFullSchemaPropertiesListResult } // SyncGroupsClientListLogsResponse contains the response from method SyncGroupsClient.NewListLogsPager. type SyncGroupsClientListLogsResponse struct { + // A list of sync group log properties. SyncGroupLogListResult } // SyncGroupsClientListSyncDatabaseIDsResponse contains the response from method SyncGroupsClient.NewListSyncDatabaseIDsPager. type SyncGroupsClientListSyncDatabaseIDsResponse struct { + // A list of sync database ID properties. SyncDatabaseIDListResult } @@ -2132,11 +2753,13 @@ type SyncGroupsClientTriggerSyncResponse struct { // SyncGroupsClientUpdateResponse contains the response from method SyncGroupsClient.BeginUpdate. type SyncGroupsClientUpdateResponse struct { + // An Azure SQL Database sync group. SyncGroup } // SyncMembersClientCreateOrUpdateResponse contains the response from method SyncMembersClient.BeginCreateOrUpdate. type SyncMembersClientCreateOrUpdateResponse struct { + // An Azure SQL Database sync member. SyncMember } @@ -2147,16 +2770,19 @@ type SyncMembersClientDeleteResponse struct { // SyncMembersClientGetResponse contains the response from method SyncMembersClient.Get. type SyncMembersClientGetResponse struct { + // An Azure SQL Database sync member. SyncMember } // SyncMembersClientListBySyncGroupResponse contains the response from method SyncMembersClient.NewListBySyncGroupPager. type SyncMembersClientListBySyncGroupResponse struct { + // A list of Azure SQL Database sync members. SyncMemberListResult } // SyncMembersClientListMemberSchemasResponse contains the response from method SyncMembersClient.NewListMemberSchemasPager. type SyncMembersClientListMemberSchemasResponse struct { + // A list of sync schema properties. SyncFullSchemaPropertiesListResult } @@ -2167,6 +2793,7 @@ type SyncMembersClientRefreshMemberSchemaResponse struct { // SyncMembersClientUpdateResponse contains the response from method SyncMembersClient.BeginUpdate. type SyncMembersClientUpdateResponse struct { + // An Azure SQL Database sync member. SyncMember } @@ -2177,31 +2804,37 @@ type TdeCertificatesClientCreateResponse struct { // TimeZonesClientGetResponse contains the response from method TimeZonesClient.Get. type TimeZonesClientGetResponse struct { + // Time Zone property. TimeZone } // TimeZonesClientListByLocationResponse contains the response from method TimeZonesClient.NewListByLocationPager. type TimeZonesClientListByLocationResponse struct { + // A list of time zones. TimeZoneListResult } -// TransparentDataEncryptionsClientCreateOrUpdateResponse contains the response from method TransparentDataEncryptionsClient.CreateOrUpdate. +// TransparentDataEncryptionsClientCreateOrUpdateResponse contains the response from method TransparentDataEncryptionsClient.BeginCreateOrUpdate. type TransparentDataEncryptionsClientCreateOrUpdateResponse struct { + // A logical database transparent data encryption state. LogicalDatabaseTransparentDataEncryption } // TransparentDataEncryptionsClientGetResponse contains the response from method TransparentDataEncryptionsClient.Get. type TransparentDataEncryptionsClientGetResponse struct { + // A logical database transparent data encryption state. LogicalDatabaseTransparentDataEncryption } // TransparentDataEncryptionsClientListByDatabaseResponse contains the response from method TransparentDataEncryptionsClient.NewListByDatabasePager. type TransparentDataEncryptionsClientListByDatabaseResponse struct { + // A list of transparent data encryptions LogicalDatabaseTransparentDataEncryptionListResult } // UsagesClientListByInstancePoolResponse contains the response from method UsagesClient.NewListByInstancePoolPager. type UsagesClientListByInstancePoolResponse struct { + // A list of usages. UsageListResult } @@ -2212,31 +2845,37 @@ type VirtualClustersClientDeleteResponse struct { // VirtualClustersClientGetResponse contains the response from method VirtualClustersClient.Get. type VirtualClustersClientGetResponse struct { + // An Azure SQL virtual cluster. VirtualCluster } // VirtualClustersClientListByResourceGroupResponse contains the response from method VirtualClustersClient.NewListByResourceGroupPager. type VirtualClustersClientListByResourceGroupResponse struct { + // A list of virtual clusters. VirtualClusterListResult } // VirtualClustersClientListResponse contains the response from method VirtualClustersClient.NewListPager. type VirtualClustersClientListResponse struct { + // A list of virtual clusters. VirtualClusterListResult } -// VirtualClustersClientUpdateDNSServersResponse contains the response from method VirtualClustersClient.UpdateDNSServers. +// VirtualClustersClientUpdateDNSServersResponse contains the response from method VirtualClustersClient.BeginUpdateDNSServers. type VirtualClustersClientUpdateDNSServersResponse struct { - UpdateManagedInstanceDNSServersOperation + // A refresh DNS servers operation. + UpdateVirtualClusterDNSServersOperation } // VirtualClustersClientUpdateResponse contains the response from method VirtualClustersClient.BeginUpdate. type VirtualClustersClientUpdateResponse struct { + // An Azure SQL virtual cluster. VirtualCluster } // VirtualNetworkRulesClientCreateOrUpdateResponse contains the response from method VirtualNetworkRulesClient.BeginCreateOrUpdate. type VirtualNetworkRulesClientCreateOrUpdateResponse struct { + // A virtual network rule. VirtualNetworkRule } @@ -2247,16 +2886,111 @@ type VirtualNetworkRulesClientDeleteResponse struct { // VirtualNetworkRulesClientGetResponse contains the response from method VirtualNetworkRulesClient.Get. type VirtualNetworkRulesClientGetResponse struct { + // A virtual network rule. VirtualNetworkRule } // VirtualNetworkRulesClientListByServerResponse contains the response from method VirtualNetworkRulesClient.NewListByServerPager. type VirtualNetworkRulesClientListByServerResponse struct { + // A list of virtual network rules. VirtualNetworkRuleListResult } +// VulnerabilityAssessmentBaselineClientGetResponse contains the response from method VulnerabilityAssessmentBaselineClient.Get. +type VulnerabilityAssessmentBaselineClientGetResponse struct { + // A database sql vulnerability assessment baseline set. + DatabaseSQLVulnerabilityAssessmentBaselineSet +} + +// VulnerabilityAssessmentBaselineClientListBySQLVulnerabilityAssessmentResponse contains the response from method VulnerabilityAssessmentBaselineClient.NewListBySQLVulnerabilityAssessmentPager. +type VulnerabilityAssessmentBaselineClientListBySQLVulnerabilityAssessmentResponse struct { + // A list of SQL Vulnerability Assessments baseline set. + DatabaseSQLVulnerabilityAssessmentBaselineSetListResult +} + +// VulnerabilityAssessmentBaselinesClientCreateOrUpdateResponse contains the response from method VulnerabilityAssessmentBaselinesClient.CreateOrUpdate. +type VulnerabilityAssessmentBaselinesClientCreateOrUpdateResponse struct { + // A database sql vulnerability assessment baseline set. + DatabaseSQLVulnerabilityAssessmentBaselineSet +} + +// VulnerabilityAssessmentExecuteScanClientExecuteResponse contains the response from method VulnerabilityAssessmentExecuteScanClient.BeginExecute. +type VulnerabilityAssessmentExecuteScanClientExecuteResponse struct { + // placeholder for future response values +} + +// VulnerabilityAssessmentRuleBaselineClientCreateOrUpdateResponse contains the response from method VulnerabilityAssessmentRuleBaselineClient.CreateOrUpdate. +type VulnerabilityAssessmentRuleBaselineClientCreateOrUpdateResponse struct { + // A database sql vulnerability assessment rule baseline. + DatabaseSQLVulnerabilityAssessmentRuleBaseline +} + +// VulnerabilityAssessmentRuleBaselineClientGetResponse contains the response from method VulnerabilityAssessmentRuleBaselineClient.Get. +type VulnerabilityAssessmentRuleBaselineClientGetResponse struct { + // A database sql vulnerability assessment rule baseline. + DatabaseSQLVulnerabilityAssessmentRuleBaseline +} + +// VulnerabilityAssessmentRuleBaselineClientListByBaselineResponse contains the response from method VulnerabilityAssessmentRuleBaselineClient.NewListByBaselinePager. +type VulnerabilityAssessmentRuleBaselineClientListByBaselineResponse struct { + // A list of SQL Vulnerability Assessments rule baseline. + DatabaseSQLVulnerabilityAssessmentRuleBaselineListResult +} + +// VulnerabilityAssessmentRuleBaselinesClientDeleteResponse contains the response from method VulnerabilityAssessmentRuleBaselinesClient.Delete. +type VulnerabilityAssessmentRuleBaselinesClientDeleteResponse struct { + // placeholder for future response values +} + +// VulnerabilityAssessmentScanResultClientGetResponse contains the response from method VulnerabilityAssessmentScanResultClient.Get. +type VulnerabilityAssessmentScanResultClientGetResponse struct { + VulnerabilityAssessmentScanResults +} + +// VulnerabilityAssessmentScanResultClientListByScanResponse contains the response from method VulnerabilityAssessmentScanResultClient.NewListByScanPager. +type VulnerabilityAssessmentScanResultClientListByScanResponse struct { + // A list of vulnerability assessment scan results. + VulnerabilityAssessmentScanListResult +} + +// VulnerabilityAssessmentScansClientGetResponse contains the response from method VulnerabilityAssessmentScansClient.Get. +type VulnerabilityAssessmentScansClientGetResponse struct { + // A vulnerability assessment scan record. + VulnerabilityAssessmentScanRecordForSQL +} + +// VulnerabilityAssessmentScansClientListBySQLVulnerabilityAssessmentsResponse contains the response from method VulnerabilityAssessmentScansClient.NewListBySQLVulnerabilityAssessmentsPager. +type VulnerabilityAssessmentScansClientListBySQLVulnerabilityAssessmentsResponse struct { + // A list of vulnerability assessment scan records. + VulnerabilityAssessmentScanRecordForSQLListResult +} + +// VulnerabilityAssessmentsClientDeleteResponse contains the response from method VulnerabilityAssessmentsClient.Delete. +type VulnerabilityAssessmentsClientDeleteResponse struct { + // placeholder for future response values +} + +// VulnerabilityAssessmentsSettingsClientCreateOrUpdateResponse contains the response from method VulnerabilityAssessmentsSettingsClient.CreateOrUpdate. +type VulnerabilityAssessmentsSettingsClientCreateOrUpdateResponse struct { + // A SQL Vulnerability Assessment. + VulnerabilityAssessment +} + +// VulnerabilityAssessmentsSettingsClientGetResponse contains the response from method VulnerabilityAssessmentsSettingsClient.Get. +type VulnerabilityAssessmentsSettingsClientGetResponse struct { + // A SQL Vulnerability Assessment. + VulnerabilityAssessment +} + +// VulnerabilityAssessmentsSettingsClientListByServerResponse contains the response from method VulnerabilityAssessmentsSettingsClient.NewListByServerPager. +type VulnerabilityAssessmentsSettingsClientListByServerResponse struct { + // A list of SQL Vulnerability Assessments. + VulnerabilityAssessmentListResult +} + // WorkloadClassifiersClientCreateOrUpdateResponse contains the response from method WorkloadClassifiersClient.BeginCreateOrUpdate. type WorkloadClassifiersClientCreateOrUpdateResponse struct { + // Workload classifier operations for a data warehouse WorkloadClassifier } @@ -2267,16 +3001,19 @@ type WorkloadClassifiersClientDeleteResponse struct { // WorkloadClassifiersClientGetResponse contains the response from method WorkloadClassifiersClient.Get. type WorkloadClassifiersClientGetResponse struct { + // Workload classifier operations for a data warehouse WorkloadClassifier } // WorkloadClassifiersClientListByWorkloadGroupResponse contains the response from method WorkloadClassifiersClient.NewListByWorkloadGroupPager. type WorkloadClassifiersClientListByWorkloadGroupResponse struct { + // A list of workload classifiers for a workload group. WorkloadClassifierListResult } // WorkloadGroupsClientCreateOrUpdateResponse contains the response from method WorkloadGroupsClient.BeginCreateOrUpdate. type WorkloadGroupsClientCreateOrUpdateResponse struct { + // Workload group operations for a data warehouse WorkloadGroup } @@ -2287,10 +3024,12 @@ type WorkloadGroupsClientDeleteResponse struct { // WorkloadGroupsClientGetResponse contains the response from method WorkloadGroupsClient.Get. type WorkloadGroupsClientGetResponse struct { + // Workload group operations for a data warehouse WorkloadGroup } // WorkloadGroupsClientListByDatabaseResponse contains the response from method WorkloadGroupsClient.NewListByDatabasePager. type WorkloadGroupsClientListByDatabaseResponse struct { + // A list of workload groups. WorkloadGroupListResult } diff --git a/sdk/resourcemanager/sql/armsql/restorabledroppeddatabases_client.go b/sdk/resourcemanager/sql/armsql/restorabledroppeddatabases_client.go index 19105276389e..759745195812 100644 --- a/sdk/resourcemanager/sql/armsql/restorabledroppeddatabases_client.go +++ b/sdk/resourcemanager/sql/armsql/restorabledroppeddatabases_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armsql @@ -47,25 +46,28 @@ func NewRestorableDroppedDatabasesClient(subscriptionID string, credential azcor // Get - Gets a restorable dropped database. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-05-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. // - options - RestorableDroppedDatabasesClientGetOptions contains the optional parameters for the RestorableDroppedDatabasesClient.Get // method. func (client *RestorableDroppedDatabasesClient) Get(ctx context.Context, resourceGroupName string, serverName string, restorableDroppedDatabaseID string, options *RestorableDroppedDatabasesClientGetOptions) (RestorableDroppedDatabasesClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, serverName, restorableDroppedDatabaseID, options) if err != nil { return RestorableDroppedDatabasesClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return RestorableDroppedDatabasesClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return RestorableDroppedDatabasesClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return RestorableDroppedDatabasesClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -92,7 +94,13 @@ func (client *RestorableDroppedDatabasesClient) getCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-05-01-preview") + if options != nil && options.Expand != nil { + reqQP.Set("$expand", *options.Expand) + } + if options != nil && options.Filter != nil { + reqQP.Set("$filter", *options.Filter) + } + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -109,7 +117,7 @@ func (client *RestorableDroppedDatabasesClient) getHandleResponse(resp *http.Res // NewListByServerPager - Gets a list of restorable dropped databases. // -// Generated from API version 2021-05-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -163,7 +171,7 @@ func (client *RestorableDroppedDatabasesClient) listByServerCreateRequest(ctx co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-05-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/sql/armsql/restorabledroppeddatabases_client_example_test.go b/sdk/resourcemanager/sql/armsql/restorabledroppeddatabases_client_example_test.go deleted file mode 100644 index 991544125dd2..000000000000 --- a/sdk/resourcemanager/sql/armsql/restorabledroppeddatabases_client_example_test.go +++ /dev/null @@ -1,117 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsql_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sql/armsql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ListRestorableDroppedDatabasesByServer.json -func ExampleRestorableDroppedDatabasesClient_NewListByServerPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewRestorableDroppedDatabasesClient().NewListByServerPager("Default-SQL-SouthEastAsia", "testsvr", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.RestorableDroppedDatabaseListResult = armsql.RestorableDroppedDatabaseListResult{ - // Value: []*armsql.RestorableDroppedDatabase{ - // { - // Name: to.Ptr("testdb,131403269876900000"), - // Type: to.Ptr("Microsoft.Sql/servers/restorableDroppedDatabases"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/servers/testsvr/restorableDroppedDatabases/testdb"), - // Location: to.Ptr("southeastasia"), - // Properties: &armsql.RestorableDroppedDatabaseProperties{ - // BackupStorageRedundancy: to.Ptr(armsql.BackupStorageRedundancyGeo), - // CreationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-06-07T04:41:33.937Z"); return t}()), - // DatabaseName: to.Ptr("testdb"), - // DeletionDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-05-27T02:49:47.69Z"); return t}()), - // MaxSizeBytes: to.Ptr[int64](268435456000), - // }, - // SKU: &armsql.SKU{ - // Name: to.Ptr("BC_Gen4_2"), - // Tier: to.Ptr("BusinessCritical"), - // }, - // }, - // { - // Name: to.Ptr("testdb2,131403269876900000"), - // Type: to.Ptr("Microsoft.Sql/servers/restorableDroppedDatabases"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/servers/testsvr/restorableDroppedDatabases/testdb2"), - // Location: to.Ptr("southeastasia"), - // Properties: &armsql.RestorableDroppedDatabaseProperties{ - // BackupStorageRedundancy: to.Ptr(armsql.BackupStorageRedundancyGeo), - // CreationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-06-07T04:41:33.937Z"); return t}()), - // DatabaseName: to.Ptr("testdb2"), - // DeletionDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-05-27T02:49:47.69Z"); return t}()), - // MaxSizeBytes: to.Ptr[int64](268435456000), - // }, - // SKU: &armsql.SKU{ - // Name: to.Ptr("GP_Gen4_2"), - // Tier: to.Ptr("GeneralPurpose"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/GetRestorableDroppedDatabase.json -func ExampleRestorableDroppedDatabasesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewRestorableDroppedDatabasesClient().Get(ctx, "Default-SQL-SouthEastAsia", "testsvr", "testdb,131403269876900000", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RestorableDroppedDatabase = armsql.RestorableDroppedDatabase{ - // Name: to.Ptr("testdb,131403269876900000"), - // Type: to.Ptr("Microsoft.Sql/servers/restorableDroppedDatabases"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/servers/testsvr/restorableDroppedDatabases/testdb"), - // Location: to.Ptr("southeastasia"), - // Properties: &armsql.RestorableDroppedDatabaseProperties{ - // BackupStorageRedundancy: to.Ptr(armsql.BackupStorageRedundancyGeo), - // CreationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-05-07T04:41:33.937Z"); return t}()), - // DatabaseName: to.Ptr("testdb"), - // DeletionDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-05-27T02:49:47.69Z"); return t}()), - // MaxSizeBytes: to.Ptr[int64](268435456000), - // }, - // SKU: &armsql.SKU{ - // Name: to.Ptr("BC_Gen4_2"), - // Tier: to.Ptr("BusinessCritical"), - // }, - // } -} diff --git a/sdk/resourcemanager/sql/armsql/restorabledroppedmanageddatabases_client.go b/sdk/resourcemanager/sql/armsql/restorabledroppedmanageddatabases_client.go index df0f50431792..8c1fa76c308a 100644 --- a/sdk/resourcemanager/sql/armsql/restorabledroppedmanageddatabases_client.go +++ b/sdk/resourcemanager/sql/armsql/restorabledroppedmanageddatabases_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armsql @@ -47,25 +46,28 @@ func NewRestorableDroppedManagedDatabasesClient(subscriptionID string, credentia // Get - Gets a restorable dropped managed database. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-05-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - managedInstanceName - The name of the managed instance. // - options - RestorableDroppedManagedDatabasesClientGetOptions contains the optional parameters for the RestorableDroppedManagedDatabasesClient.Get // method. func (client *RestorableDroppedManagedDatabasesClient) Get(ctx context.Context, resourceGroupName string, managedInstanceName string, restorableDroppedDatabaseID string, options *RestorableDroppedManagedDatabasesClientGetOptions) (RestorableDroppedManagedDatabasesClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, managedInstanceName, restorableDroppedDatabaseID, options) if err != nil { return RestorableDroppedManagedDatabasesClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return RestorableDroppedManagedDatabasesClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return RestorableDroppedManagedDatabasesClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return RestorableDroppedManagedDatabasesClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -92,7 +94,7 @@ func (client *RestorableDroppedManagedDatabasesClient) getCreateRequest(ctx cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-05-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -109,7 +111,7 @@ func (client *RestorableDroppedManagedDatabasesClient) getHandleResponse(resp *h // NewListByInstancePager - Gets a list of restorable dropped managed databases. // -// Generated from API version 2021-05-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - managedInstanceName - The name of the managed instance. @@ -163,7 +165,7 @@ func (client *RestorableDroppedManagedDatabasesClient) listByInstanceCreateReque return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-05-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/sql/armsql/restorabledroppedmanageddatabases_client_example_test.go b/sdk/resourcemanager/sql/armsql/restorabledroppedmanageddatabases_client_example_test.go deleted file mode 100644 index 37066f55ec61..000000000000 --- a/sdk/resourcemanager/sql/armsql/restorabledroppedmanageddatabases_client_example_test.go +++ /dev/null @@ -1,99 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsql_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sql/armsql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/RestorableDroppedManagedDatabaseListByManagedInstance.json -func ExampleRestorableDroppedManagedDatabasesClient_NewListByInstancePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewRestorableDroppedManagedDatabasesClient().NewListByInstancePager("Test1", "managedInstance", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.RestorableDroppedManagedDatabaseListResult = armsql.RestorableDroppedManagedDatabaseListResult{ - // Value: []*armsql.RestorableDroppedManagedDatabase{ - // { - // Name: to.Ptr("testdb,131403269876900000"), - // Type: to.Ptr("Microsoft.Sql/managedInstances/restorableDroppedDatabases"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/managedInstances/testsvr/restorableDroppedDatabases/testdb,131403269876900000"), - // Location: to.Ptr("southeastasia"), - // Properties: &armsql.RestorableDroppedManagedDatabaseProperties{ - // CreationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-05-07T04:41:33.937Z"); return t}()), - // DatabaseName: to.Ptr("testdb"), - // DeletionDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-05-27T02:49:47.69Z"); return t}()), - // }, - // }, - // { - // Name: to.Ptr("testdb2,131403269876900000"), - // Type: to.Ptr("Microsoft.Sql/managedInstances/restorableDroppedDatabases"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/managedInstances/testsvr/restorableDroppedDatabases/testdb2,131403269876900000"), - // Location: to.Ptr("southeastasia"), - // Properties: &armsql.RestorableDroppedManagedDatabaseProperties{ - // CreationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-05-07T04:41:33.937Z"); return t}()), - // DatabaseName: to.Ptr("testdb2"), - // DeletionDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-05-27T02:49:47.69Z"); return t}()), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/GetRestorableDroppedManagedDatabase.json -func ExampleRestorableDroppedManagedDatabasesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewRestorableDroppedManagedDatabasesClient().Get(ctx, "Test1", "managedInstance", "testdb,131403269876900000", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RestorableDroppedManagedDatabase = armsql.RestorableDroppedManagedDatabase{ - // Name: to.Ptr("testdb,131403269876900000"), - // Type: to.Ptr("Microsoft.Sql/managedInstances/restorableDroppedDatabases"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/managedInstances/testsvr/restorableDroppedDatabases/testdb,131403269876900000"), - // Location: to.Ptr("southeastasia"), - // Properties: &armsql.RestorableDroppedManagedDatabaseProperties{ - // CreationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-05-07T04:41:33.937Z"); return t}()), - // DatabaseName: to.Ptr("testdb"), - // DeletionDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-05-27T02:49:47.69Z"); return t}()), - // }, - // } -} diff --git a/sdk/resourcemanager/sql/armsql/restorepoints_client.go b/sdk/resourcemanager/sql/armsql/restorepoints_client.go index 6f494b6677a1..ceead361cd84 100644 --- a/sdk/resourcemanager/sql/armsql/restorepoints_client.go +++ b/sdk/resourcemanager/sql/armsql/restorepoints_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armsql @@ -47,7 +46,7 @@ func NewRestorePointsClient(subscriptionID string, credential azcore.TokenCreden // BeginCreate - Creates a restore point for a data warehouse. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -61,7 +60,8 @@ func (client *RestorePointsClient) BeginCreate(ctx context.Context, resourceGrou if err != nil { return nil, err } - return runtime.NewPoller[RestorePointsClientCreateResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[RestorePointsClientCreateResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[RestorePointsClientCreateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -70,20 +70,22 @@ func (client *RestorePointsClient) BeginCreate(ctx context.Context, resourceGrou // Create - Creates a restore point for a data warehouse. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview func (client *RestorePointsClient) create(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters CreateDatabaseRestorePointDefinition, options *RestorePointsClientBeginCreateOptions) (*http.Response, error) { + var err error req, err := client.createCreateRequest(ctx, resourceGroupName, serverName, databaseName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createCreateRequest creates the Create request. @@ -110,16 +112,19 @@ func (client *RestorePointsClient) createCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // Delete - Deletes a restore point. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -127,16 +132,18 @@ func (client *RestorePointsClient) createCreateRequest(ctx context.Context, reso // - restorePointName - The name of the restore point. // - options - RestorePointsClientDeleteOptions contains the optional parameters for the RestorePointsClient.Delete method. func (client *RestorePointsClient) Delete(ctx context.Context, resourceGroupName string, serverName string, databaseName string, restorePointName string, options *RestorePointsClientDeleteOptions) (RestorePointsClientDeleteResponse, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, serverName, databaseName, restorePointName, options) if err != nil { return RestorePointsClientDeleteResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return RestorePointsClientDeleteResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return RestorePointsClientDeleteResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return RestorePointsClientDeleteResponse{}, err } return RestorePointsClientDeleteResponse{}, nil } @@ -169,7 +176,7 @@ func (client *RestorePointsClient) deleteCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -177,7 +184,7 @@ func (client *RestorePointsClient) deleteCreateRequest(ctx context.Context, reso // Get - Gets a restore point. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -185,18 +192,21 @@ func (client *RestorePointsClient) deleteCreateRequest(ctx context.Context, reso // - restorePointName - The name of the restore point. // - options - RestorePointsClientGetOptions contains the optional parameters for the RestorePointsClient.Get method. func (client *RestorePointsClient) Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string, restorePointName string, options *RestorePointsClientGetOptions) (RestorePointsClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, serverName, databaseName, restorePointName, options) if err != nil { return RestorePointsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return RestorePointsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return RestorePointsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return RestorePointsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -227,7 +237,7 @@ func (client *RestorePointsClient) getCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -244,7 +254,7 @@ func (client *RestorePointsClient) getHandleResponse(resp *http.Response) (Resto // NewListByDatabasePager - Gets a list of database restore points. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -303,7 +313,7 @@ func (client *RestorePointsClient) listByDatabaseCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/sql/armsql/restorepoints_client_example_test.go b/sdk/resourcemanager/sql/armsql/restorepoints_client_example_test.go deleted file mode 100644 index dfb45e8886c5..000000000000 --- a/sdk/resourcemanager/sql/armsql/restorepoints_client_example_test.go +++ /dev/null @@ -1,232 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsql_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sql/armsql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseRestorePointsListByDatabase.json -func ExampleRestorePointsClient_NewListByDatabasePager_listDatabaseRestorePoints() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewRestorePointsClient().NewListByDatabasePager("sqlcrudtest-6730", "sqlcrudtest-9007", "3481", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.RestorePointListResult = armsql.RestorePointListResult{ - // Value: []*armsql.RestorePoint{ - // { - // Name: to.Ptr("ContinuousRestorePoint"), - // Type: to.Ptr("Microsoft.Sql/servers/databases/restorePoints"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/sqlcrudtest-6730/providers/Microsoft.Sql/servers/sqlcrudtest-9007/databases/3481/restorepoints/ContinuousRestorePoint"), - // Location: to.Ptr("West US"), - // Properties: &armsql.RestorePointProperties{ - // EarliestRestoreDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-06-12T00:00:00Z"); return t}()), - // RestorePointType: to.Ptr(armsql.RestorePointTypeCONTINUOUS), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DataWarehouseRestorePointsListByDatabase.json -func ExampleRestorePointsClient_NewListByDatabasePager_listDatawarehouseDatabaseRestorePoints() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewRestorePointsClient().NewListByDatabasePager("Default-SQL-SouthEastAsia", "testserver", "testDatabase", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.RestorePointListResult = armsql.RestorePointListResult{ - // Value: []*armsql.RestorePoint{ - // { - // Name: to.Ptr("131546477590000000"), - // Type: to.Ptr("Microsoft.Sql/servers/databases/restorePoints"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/providers/Microsoft.Sql/servers/testserver/databases/testDatabase/restorePoints/131546477590000000"), - // Location: to.Ptr("japaneast"), - // Properties: &armsql.RestorePointProperties{ - // RestorePointCreationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-03-10T08:00:00Z"); return t}()), - // RestorePointLabel: to.Ptr("mylabel1"), - // RestorePointType: to.Ptr(armsql.RestorePointTypeDISCRETE), - // }, - // }, - // { - // Name: to.Ptr("131553636140000000"), - // Type: to.Ptr("Microsoft.Sql/servers/databases/restorePoints"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/providers/Microsoft.Sql/servers/testserver/databases/testDatabase/restorePoints/131553636140000000"), - // Location: to.Ptr("japaneast"), - // Properties: &armsql.RestorePointProperties{ - // RestorePointCreationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-11-17T03:40:14Z"); return t}()), - // RestorePointLabel: to.Ptr("mylabel2"), - // RestorePointType: to.Ptr(armsql.RestorePointTypeDISCRETE), - // }, - // }, - // { - // Name: to.Ptr("131553619750000000"), - // Type: to.Ptr("Microsoft.Sql/servers/databases/restorePoints"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/providers/Microsoft.Sql/servers/testserver/databases/testDatabase/restorePoints/131553619750000000"), - // Location: to.Ptr("japaneast"), - // Properties: &armsql.RestorePointProperties{ - // RestorePointCreationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-11-17T03:12:55Z"); return t}()), - // RestorePointType: to.Ptr(armsql.RestorePointTypeDISCRETE), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseRestorePointsPost.json -func ExampleRestorePointsClient_BeginCreate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewRestorePointsClient().BeginCreate(ctx, "Default-SQL-SouthEastAsia", "testserver", "testDatabase", armsql.CreateDatabaseRestorePointDefinition{ - RestorePointLabel: to.Ptr("mylabel"), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RestorePoint = armsql.RestorePoint{ - // Name: to.Ptr("131546477590000000"), - // Type: to.Ptr("Microsoft.Sql/servers/databases/restorePoints"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/providers/Microsoft.Sql/servers/testserver/databases/testDatabase/restorePoints/131546477590000000"), - // Location: to.Ptr("japaneast"), - // Properties: &armsql.RestorePointProperties{ - // RestorePointCreationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-03-10T08:00:00Z"); return t}()), - // RestorePointLabel: to.Ptr("mylabel"), - // RestorePointType: to.Ptr(armsql.RestorePointTypeDISCRETE), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseRestorePointsGet.json -func ExampleRestorePointsClient_Get_getsADatabaseRestorePoint() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewRestorePointsClient().Get(ctx, "Default-SQL-SouthEastAsia", "testserver", "testDatabase", "131546477590000000", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RestorePoint = armsql.RestorePoint{ - // Name: to.Ptr("ContinuousRestorePoint"), - // Type: to.Ptr("Microsoft.Sql/servers/databases/restorePoints"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/providers/Microsoft.Sql/servers/testserver/databases/testDatabase/restorePoints/ContinuousRestorePoint"), - // Location: to.Ptr("japaneast"), - // Properties: &armsql.RestorePointProperties{ - // EarliestRestoreDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-03-10T08:00:00Z"); return t}()), - // RestorePointType: to.Ptr(armsql.RestorePointTypeCONTINUOUS), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DataWarehouseRestorePointsGet.json -func ExampleRestorePointsClient_Get_getsADatawarehouseDatabaseRestorePoint() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewRestorePointsClient().Get(ctx, "Default-SQL-SouthEastAsia", "testserver", "testDatabase", "131546477590000000", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RestorePoint = armsql.RestorePoint{ - // Name: to.Ptr("131546477590000000"), - // Type: to.Ptr("Microsoft.Sql/servers/databases/restorePoints"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/providers/Microsoft.Sql/servers/testserver/databases/testDatabase/restorePoints/131546477590000000"), - // Location: to.Ptr("japaneast"), - // Properties: &armsql.RestorePointProperties{ - // RestorePointCreationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-03-10T08:00:00Z"); return t}()), - // RestorePointLabel: to.Ptr("mylabel"), - // RestorePointType: to.Ptr(armsql.RestorePointTypeDISCRETE), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseRestorePointsDelete.json -func ExampleRestorePointsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewRestorePointsClient().Delete(ctx, "Default-SQL-SouthEastAsia", "testserver", "testDatabase", "131546477590000000", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/sql/armsql/sensitivitylabels_client.go b/sdk/resourcemanager/sql/armsql/sensitivitylabels_client.go index 70e1381c4a1e..f5e2699bbf62 100644 --- a/sdk/resourcemanager/sql/armsql/sensitivitylabels_client.go +++ b/sdk/resourcemanager/sql/armsql/sensitivitylabels_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armsql @@ -48,7 +47,7 @@ func NewSensitivityLabelsClient(subscriptionID string, credential azcore.TokenCr // CreateOrUpdate - Creates or updates the sensitivity label of a given column // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -60,18 +59,21 @@ func NewSensitivityLabelsClient(subscriptionID string, credential azcore.TokenCr // - options - SensitivityLabelsClientCreateOrUpdateOptions contains the optional parameters for the SensitivityLabelsClient.CreateOrUpdate // method. func (client *SensitivityLabelsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, databaseName string, schemaName string, tableName string, columnName string, parameters SensitivityLabel, options *SensitivityLabelsClientCreateOrUpdateOptions) (SensitivityLabelsClientCreateOrUpdateResponse, error) { + var err error req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, serverName, databaseName, schemaName, tableName, columnName, parameters, options) if err != nil { return SensitivityLabelsClientCreateOrUpdateResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return SensitivityLabelsClientCreateOrUpdateResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { - return SensitivityLabelsClientCreateOrUpdateResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return SensitivityLabelsClientCreateOrUpdateResponse{}, err } - return client.createOrUpdateHandleResponse(resp) + resp, err := client.createOrUpdateHandleResponse(httpResp) + return resp, err } // createOrUpdateCreateRequest creates the CreateOrUpdate request. @@ -111,10 +113,13 @@ func (client *SensitivityLabelsClient) createOrUpdateCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // createOrUpdateHandleResponse handles the CreateOrUpdate response. @@ -129,7 +134,7 @@ func (client *SensitivityLabelsClient) createOrUpdateHandleResponse(resp *http.R // Delete - Deletes the sensitivity label of a given column // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -140,16 +145,18 @@ func (client *SensitivityLabelsClient) createOrUpdateHandleResponse(resp *http.R // - options - SensitivityLabelsClientDeleteOptions contains the optional parameters for the SensitivityLabelsClient.Delete // method. func (client *SensitivityLabelsClient) Delete(ctx context.Context, resourceGroupName string, serverName string, databaseName string, schemaName string, tableName string, columnName string, options *SensitivityLabelsClientDeleteOptions) (SensitivityLabelsClientDeleteResponse, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, serverName, databaseName, schemaName, tableName, columnName, options) if err != nil { return SensitivityLabelsClientDeleteResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return SensitivityLabelsClientDeleteResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return SensitivityLabelsClientDeleteResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return SensitivityLabelsClientDeleteResponse{}, err } return SensitivityLabelsClientDeleteResponse{}, nil } @@ -191,7 +198,7 @@ func (client *SensitivityLabelsClient) deleteCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -199,7 +206,7 @@ func (client *SensitivityLabelsClient) deleteCreateRequest(ctx context.Context, // DisableRecommendation - Disables sensitivity recommendations on a given column // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -210,16 +217,18 @@ func (client *SensitivityLabelsClient) deleteCreateRequest(ctx context.Context, // - options - SensitivityLabelsClientDisableRecommendationOptions contains the optional parameters for the SensitivityLabelsClient.DisableRecommendation // method. func (client *SensitivityLabelsClient) DisableRecommendation(ctx context.Context, resourceGroupName string, serverName string, databaseName string, schemaName string, tableName string, columnName string, options *SensitivityLabelsClientDisableRecommendationOptions) (SensitivityLabelsClientDisableRecommendationResponse, error) { + var err error req, err := client.disableRecommendationCreateRequest(ctx, resourceGroupName, serverName, databaseName, schemaName, tableName, columnName, options) if err != nil { return SensitivityLabelsClientDisableRecommendationResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return SensitivityLabelsClientDisableRecommendationResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return SensitivityLabelsClientDisableRecommendationResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return SensitivityLabelsClientDisableRecommendationResponse{}, err } return SensitivityLabelsClientDisableRecommendationResponse{}, nil } @@ -261,7 +270,7 @@ func (client *SensitivityLabelsClient) disableRecommendationCreateRequest(ctx co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -270,7 +279,7 @@ func (client *SensitivityLabelsClient) disableRecommendationCreateRequest(ctx co // all columns) // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -281,16 +290,18 @@ func (client *SensitivityLabelsClient) disableRecommendationCreateRequest(ctx co // - options - SensitivityLabelsClientEnableRecommendationOptions contains the optional parameters for the SensitivityLabelsClient.EnableRecommendation // method. func (client *SensitivityLabelsClient) EnableRecommendation(ctx context.Context, resourceGroupName string, serverName string, databaseName string, schemaName string, tableName string, columnName string, options *SensitivityLabelsClientEnableRecommendationOptions) (SensitivityLabelsClientEnableRecommendationResponse, error) { + var err error req, err := client.enableRecommendationCreateRequest(ctx, resourceGroupName, serverName, databaseName, schemaName, tableName, columnName, options) if err != nil { return SensitivityLabelsClientEnableRecommendationResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return SensitivityLabelsClientEnableRecommendationResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return SensitivityLabelsClientEnableRecommendationResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return SensitivityLabelsClientEnableRecommendationResponse{}, err } return SensitivityLabelsClientEnableRecommendationResponse{}, nil } @@ -332,7 +343,7 @@ func (client *SensitivityLabelsClient) enableRecommendationCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -340,7 +351,7 @@ func (client *SensitivityLabelsClient) enableRecommendationCreateRequest(ctx con // Get - Gets the sensitivity label of a given column // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -351,18 +362,21 @@ func (client *SensitivityLabelsClient) enableRecommendationCreateRequest(ctx con // - sensitivityLabelSource - The source of the sensitivity label. // - options - SensitivityLabelsClientGetOptions contains the optional parameters for the SensitivityLabelsClient.Get method. func (client *SensitivityLabelsClient) Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string, schemaName string, tableName string, columnName string, sensitivityLabelSource SensitivityLabelSource, options *SensitivityLabelsClientGetOptions) (SensitivityLabelsClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, serverName, databaseName, schemaName, tableName, columnName, sensitivityLabelSource, options) if err != nil { return SensitivityLabelsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return SensitivityLabelsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return SensitivityLabelsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return SensitivityLabelsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -405,7 +419,7 @@ func (client *SensitivityLabelsClient) getCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -420,9 +434,88 @@ func (client *SensitivityLabelsClient) getHandleResponse(resp *http.Response) (S return result, nil } +// NewListByDatabasePager - Gets the sensitivity labels of a given database +// +// Generated from API version 2022-11-01-preview +// - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure +// Resource Manager API or the portal. +// - serverName - The name of the server. +// - databaseName - The name of the database. +// - options - SensitivityLabelsClientListByDatabaseOptions contains the optional parameters for the SensitivityLabelsClient.NewListByDatabasePager +// method. +func (client *SensitivityLabelsClient) NewListByDatabasePager(resourceGroupName string, serverName string, databaseName string, options *SensitivityLabelsClientListByDatabaseOptions) *runtime.Pager[SensitivityLabelsClientListByDatabaseResponse] { + return runtime.NewPager(runtime.PagingHandler[SensitivityLabelsClientListByDatabaseResponse]{ + More: func(page SensitivityLabelsClientListByDatabaseResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *SensitivityLabelsClientListByDatabaseResponse) (SensitivityLabelsClientListByDatabaseResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByDatabaseCreateRequest(ctx, resourceGroupName, serverName, databaseName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return SensitivityLabelsClientListByDatabaseResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return SensitivityLabelsClientListByDatabaseResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return SensitivityLabelsClientListByDatabaseResponse{}, runtime.NewResponseError(resp) + } + return client.listByDatabaseHandleResponse(resp) + }, + }) +} + +// listByDatabaseCreateRequest creates the ListByDatabase request. +func (client *SensitivityLabelsClient) listByDatabaseCreateRequest(ctx context.Context, resourceGroupName string, serverName string, databaseName string, options *SensitivityLabelsClientListByDatabaseOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/sensitivityLabels" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serverName == "" { + return nil, errors.New("parameter serverName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serverName}", url.PathEscape(serverName)) + if databaseName == "" { + return nil, errors.New("parameter databaseName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{databaseName}", url.PathEscape(databaseName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + if options != nil && options.Filter != nil { + reqQP.Set("$filter", *options.Filter) + } + reqQP.Set("api-version", "2022-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByDatabaseHandleResponse handles the ListByDatabase response. +func (client *SensitivityLabelsClient) listByDatabaseHandleResponse(resp *http.Response) (SensitivityLabelsClientListByDatabaseResponse, error) { + result := SensitivityLabelsClientListByDatabaseResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SensitivityLabelListResult); err != nil { + return SensitivityLabelsClientListByDatabaseResponse{}, err + } + return result, nil +} + // NewListCurrentByDatabasePager - Gets the sensitivity labels of a given database // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -490,7 +583,7 @@ func (client *SensitivityLabelsClient) listCurrentByDatabaseCreateRequest(ctx co if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -507,7 +600,7 @@ func (client *SensitivityLabelsClient) listCurrentByDatabaseHandleResponse(resp // NewListRecommendedByDatabasePager - Gets the sensitivity labels of a given database // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -575,7 +668,7 @@ func (client *SensitivityLabelsClient) listRecommendedByDatabaseCreateRequest(ct if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -593,7 +686,7 @@ func (client *SensitivityLabelsClient) listRecommendedByDatabaseHandleResponse(r // Update - Update sensitivity labels of a given database using an operations batch. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -601,16 +694,18 @@ func (client *SensitivityLabelsClient) listRecommendedByDatabaseHandleResponse(r // - options - SensitivityLabelsClientUpdateOptions contains the optional parameters for the SensitivityLabelsClient.Update // method. func (client *SensitivityLabelsClient) Update(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters SensitivityLabelUpdateList, options *SensitivityLabelsClientUpdateOptions) (SensitivityLabelsClientUpdateResponse, error) { + var err error req, err := client.updateCreateRequest(ctx, resourceGroupName, serverName, databaseName, parameters, options) if err != nil { return SensitivityLabelsClientUpdateResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return SensitivityLabelsClientUpdateResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return SensitivityLabelsClientUpdateResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return SensitivityLabelsClientUpdateResponse{}, err } return SensitivityLabelsClientUpdateResponse{}, nil } @@ -639,7 +734,10 @@ func (client *SensitivityLabelsClient) updateCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } diff --git a/sdk/resourcemanager/sql/armsql/sensitivitylabels_client_example_test.go b/sdk/resourcemanager/sql/armsql/sensitivitylabels_client_example_test.go deleted file mode 100644 index 49809e25a588..000000000000 --- a/sdk/resourcemanager/sql/armsql/sensitivitylabels_client_example_test.go +++ /dev/null @@ -1,329 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsql_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sql/armsql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SensitivityLabelsListByDatabaseWithSourceCurrent.json -func ExampleSensitivityLabelsClient_NewListCurrentByDatabasePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewSensitivityLabelsClient().NewListCurrentByDatabasePager("myRG", "myServer", "myDatabase", &armsql.SensitivityLabelsClientListCurrentByDatabaseOptions{SkipToken: nil, - Count: nil, - Filter: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.SensitivityLabelListResult = armsql.SensitivityLabelListResult{ - // Value: []*armsql.SensitivityLabel{ - // { - // Name: to.Ptr("current"), - // Type: to.Ptr("Microsoft.Sql/servers/databases/schemas/tables/columns/sensitivityLabels"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/myRG/providers/Microsoft.Sql/servers/myServer/databases/myDatabase/schemas/dbo/tables/myTable/columns/myColumn3/sensitivityLabels/current"), - // Properties: &armsql.SensitivityLabelProperties{ - // ColumnName: to.Ptr("myColumn3"), - // InformationType: to.Ptr("Financial"), - // InformationTypeID: to.Ptr("d22fa6e9-5ee4-3bde-4c2b-a409604c4646"), - // LabelID: to.Ptr("05e6eaa1-075a-4fb4-a732-a92215a2444a"), - // LabelName: to.Ptr("Sensitive"), - // Rank: to.Ptr(armsql.SensitivityLabelRankLow), - // SchemaName: to.Ptr("dbo"), - // TableName: to.Ptr("myTable"), - // }, - // }, - // { - // Name: to.Ptr("current"), - // Type: to.Ptr("Microsoft.Sql/servers/databases/schemas/tables/columns/sensitivityLabels"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/myRG/providers/Microsoft.Sql/servers/myServer/databases/myDatabase/schemas/dbo/tables/myTable/columns/myColumn4/sensitivityLabels/current"), - // Properties: &armsql.SensitivityLabelProperties{ - // ColumnName: to.Ptr("myColumn4"), - // InformationType: to.Ptr("Email"), - // InformationTypeID: to.Ptr("d22fa6e9-5ee4-3bde-4c2b-a409604c4646"), - // LabelID: to.Ptr("bf91e08c-f4f0-478a-b016-25164b2a65ff"), - // LabelName: to.Ptr("PII"), - // Rank: to.Ptr(armsql.SensitivityLabelRankNone), - // SchemaName: to.Ptr("dbo"), - // TableName: to.Ptr("myTable"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SensitivityLabelsCurrentUpdate.json -func ExampleSensitivityLabelsClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewSensitivityLabelsClient().Update(ctx, "myRG", "myServer", "myDatabase", armsql.SensitivityLabelUpdateList{ - Operations: []*armsql.SensitivityLabelUpdate{ - { - Properties: &armsql.SensitivityLabelUpdateProperties{ - Schema: to.Ptr("dbo"), - Column: to.Ptr("column1"), - Op: to.Ptr(armsql.SensitivityLabelUpdateKindSet), - SensitivityLabel: &armsql.SensitivityLabel{ - Properties: &armsql.SensitivityLabelProperties{ - InformationType: to.Ptr("Financial"), - InformationTypeID: to.Ptr("1D3652D6-422C-4115-82F1-65DAEBC665C8"), - LabelID: to.Ptr("3A477B16-9423-432B-AA97-6069B481CEC3"), - LabelName: to.Ptr("Highly Confidential"), - Rank: to.Ptr(armsql.SensitivityLabelRankLow), - }, - }, - Table: to.Ptr("table1"), - }, - }, - { - Properties: &armsql.SensitivityLabelUpdateProperties{ - Schema: to.Ptr("dbo"), - Column: to.Ptr("column2"), - Op: to.Ptr(armsql.SensitivityLabelUpdateKindSet), - SensitivityLabel: &armsql.SensitivityLabel{ - Properties: &armsql.SensitivityLabelProperties{ - InformationType: to.Ptr("PhoneNumber"), - InformationTypeID: to.Ptr("d22fa6e9-5ee4-3bde-4c2b-a409604c4646"), - LabelID: to.Ptr("bf91e08c-f4f0-478a-b016-25164b2a65ff"), - LabelName: to.Ptr("PII"), - Rank: to.Ptr(armsql.SensitivityLabelRankCritical), - }, - }, - Table: to.Ptr("table2"), - }, - }, - { - Properties: &armsql.SensitivityLabelUpdateProperties{ - Schema: to.Ptr("dbo"), - Column: to.Ptr("Column3"), - Op: to.Ptr(armsql.SensitivityLabelUpdateKindRemove), - Table: to.Ptr("Table1"), - }, - }}, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SensitivityLabelsListByDatabaseWithSourceRecommended.json -func ExampleSensitivityLabelsClient_NewListRecommendedByDatabasePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewSensitivityLabelsClient().NewListRecommendedByDatabasePager("myRG", "myServer", "myDatabase", &armsql.SensitivityLabelsClientListRecommendedByDatabaseOptions{SkipToken: nil, - IncludeDisabledRecommendations: nil, - Filter: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.SensitivityLabelListResult = armsql.SensitivityLabelListResult{ - // Value: []*armsql.SensitivityLabel{ - // { - // Name: to.Ptr("recommended"), - // Type: to.Ptr("Microsoft.Sql/servers/databases/schemas/tables/columns/sensitivityLabels"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/myRG/providers/Microsoft.Sql/servers/myServer/databases/myDatabase/schemas/dbo/tables/myTable/columns/myColumn/sensitivityLabels/recommended"), - // Properties: &armsql.SensitivityLabelProperties{ - // ColumnName: to.Ptr("myColumn"), - // InformationType: to.Ptr("Financial"), - // InformationTypeID: to.Ptr("d22fa6e9-5ee4-3bde-4c2b-a409604c4646"), - // LabelID: to.Ptr("05e6eaa1-075a-4fb4-a732-a92215a2444a"), - // LabelName: to.Ptr("Sensitive"), - // SchemaName: to.Ptr("dbo"), - // TableName: to.Ptr("myTable"), - // }, - // }, - // { - // Name: to.Ptr("recommended"), - // Type: to.Ptr("Microsoft.Sql/servers/databases/schemas/tables/columns/sensitivityLabels"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/myRG/providers/Microsoft.Sql/servers/myServer/databases/myDatabase/schemas/dbo/tables/myTable/columns/myColumn2/sensitivityLabels/recommended"), - // Properties: &armsql.SensitivityLabelProperties{ - // ColumnName: to.Ptr("myColumn2"), - // InformationType: to.Ptr("Email"), - // InformationTypeID: to.Ptr("d22fa6e9-5ee4-3bde-4c2b-a409604c4646"), - // LabelID: to.Ptr("bf91e08c-f4f0-478a-b016-25164b2a65ff"), - // LabelName: to.Ptr("PII"), - // SchemaName: to.Ptr("dbo"), - // TableName: to.Ptr("myTable"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/RecommendedColumnSensitivityLabelEnable.json -func ExampleSensitivityLabelsClient_EnableRecommendation() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewSensitivityLabelsClient().EnableRecommendation(ctx, "myRG", "myServer", "myDatabase", "dbo", "myTable", "myColumn", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/RecommendedColumnSensitivityLabelDisable.json -func ExampleSensitivityLabelsClient_DisableRecommendation() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewSensitivityLabelsClient().DisableRecommendation(ctx, "myRG", "myServer", "myDatabase", "dbo", "myTable", "myColumn", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ColumnSensitivityLabelGet.json -func ExampleSensitivityLabelsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewSensitivityLabelsClient().Get(ctx, "myRG", "myServer", "myDatabase", "dbo", "myTable", "myColumn", armsql.SensitivityLabelSourceCurrent, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.SensitivityLabel = armsql.SensitivityLabel{ - // Name: to.Ptr("current"), - // Type: to.Ptr("Microsoft.Sql/servers/databases/schemas/tables/columns/sensitivityLabels"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/myRG/providers/Microsoft.Sql/servers/myServer/databases/myDatabase/schemas/dbo/tables/myTable/columns/myColumn/sensitivityLabels/current"), - // Properties: &armsql.SensitivityLabelProperties{ - // ColumnName: to.Ptr("myColumn"), - // InformationType: to.Ptr("PhoneNumber"), - // InformationTypeID: to.Ptr("d22fa6e9-5ee4-3bde-4c2b-a409604c4646"), - // LabelID: to.Ptr("bf91e08c-f4f0-478a-b016-25164b2a65ff"), - // LabelName: to.Ptr("PII"), - // Rank: to.Ptr(armsql.SensitivityLabelRankHigh), - // SchemaName: to.Ptr("dbo"), - // TableName: to.Ptr("myTable"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ColumnSensitivityLabelCreateMax.json -func ExampleSensitivityLabelsClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewSensitivityLabelsClient().CreateOrUpdate(ctx, "myRG", "myServer", "myDatabase", "dbo", "myTable", "myColumn", armsql.SensitivityLabel{ - Properties: &armsql.SensitivityLabelProperties{ - InformationType: to.Ptr("PhoneNumber"), - InformationTypeID: to.Ptr("d22fa6e9-5ee4-3bde-4c2b-a409604c4646"), - LabelID: to.Ptr("bf91e08c-f4f0-478a-b016-25164b2a65ff"), - LabelName: to.Ptr("PII"), - Rank: to.Ptr(armsql.SensitivityLabelRankLow), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.SensitivityLabel = armsql.SensitivityLabel{ - // Name: to.Ptr("current"), - // Type: to.Ptr("Microsoft.Sql/servers/databases/schemas/tables/columns/sensitivityLabels"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/myRG/providers/Microsoft.Sql/servers/myServer/databases/myDatabase/schemas/dbo/tables/myTable/columns/myColumn/sensitivityLabels/current"), - // Properties: &armsql.SensitivityLabelProperties{ - // ColumnName: to.Ptr("myColumn"), - // InformationType: to.Ptr("PhoneNumber"), - // InformationTypeID: to.Ptr("d22fa6e9-5ee4-3bde-4c2b-a409604c4646"), - // LabelID: to.Ptr("bf91e08c-f4f0-478a-b016-25164b2a65ff"), - // LabelName: to.Ptr("PII"), - // Rank: to.Ptr(armsql.SensitivityLabelRankMedium), - // SchemaName: to.Ptr("dbo"), - // TableName: to.Ptr("myTable"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ColumnSensitivityLabelDelete.json -func ExampleSensitivityLabelsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewSensitivityLabelsClient().Delete(ctx, "myRG", "myServer", "myDatabase", "dbo", "myTable", "myColumn", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/sql/armsql/serveradvancedthreatprotectionsettings_client.go b/sdk/resourcemanager/sql/armsql/serveradvancedthreatprotectionsettings_client.go index ca5ece224b5b..34bfad40f233 100644 --- a/sdk/resourcemanager/sql/armsql/serveradvancedthreatprotectionsettings_client.go +++ b/sdk/resourcemanager/sql/armsql/serveradvancedthreatprotectionsettings_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armsql @@ -47,7 +46,7 @@ func NewServerAdvancedThreatProtectionSettingsClient(subscriptionID string, cred // BeginCreateOrUpdate - Creates or updates an Advanced Threat Protection state. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -61,7 +60,8 @@ func (client *ServerAdvancedThreatProtectionSettingsClient) BeginCreateOrUpdate( if err != nil { return nil, err } - return runtime.NewPoller[ServerAdvancedThreatProtectionSettingsClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[ServerAdvancedThreatProtectionSettingsClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[ServerAdvancedThreatProtectionSettingsClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -70,20 +70,22 @@ func (client *ServerAdvancedThreatProtectionSettingsClient) BeginCreateOrUpdate( // CreateOrUpdate - Creates or updates an Advanced Threat Protection state. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-11-01-preview +// Generated from API version 2022-11-01-preview func (client *ServerAdvancedThreatProtectionSettingsClient) createOrUpdate(ctx context.Context, resourceGroupName string, serverName string, advancedThreatProtectionName AdvancedThreatProtectionName, parameters ServerAdvancedThreatProtection, options *ServerAdvancedThreatProtectionSettingsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, serverName, advancedThreatProtectionName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createOrUpdateCreateRequest creates the CreateOrUpdate request. @@ -110,16 +112,19 @@ func (client *ServerAdvancedThreatProtectionSettingsClient) createOrUpdateCreate return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // Get - Get a server's Advanced Threat Protection state. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -127,18 +132,21 @@ func (client *ServerAdvancedThreatProtectionSettingsClient) createOrUpdateCreate // - options - ServerAdvancedThreatProtectionSettingsClientGetOptions contains the optional parameters for the ServerAdvancedThreatProtectionSettingsClient.Get // method. func (client *ServerAdvancedThreatProtectionSettingsClient) Get(ctx context.Context, resourceGroupName string, serverName string, advancedThreatProtectionName AdvancedThreatProtectionName, options *ServerAdvancedThreatProtectionSettingsClientGetOptions) (ServerAdvancedThreatProtectionSettingsClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, serverName, advancedThreatProtectionName, options) if err != nil { return ServerAdvancedThreatProtectionSettingsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ServerAdvancedThreatProtectionSettingsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ServerAdvancedThreatProtectionSettingsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ServerAdvancedThreatProtectionSettingsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -165,7 +173,7 @@ func (client *ServerAdvancedThreatProtectionSettingsClient) getCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -182,7 +190,7 @@ func (client *ServerAdvancedThreatProtectionSettingsClient) getHandleResponse(re // NewListByServerPager - Get a list of the server's Advanced Threat Protection states. // -// Generated from API version 2021-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -236,7 +244,7 @@ func (client *ServerAdvancedThreatProtectionSettingsClient) listByServerCreateRe return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/sql/armsql/serveradvancedthreatprotectionsettings_client_example_test.go b/sdk/resourcemanager/sql/armsql/serveradvancedthreatprotectionsettings_client_example_test.go deleted file mode 100644 index 40102015ef6b..000000000000 --- a/sdk/resourcemanager/sql/armsql/serveradvancedthreatprotectionsettings_client_example_test.go +++ /dev/null @@ -1,191 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsql_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sql/armsql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/ServerAdvancedThreatProtectionSettingsListByServer.json -func ExampleServerAdvancedThreatProtectionSettingsClient_NewListByServerPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewServerAdvancedThreatProtectionSettingsClient().NewListByServerPager("threatprotection-4799", "threatprotection-6440", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.LogicalServerAdvancedThreatProtectionListResult = armsql.LogicalServerAdvancedThreatProtectionListResult{ - // Value: []*armsql.ServerAdvancedThreatProtection{ - // { - // Name: to.Ptr("Default"), - // Type: to.Ptr("Microsoft.Sql/servers/advancedThreatProtectionSettings"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/threatprotection-4799/providers/Microsoft.Sql/servers/threatprotection-6440/advancedThreatProtectionSettings"), - // Properties: &armsql.AdvancedThreatProtectionProperties{ - // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-04-03T04:41:33.937Z"); return t}()), - // State: to.Ptr(armsql.AdvancedThreatProtectionStateDisabled), - // }, - // SystemData: &armsql.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-04-03T04:41:33.937Z"); return t}()), - // CreatedBy: to.Ptr("string"), - // CreatedByType: to.Ptr(armsql.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-04-03T04:41:33.937Z"); return t}()), - // LastModifiedBy: to.Ptr("string"), - // LastModifiedByType: to.Ptr(armsql.CreatedByTypeUser), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/ServerAdvancedThreatProtectionSettingsGet.json -func ExampleServerAdvancedThreatProtectionSettingsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewServerAdvancedThreatProtectionSettingsClient().Get(ctx, "threatprotection-4799", "threatprotection-6440", armsql.AdvancedThreatProtectionNameDefault, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ServerAdvancedThreatProtection = armsql.ServerAdvancedThreatProtection{ - // Name: to.Ptr("Default"), - // Type: to.Ptr("Microsoft.Sql/servers/advancedThreatProtectionSettings"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/threatprotection-4799/providers/Microsoft.Sql/servers/threatprotection-6440/advancedThreatProtectionSettings/Default"), - // Properties: &armsql.AdvancedThreatProtectionProperties{ - // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-04-03T04:41:33.937Z"); return t}()), - // State: to.Ptr(armsql.AdvancedThreatProtectionStateDisabled), - // }, - // SystemData: &armsql.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-04-03T04:41:33.937Z"); return t}()), - // CreatedBy: to.Ptr("string"), - // CreatedByType: to.Ptr(armsql.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-04-03T04:41:33.937Z"); return t}()), - // LastModifiedBy: to.Ptr("string"), - // LastModifiedByType: to.Ptr(armsql.CreatedByTypeUser), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/ServerAdvancedThreatProtectionSettingsCreateMax.json -func ExampleServerAdvancedThreatProtectionSettingsClient_BeginCreateOrUpdate_updateAServersAdvancedThreatProtectionSettingsWithAllParameters() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewServerAdvancedThreatProtectionSettingsClient().BeginCreateOrUpdate(ctx, "threatprotection-4799", "threatprotection-6440", armsql.AdvancedThreatProtectionNameDefault, armsql.ServerAdvancedThreatProtection{ - Properties: &armsql.AdvancedThreatProtectionProperties{ - State: to.Ptr(armsql.AdvancedThreatProtectionStateEnabled), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ServerAdvancedThreatProtection = armsql.ServerAdvancedThreatProtection{ - // Name: to.Ptr("Default"), - // Type: to.Ptr("Microsoft.Sql/servers/advancedThreatProtectionSettings"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/threatprotection-4799/providers/Microsoft.Sql/servers/threatprotection-6440/advancedThreatProtectionSettings/Default"), - // Properties: &armsql.AdvancedThreatProtectionProperties{ - // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-04-03T04:41:33.937Z"); return t}()), - // State: to.Ptr(armsql.AdvancedThreatProtectionStateEnabled), - // }, - // SystemData: &armsql.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-04-03T04:41:33.937Z"); return t}()), - // CreatedBy: to.Ptr("string"), - // CreatedByType: to.Ptr(armsql.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-04-03T04:41:33.937Z"); return t}()), - // LastModifiedBy: to.Ptr("string"), - // LastModifiedByType: to.Ptr(armsql.CreatedByTypeUser), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/ServerAdvancedThreatProtectionSettingsCreateMin.json -func ExampleServerAdvancedThreatProtectionSettingsClient_BeginCreateOrUpdate_updateAServersAdvancedThreatProtectionSettingsWithMinimalParameters() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewServerAdvancedThreatProtectionSettingsClient().BeginCreateOrUpdate(ctx, "threatprotection-4799", "threatprotection-6440", armsql.AdvancedThreatProtectionNameDefault, armsql.ServerAdvancedThreatProtection{ - Properties: &armsql.AdvancedThreatProtectionProperties{ - State: to.Ptr(armsql.AdvancedThreatProtectionStateDisabled), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ServerAdvancedThreatProtection = armsql.ServerAdvancedThreatProtection{ - // Name: to.Ptr("Default"), - // Type: to.Ptr("Microsoft.Sql/servers/advancedThreatProtectionSettings"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/threatprotection-4799/providers/Microsoft.Sql/servers/threatprotection-6440/advancedThreatProtectionSettings/Default"), - // Properties: &armsql.AdvancedThreatProtectionProperties{ - // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-04-03T04:41:33.937Z"); return t}()), - // State: to.Ptr(armsql.AdvancedThreatProtectionStateDisabled), - // }, - // SystemData: &armsql.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-04-03T04:41:33.937Z"); return t}()), - // CreatedBy: to.Ptr("string"), - // CreatedByType: to.Ptr(armsql.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-04-03T04:41:33.937Z"); return t}()), - // LastModifiedBy: to.Ptr("string"), - // LastModifiedByType: to.Ptr(armsql.CreatedByTypeUser), - // }, - // } -} diff --git a/sdk/resourcemanager/sql/armsql/serveradvisors_client.go b/sdk/resourcemanager/sql/armsql/serveradvisors_client.go index f0888aabb73e..4aa8f976b5b2 100644 --- a/sdk/resourcemanager/sql/armsql/serveradvisors_client.go +++ b/sdk/resourcemanager/sql/armsql/serveradvisors_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armsql @@ -47,25 +46,28 @@ func NewServerAdvisorsClient(subscriptionID string, credential azcore.TokenCrede // Get - Gets a server advisor. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. // - advisorName - The name of the Server Advisor. // - options - ServerAdvisorsClientGetOptions contains the optional parameters for the ServerAdvisorsClient.Get method. func (client *ServerAdvisorsClient) Get(ctx context.Context, resourceGroupName string, serverName string, advisorName string, options *ServerAdvisorsClientGetOptions) (ServerAdvisorsClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, serverName, advisorName, options) if err != nil { return ServerAdvisorsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ServerAdvisorsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ServerAdvisorsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ServerAdvisorsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -92,7 +94,7 @@ func (client *ServerAdvisorsClient) getCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -110,25 +112,28 @@ func (client *ServerAdvisorsClient) getHandleResponse(resp *http.Response) (Serv // ListByServer - Gets a list of server advisors. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. // - options - ServerAdvisorsClientListByServerOptions contains the optional parameters for the ServerAdvisorsClient.ListByServer // method. func (client *ServerAdvisorsClient) ListByServer(ctx context.Context, resourceGroupName string, serverName string, options *ServerAdvisorsClientListByServerOptions) (ServerAdvisorsClientListByServerResponse, error) { + var err error req, err := client.listByServerCreateRequest(ctx, resourceGroupName, serverName, options) if err != nil { return ServerAdvisorsClientListByServerResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ServerAdvisorsClientListByServerResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ServerAdvisorsClientListByServerResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ServerAdvisorsClientListByServerResponse{}, err } - return client.listByServerHandleResponse(resp) + resp, err := client.listByServerHandleResponse(httpResp) + return resp, err } // listByServerCreateRequest creates the ListByServer request. @@ -154,7 +159,7 @@ func (client *ServerAdvisorsClient) listByServerCreateRequest(ctx context.Contex if options != nil && options.Expand != nil { reqQP.Set("$expand", *options.Expand) } - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -172,7 +177,7 @@ func (client *ServerAdvisorsClient) listByServerHandleResponse(resp *http.Respon // Update - Updates a server advisor. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -180,18 +185,21 @@ func (client *ServerAdvisorsClient) listByServerHandleResponse(resp *http.Respon // - parameters - The requested advisor resource state. // - options - ServerAdvisorsClientUpdateOptions contains the optional parameters for the ServerAdvisorsClient.Update method. func (client *ServerAdvisorsClient) Update(ctx context.Context, resourceGroupName string, serverName string, advisorName string, parameters Advisor, options *ServerAdvisorsClientUpdateOptions) (ServerAdvisorsClientUpdateResponse, error) { + var err error req, err := client.updateCreateRequest(ctx, resourceGroupName, serverName, advisorName, parameters, options) if err != nil { return ServerAdvisorsClientUpdateResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ServerAdvisorsClientUpdateResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ServerAdvisorsClientUpdateResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ServerAdvisorsClientUpdateResponse{}, err } - return client.updateHandleResponse(resp) + resp, err := client.updateHandleResponse(httpResp) + return resp, err } // updateCreateRequest creates the Update request. @@ -218,10 +226,13 @@ func (client *ServerAdvisorsClient) updateCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // updateHandleResponse handles the Update response. diff --git a/sdk/resourcemanager/sql/armsql/serveradvisors_client_example_test.go b/sdk/resourcemanager/sql/armsql/serveradvisors_client_example_test.go deleted file mode 100644 index 633805180c12..000000000000 --- a/sdk/resourcemanager/sql/armsql/serveradvisors_client_example_test.go +++ /dev/null @@ -1,812 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsql_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sql/armsql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerAdvisorList.json -func ExampleServerAdvisorsClient_ListByServer_listOfServerAdvisors() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewServerAdvisorsClient().ListByServer(ctx, "workloadinsight-demos", "misosisvr", &armsql.ServerAdvisorsClientListByServerOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.AdvisorArray = []*armsql.Advisor{ - // { - // Name: to.Ptr("CreateIndex"), - // Type: to.Ptr("Microsoft.Sql/servers/advisors"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/workloadinsight-demos/providers/Microsoft.Sql/servers/misosisvr/advisors/CreateIndex"), - // Kind: to.Ptr(""), - // Location: to.Ptr("East Asia"), - // Properties: &armsql.AdvisorProperties{ - // AdvisorStatus: to.Ptr(armsql.AdvisorStatusGA), - // AutoExecuteStatus: to.Ptr(armsql.AutoExecuteStatusDisabled), - // AutoExecuteStatusInheritedFrom: to.Ptr(armsql.AutoExecuteStatusInheritedFromDefault), - // }, - // }, - // { - // Name: to.Ptr("DropIndex"), - // Type: to.Ptr("Microsoft.Sql/servers/advisors"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/workloadinsight-demos/providers/Microsoft.Sql/servers/misosisvr/advisors/DropIndex"), - // Kind: to.Ptr(""), - // Location: to.Ptr("East Asia"), - // Properties: &armsql.AdvisorProperties{ - // AdvisorStatus: to.Ptr(armsql.AdvisorStatusGA), - // AutoExecuteStatus: to.Ptr(armsql.AutoExecuteStatusDisabled), - // AutoExecuteStatusInheritedFrom: to.Ptr(armsql.AutoExecuteStatusInheritedFromDefault), - // }, - // }, - // { - // Name: to.Ptr("DbParameterization"), - // Type: to.Ptr("Microsoft.Sql/servers/advisors"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/workloadinsight-demos/providers/Microsoft.Sql/servers/misosisvr/advisors/DbParameterization"), - // Kind: to.Ptr(""), - // Location: to.Ptr("East Asia"), - // Properties: &armsql.AdvisorProperties{ - // AdvisorStatus: to.Ptr(armsql.AdvisorStatusGA), - // AutoExecuteStatus: to.Ptr(armsql.AutoExecuteStatusDisabled), - // AutoExecuteStatusInheritedFrom: to.Ptr(armsql.AutoExecuteStatusInheritedFromDefault), - // }, - // }, - // { - // Name: to.Ptr("SchemaIssue"), - // Type: to.Ptr("Microsoft.Sql/servers/advisors"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/workloadinsight-demos/providers/Microsoft.Sql/servers/misosisvr/advisors/SchemaIssue"), - // Kind: to.Ptr(""), - // Location: to.Ptr("East Asia"), - // Properties: &armsql.AdvisorProperties{ - // AdvisorStatus: to.Ptr(armsql.AdvisorStatusPublicPreview), - // AutoExecuteStatus: to.Ptr(armsql.AutoExecuteStatusDisabled), - // AutoExecuteStatusInheritedFrom: to.Ptr(armsql.AutoExecuteStatusInheritedFromDefault), - // }, - // }, - // { - // Name: to.Ptr("ForceLastGoodPlan"), - // Type: to.Ptr("Microsoft.Sql/servers/advisors"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/workloadinsight-demos/providers/Microsoft.Sql/servers/misosisvr/advisors/ForceLastGoodPlan"), - // Kind: to.Ptr(""), - // Location: to.Ptr("East Asia"), - // Properties: &armsql.AdvisorProperties{ - // AdvisorStatus: to.Ptr(armsql.AdvisorStatusPrivatePreview), - // AutoExecuteStatus: to.Ptr(armsql.AutoExecuteStatusDisabled), - // AutoExecuteStatusInheritedFrom: to.Ptr(armsql.AutoExecuteStatusInheritedFromDefault), - // }, - // }} -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerRecommendedActionListExpand.json -func ExampleServerAdvisorsClient_ListByServer_listOfServerRecommendedActionsForAllAdvisors() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewServerAdvisorsClient().ListByServer(ctx, "workloadinsight-demos", "misosisvr", &armsql.ServerAdvisorsClientListByServerOptions{Expand: to.Ptr("recommendedActions")}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.AdvisorArray = []*armsql.Advisor{ - // { - // Name: to.Ptr("CreateIndex"), - // Type: to.Ptr("Microsoft.Sql/servers/advisors"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/workloadinsight-demos/providers/Microsoft.Sql/servers/misosisvr/advisors/CreateIndex"), - // Kind: to.Ptr(""), - // Location: to.Ptr("East Asia"), - // Properties: &armsql.AdvisorProperties{ - // AdvisorStatus: to.Ptr(armsql.AdvisorStatusGA), - // AutoExecuteStatus: to.Ptr(armsql.AutoExecuteStatusDisabled), - // AutoExecuteStatusInheritedFrom: to.Ptr(armsql.AutoExecuteStatusInheritedFromServer), - // RecommendedActions: []*armsql.RecommendedAction{ - // { - // Name: to.Ptr("IR_[CRM]_[DataPoints]_4821CD2F9510D98184BB"), - // Type: to.Ptr("Microsoft.Sql/servers/advisors/recommendedActions"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/workloadinsight-demos/providers/Microsoft.Sql/servers/misosisvr/advisors/CreateIndex/recommendedActions/IR_[CRM]_[DataPoints]_4821CD2F9510D98184BB"), - // Kind: to.Ptr(""), - // Location: to.Ptr("East Asia"), - // Properties: &armsql.RecommendedActionProperties{ - // ErrorDetails: &armsql.RecommendedActionErrorInfo{ - // }, - // EstimatedImpact: []*armsql.RecommendedActionImpactRecord{ - // { - // AbsoluteValue: to.Ptr[float64](1440), - // DimensionName: to.Ptr("ActionDuration"), - // Unit: to.Ptr("Seconds"), - // }, - // { - // AbsoluteValue: to.Ptr[float64](209.3125), - // DimensionName: to.Ptr("SpaceChange"), - // Unit: to.Ptr("Megabytes"), - // }}, - // ImplementationDetails: &armsql.RecommendedActionImplementationInfo{ - // Method: to.Ptr(armsql.ImplementationMethodTSQL), - // Script: to.Ptr("CREATE NONCLUSTERED INDEX [nci_wi_DataPoints_B892614093BAC56295EF6018BD4CB51B] ON [CRM].[DataPoints] ([Name],[Money],[Power]) INCLUDE ([Hour], [System], [LastChanged]) WITH (ONLINE = ON)"), - // }, - // IsArchivedAction: to.Ptr(false), - // IsExecutableAction: to.Ptr(true), - // IsRevertableAction: to.Ptr(true), - // LastRefresh: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-03-01T14:38:04Z"); return t}()), - // ObservedImpact: []*armsql.RecommendedActionImpactRecord{ - // }, - // RecommendationReason: to.Ptr(""), - // Score: to.Ptr[int32](1), - // State: &armsql.RecommendedActionStateInfo{ - // CurrentValue: to.Ptr(armsql.RecommendedActionCurrentStateActive), - // LastModified: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-06-20T15:15:40Z"); return t}()), - // }, - // TimeSeries: []*armsql.RecommendedActionMetricInfo{ - // }, - // ValidSince: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-03-01T14:38:04Z"); return t}()), - // Details: map[string]any{ - // "schema": "[CRM]", - // "databaseName": "IndexAdvisor_test_3", - // "includedColumns": "[Hour], [System], [LastChanged]", - // "indexColumns": "[Name],[Money],[Power]", - // "indexName": "nci_wi_DataPoints_B892614093BAC56295EF6018BD4CB51B", - // "indexType": "NONCLUSTERED", - // "table": "[DataPoints]", - // }, - // }, - // }, - // { - // Name: to.Ptr("IR_[dbo]_[Employees]_560E15A98D14CA09BDFB"), - // Type: to.Ptr("Microsoft.Sql/servers/advisors/recommendedActions"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/workloadinsight-demos/providers/Microsoft.Sql/servers/misosisvr/advisors/CreateIndex/recommendedActions/IR_[dbo]_[Employees]_560E15A98D14CA09BDFB"), - // Kind: to.Ptr(""), - // Location: to.Ptr("East Asia"), - // Properties: &armsql.RecommendedActionProperties{ - // ErrorDetails: &armsql.RecommendedActionErrorInfo{ - // }, - // EstimatedImpact: []*armsql.RecommendedActionImpactRecord{ - // { - // AbsoluteValue: to.Ptr[float64](17), - // DimensionName: to.Ptr("ActionDuration"), - // Unit: to.Ptr("Seconds"), - // }, - // { - // AbsoluteValue: to.Ptr[float64](128), - // DimensionName: to.Ptr("SpaceChange"), - // Unit: to.Ptr("Megabytes"), - // }}, - // ImplementationDetails: &armsql.RecommendedActionImplementationInfo{ - // Method: to.Ptr(armsql.ImplementationMethodTSQL), - // Script: to.Ptr("CREATE NONCLUSTERED INDEX [nci_wi_Employees_8C18C2AF4267DC77793040782641CCDE] ON [dbo].[Employees] ([City], [State]) INCLUDE ([Postal]) WITH (ONLINE = ON)"), - // }, - // IsArchivedAction: to.Ptr(false), - // IsExecutableAction: to.Ptr(true), - // IsRevertableAction: to.Ptr(true), - // LastRefresh: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-03-01T14:38:05Z"); return t}()), - // ObservedImpact: []*armsql.RecommendedActionImpactRecord{ - // }, - // RecommendationReason: to.Ptr(""), - // Score: to.Ptr[int32](3), - // State: &armsql.RecommendedActionStateInfo{ - // CurrentValue: to.Ptr(armsql.RecommendedActionCurrentStateActive), - // LastModified: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-03-01T14:38:05Z"); return t}()), - // }, - // TimeSeries: []*armsql.RecommendedActionMetricInfo{ - // }, - // ValidSince: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-03-01T14:38:05Z"); return t}()), - // Details: map[string]any{ - // "schema": "[dbo]", - // "databaseName": "IndexAdvisor_test_3", - // "includedColumns": "[Postal]", - // "indexColumns": "[City], [State]", - // "indexName": "nci_wi_Employees_8C18C2AF4267DC77793040782641CCDE", - // "indexType": "NONCLUSTERED", - // "table": "[Employees]", - // }, - // }, - // }, - // { - // Name: to.Ptr("IR_[dbo]_[DataPoints]_F5D2F347AA22DB46E4CC"), - // Type: to.Ptr("Microsoft.Sql/servers/advisors/recommendedActions"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/workloadinsight-demos/providers/Microsoft.Sql/servers/misosisvr/advisors/CreateIndex/recommendedActions/IR_[dbo]_[DataPoints]_F5D2F347AA22DB46E4CC"), - // Kind: to.Ptr(""), - // Location: to.Ptr("East Asia"), - // Properties: &armsql.RecommendedActionProperties{ - // ErrorDetails: &armsql.RecommendedActionErrorInfo{ - // }, - // EstimatedImpact: []*armsql.RecommendedActionImpactRecord{ - // { - // AbsoluteValue: to.Ptr[float64](5040), - // DimensionName: to.Ptr("ActionDuration"), - // Unit: to.Ptr("Seconds"), - // }, - // { - // AbsoluteValue: to.Ptr[float64](120), - // DimensionName: to.Ptr("SpaceChange"), - // Unit: to.Ptr("Megabytes"), - // }}, - // ExecuteActionDuration: to.Ptr("PT1M"), - // ExecuteActionInitiatedBy: to.Ptr(armsql.RecommendedActionInitiatedByUser), - // ExecuteActionInitiatedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-03-01T14:38:05Z"); return t}()), - // ExecuteActionStartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-03-01T14:38:05Z"); return t}()), - // ImplementationDetails: &armsql.RecommendedActionImplementationInfo{ - // Method: to.Ptr(armsql.ImplementationMethodTSQL), - // Script: to.Ptr("DROP INDEX [nci_wi_DataPoints_609E4B7D6A3813990ED44B28B340C8FC] ON [dbo].[DataPoints]"), - // }, - // IsArchivedAction: to.Ptr(false), - // IsExecutableAction: to.Ptr(true), - // IsRevertableAction: to.Ptr(true), - // LastRefresh: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-03-01T14:38:05Z"); return t}()), - // ObservedImpact: []*armsql.RecommendedActionImpactRecord{ - // { - // ChangeValueAbsolute: to.Ptr[float64](-12.7), - // ChangeValueRelative: to.Ptr[float64](-0.9), - // DimensionName: to.Ptr("AffectedQueriesCpuUtilization"), - // Unit: to.Ptr("CpuCores"), - // }, - // { - // ChangeValueAbsolute: to.Ptr[float64](-12.7), - // ChangeValueRelative: to.Ptr[float64](-0.3175), - // DimensionName: to.Ptr("CpuUtilization"), - // Unit: to.Ptr("CpuCores"), - // }, - // { - // AbsoluteValue: to.Ptr[float64](12), - // DimensionName: to.Ptr("QueriesWithImprovedPerformance"), - // Unit: to.Ptr("Count"), - // }, - // { - // AbsoluteValue: to.Ptr[float64](1), - // DimensionName: to.Ptr("QueriesWithRegressedPerformance"), - // Unit: to.Ptr("Count"), - // }, - // { - // AbsoluteValue: to.Ptr[float64](130.742187), - // DimensionName: to.Ptr("SpaceChange"), - // Unit: to.Ptr("Megabytes"), - // }, - // { - // AbsoluteValue: to.Ptr[float64](0), - // DimensionName: to.Ptr("VerificationProgress"), - // Unit: to.Ptr("Percent"), - // }}, - // RecommendationReason: to.Ptr(""), - // Score: to.Ptr[int32](3), - // State: &armsql.RecommendedActionStateInfo{ - // ActionInitiatedBy: to.Ptr(armsql.RecommendedActionInitiatedByUser), - // CurrentValue: to.Ptr(armsql.RecommendedActionCurrentStateSuccess), - // LastModified: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-03-01T14:38:05Z"); return t}()), - // }, - // TimeSeries: []*armsql.RecommendedActionMetricInfo{ - // }, - // ValidSince: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-03-01T14:38:05Z"); return t}()), - // Details: map[string]any{ - // "schema": "[dbo]", - // "databaseName": "IndexAdvisor_test_3", - // "includedColumns": "[Power],[Pineapple]", - // "indexActionDuration": "00:01:00", - // "indexActionStartTime": "2017-03-01T14:38:05.337", - // "indexColumns": "[Name],[Money]", - // "indexName": "nci_wi_DataPoints_609E4B7D6A3813990ED44B28B340C8FC", - // "indexType": "NONCLUSTERED", - // "table": "[DataPoints]", - // }, - // }, - // }}, - // }, - // }, - // { - // Name: to.Ptr("DropIndex"), - // Type: to.Ptr("Microsoft.Sql/servers/advisors"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/workloadinsight-demos/providers/Microsoft.Sql/servers/misosisvr/advisors/DropIndex"), - // Kind: to.Ptr(""), - // Location: to.Ptr("East Asia"), - // Properties: &armsql.AdvisorProperties{ - // AdvisorStatus: to.Ptr(armsql.AdvisorStatusGA), - // AutoExecuteStatus: to.Ptr(armsql.AutoExecuteStatusDisabled), - // AutoExecuteStatusInheritedFrom: to.Ptr(armsql.AutoExecuteStatusInheritedFromDefault), - // RecommendedActions: []*armsql.RecommendedAction{ - // { - // Name: to.Ptr("IR_[CRM]_[DataPoints1]_29AEA82685D24704DE1A"), - // Type: to.Ptr("Microsoft.Sql/servers/advisors/recommendedActions"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/workloadinsight-demos/providers/Microsoft.Sql/servers/misosisvr/advisors/DropIndex/recommendedActions/IR_[CRM]_[DataPoints1]_29AEA82685D24704DE1A"), - // Kind: to.Ptr(""), - // Location: to.Ptr("East Asia"), - // Properties: &armsql.RecommendedActionProperties{ - // ErrorDetails: &armsql.RecommendedActionErrorInfo{ - // }, - // EstimatedImpact: []*armsql.RecommendedActionImpactRecord{ - // { - // AbsoluteValue: to.Ptr[float64](803), - // DimensionName: to.Ptr("ActionDuration"), - // Unit: to.Ptr("Seconds"), - // }, - // { - // AbsoluteValue: to.Ptr[float64](144.6875), - // DimensionName: to.Ptr("SpaceChange"), - // Unit: to.Ptr("Megabytes"), - // }}, - // ExecuteActionInitiatedBy: to.Ptr(armsql.RecommendedActionInitiatedBySystem), - // ExecuteActionInitiatedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-03-01T14:38:05Z"); return t}()), - // ImplementationDetails: &armsql.RecommendedActionImplementationInfo{ - // Method: to.Ptr(armsql.ImplementationMethodTSQL), - // Script: to.Ptr("DROP INDEX [MyIndex123] ON [CRM].[DataPoints1]"), - // }, - // IsArchivedAction: to.Ptr(false), - // IsExecutableAction: to.Ptr(true), - // IsRevertableAction: to.Ptr(true), - // LastRefresh: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-03-01T14:38:05Z"); return t}()), - // ObservedImpact: []*armsql.RecommendedActionImpactRecord{ - // }, - // RecommendationReason: to.Ptr("Duplicate"), - // Score: to.Ptr[int32](1), - // State: &armsql.RecommendedActionStateInfo{ - // ActionInitiatedBy: to.Ptr(armsql.RecommendedActionInitiatedBySystem), - // CurrentValue: to.Ptr(armsql.RecommendedActionCurrentStatePending), - // LastModified: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-03-01T14:38:05Z"); return t}()), - // }, - // TimeSeries: []*armsql.RecommendedActionMetricInfo{ - // }, - // ValidSince: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-03-01T14:38:05Z"); return t}()), - // Details: map[string]any{ - // "schema": "[CRM]", - // "databaseName": "IndexAdvisor_test_3", - // "includedColumns": "[Apple]", - // "indexColumns": "[Cookies],[SessionId]", - // "indexName": "MyIndex123", - // "indexType": "NONCLUSTERED", - // "originalIndexName": "IX_COM_SKU_SKUDepartmentID", - // "table": "[DataPoints1]", - // }, - // }, - // }, - // { - // Name: to.Ptr("IR_[CRM]_[DataPoints2]_E4B21F229379807E531A"), - // Type: to.Ptr("Microsoft.Sql/servers/advisors/recommendedActions"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/workloadinsight-demos/providers/Microsoft.Sql/servers/misosisvr/advisors/DropIndex/recommendedActions/IR_[CRM]_[DataPoints2]_E4B21F229379807E531A"), - // Kind: to.Ptr(""), - // Location: to.Ptr("East Asia"), - // Properties: &armsql.RecommendedActionProperties{ - // ErrorDetails: &armsql.RecommendedActionErrorInfo{ - // }, - // EstimatedImpact: []*armsql.RecommendedActionImpactRecord{ - // { - // AbsoluteValue: to.Ptr[float64](705), - // DimensionName: to.Ptr("ActionDuration"), - // Unit: to.Ptr("Seconds"), - // }, - // { - // AbsoluteValue: to.Ptr[float64](342), - // DimensionName: to.Ptr("SpaceChange"), - // Unit: to.Ptr("Megabytes"), - // }}, - // ExecuteActionDuration: to.Ptr("PT1M"), - // ExecuteActionInitiatedBy: to.Ptr(armsql.RecommendedActionInitiatedByUser), - // ExecuteActionInitiatedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-03-01T14:38:05Z"); return t}()), - // ExecuteActionStartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-03-01T14:38:05Z"); return t}()), - // ImplementationDetails: &armsql.RecommendedActionImplementationInfo{ - // Method: to.Ptr(armsql.ImplementationMethodTSQL), - // Script: to.Ptr("CREATE NONCLUSTERED INDEX [MyIndex321] ON [CRM].[DataPoints2] ([Cookies],[SessionId],[Protocol]) INCLUDE ([Apple]) WITH (ONLINE = ON)"), - // }, - // IsArchivedAction: to.Ptr(false), - // IsExecutableAction: to.Ptr(true), - // IsRevertableAction: to.Ptr(true), - // LastRefresh: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-03-01T14:38:05Z"); return t}()), - // ObservedImpact: []*armsql.RecommendedActionImpactRecord{ - // { - // ChangeValueAbsolute: to.Ptr[float64](0), - // ChangeValueRelative: to.Ptr[float64](0), - // DimensionName: to.Ptr("AffectedQueriesCpuUtilization"), - // Unit: to.Ptr("CpuCores"), - // }, - // { - // ChangeValueAbsolute: to.Ptr[float64](0), - // ChangeValueRelative: to.Ptr[float64](0), - // DimensionName: to.Ptr("CpuUtilization"), - // Unit: to.Ptr("CpuCores"), - // }, - // { - // AbsoluteValue: to.Ptr[float64](0), - // DimensionName: to.Ptr("QueriesWithImprovedPerformance"), - // Unit: to.Ptr("Count"), - // }, - // { - // AbsoluteValue: to.Ptr[float64](0), - // DimensionName: to.Ptr("QueriesWithRegressedPerformance"), - // Unit: to.Ptr("Count"), - // }, - // { - // AbsoluteValue: to.Ptr[float64](-342), - // DimensionName: to.Ptr("SpaceChange"), - // Unit: to.Ptr("Megabytes"), - // }, - // { - // AbsoluteValue: to.Ptr[float64](0), - // DimensionName: to.Ptr("VerificationProgress"), - // Unit: to.Ptr("Percent"), - // }}, - // RecommendationReason: to.Ptr("Duplicate"), - // Score: to.Ptr[int32](1), - // State: &armsql.RecommendedActionStateInfo{ - // ActionInitiatedBy: to.Ptr(armsql.RecommendedActionInitiatedByUser), - // CurrentValue: to.Ptr(armsql.RecommendedActionCurrentStateSuccess), - // LastModified: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-03-01T14:38:05Z"); return t}()), - // }, - // TimeSeries: []*armsql.RecommendedActionMetricInfo{ - // }, - // ValidSince: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-03-01T14:38:05Z"); return t}()), - // Details: map[string]any{ - // "schema": "[CRM]", - // "databaseName": "IndexAdvisor_test_3", - // "includedColumns": "[Apple]", - // "indexActionDuration": "00:01:00", - // "indexActionStartTime": "2017-03-01T14:38:05.697", - // "indexColumns": "[Cookies],[SessionId],[Protocol]", - // "indexName": "MyIndex321", - // "indexType": "NONCLUSTERED", - // "originalIndexName": "IX_COM_SKU_SKUDepartmentID", - // "table": "[DataPoints2]", - // }, - // }, - // }, - // { - // Name: to.Ptr("IR_[dbo]_[FactFinance]_13ADA5F354E9E14A983B"), - // Type: to.Ptr("Microsoft.Sql/servers/advisors/recommendedActions"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/workloadinsight-demos/providers/Microsoft.Sql/servers/misosisvr/advisors/DropIndex/recommendedActions/IR_[dbo]_[FactFinance]_13ADA5F354E9E14A983B"), - // Kind: to.Ptr(""), - // Location: to.Ptr("East Asia"), - // Properties: &armsql.RecommendedActionProperties{ - // ErrorDetails: &armsql.RecommendedActionErrorInfo{ - // }, - // EstimatedImpact: []*armsql.RecommendedActionImpactRecord{ - // { - // AbsoluteValue: to.Ptr[float64](705), - // DimensionName: to.Ptr("ActionDuration"), - // Unit: to.Ptr("Seconds"), - // }, - // { - // AbsoluteValue: to.Ptr[float64](342), - // DimensionName: to.Ptr("SpaceChange"), - // Unit: to.Ptr("Megabytes"), - // }}, - // ExecuteActionDuration: to.Ptr("PT1M"), - // ExecuteActionInitiatedBy: to.Ptr(armsql.RecommendedActionInitiatedBySystem), - // ExecuteActionInitiatedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-03-01T14:38:05Z"); return t}()), - // ExecuteActionStartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-03-01T14:38:05Z"); return t}()), - // ImplementationDetails: &armsql.RecommendedActionImplementationInfo{ - // Method: to.Ptr(armsql.ImplementationMethodTSQL), - // Script: to.Ptr("CREATE NONCLUSTERED INDEX [IX_FF] ON [dbo].[FactFinance] ([FinanceKey],[DateKey]) INCLUDE ([OrganizationKey]) WITH (ONLINE = ON)"), - // }, - // IsArchivedAction: to.Ptr(false), - // IsExecutableAction: to.Ptr(true), - // IsRevertableAction: to.Ptr(true), - // LastRefresh: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-03-01T14:38:05Z"); return t}()), - // ObservedImpact: []*armsql.RecommendedActionImpactRecord{ - // { - // ChangeValueAbsolute: to.Ptr[float64](0), - // ChangeValueRelative: to.Ptr[float64](0), - // DimensionName: to.Ptr("AffectedQueriesCpuUtilization"), - // Unit: to.Ptr("CpuCores"), - // }, - // { - // ChangeValueAbsolute: to.Ptr[float64](0), - // ChangeValueRelative: to.Ptr[float64](0), - // DimensionName: to.Ptr("CpuUtilization"), - // Unit: to.Ptr("CpuCores"), - // }, - // { - // AbsoluteValue: to.Ptr[float64](0), - // DimensionName: to.Ptr("QueriesWithImprovedPerformance"), - // Unit: to.Ptr("Count"), - // }, - // { - // AbsoluteValue: to.Ptr[float64](0), - // DimensionName: to.Ptr("QueriesWithRegressedPerformance"), - // Unit: to.Ptr("Count"), - // }, - // { - // AbsoluteValue: to.Ptr[float64](-342), - // DimensionName: to.Ptr("SpaceChange"), - // Unit: to.Ptr("Megabytes"), - // }, - // { - // AbsoluteValue: to.Ptr[float64](0), - // DimensionName: to.Ptr("VerificationProgress"), - // Unit: to.Ptr("Percent"), - // }}, - // RecommendationReason: to.Ptr("Duplicate"), - // Score: to.Ptr[int32](1), - // State: &armsql.RecommendedActionStateInfo{ - // ActionInitiatedBy: to.Ptr(armsql.RecommendedActionInitiatedBySystem), - // CurrentValue: to.Ptr(armsql.RecommendedActionCurrentStateSuccess), - // LastModified: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-02-28T14:38:05Z"); return t}()), - // }, - // TimeSeries: []*armsql.RecommendedActionMetricInfo{ - // }, - // ValidSince: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-03-01T14:38:05Z"); return t}()), - // Details: map[string]any{ - // "schema": "[dbo]", - // "databaseName": "IndexAdvisor_test_3", - // "includedColumns": "[OrganizationKey]", - // "indexActionDuration": "00:01:00", - // "indexActionStartTime": "2017-03-01T14:38:05.837", - // "indexColumns": "[FinanceKey],[DateKey]", - // "indexName": "IX_FF", - // "indexType": "NONCLUSTERED", - // "originalIndexName": "IX_COM_SKU_SKUDepartmentID", - // "table": "[FactFinance]", - // }, - // }, - // }, - // { - // Name: to.Ptr("IR_[CRM]_[DataPoints1]_13ADA5F354E9E14A983B"), - // Type: to.Ptr("Microsoft.Sql/servers/advisors/recommendedActions"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/workloadinsight-demos/providers/Microsoft.Sql/servers/misosisvr/advisors/DropIndex/recommendedActions/IR_[CRM]_[DataPoints1]_13ADA5F354E9E14A983B"), - // Kind: to.Ptr(""), - // Location: to.Ptr("East Asia"), - // Properties: &armsql.RecommendedActionProperties{ - // ErrorDetails: &armsql.RecommendedActionErrorInfo{ - // }, - // EstimatedImpact: []*armsql.RecommendedActionImpactRecord{ - // { - // AbsoluteValue: to.Ptr[float64](645), - // DimensionName: to.Ptr("ActionDuration"), - // Unit: to.Ptr("Seconds"), - // }, - // { - // AbsoluteValue: to.Ptr[float64](342), - // DimensionName: to.Ptr("SpaceChange"), - // Unit: to.Ptr("Megabytes"), - // }}, - // ExecuteActionInitiatedBy: to.Ptr(armsql.RecommendedActionInitiatedBySystem), - // ExecuteActionInitiatedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-03-23T14:14:35Z"); return t}()), - // ImplementationDetails: &armsql.RecommendedActionImplementationInfo{ - // Method: to.Ptr(armsql.ImplementationMethodTSQL), - // Script: to.Ptr("DROP INDEX [IX_FF] ON [CRM].[DataPoints1]"), - // }, - // IsArchivedAction: to.Ptr(false), - // IsExecutableAction: to.Ptr(true), - // IsRevertableAction: to.Ptr(true), - // LastRefresh: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-03-01T14:38:05Z"); return t}()), - // ObservedImpact: []*armsql.RecommendedActionImpactRecord{ - // }, - // RecommendationReason: to.Ptr("Unused"), - // Score: to.Ptr[int32](1), - // State: &armsql.RecommendedActionStateInfo{ - // ActionInitiatedBy: to.Ptr(armsql.RecommendedActionInitiatedBySystem), - // CurrentValue: to.Ptr(armsql.RecommendedActionCurrentStatePending), - // LastModified: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-03-23T14:14:35Z"); return t}()), - // }, - // TimeSeries: []*armsql.RecommendedActionMetricInfo{ - // }, - // ValidSince: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-03-01T14:38:05Z"); return t}()), - // Details: map[string]any{ - // "schema": "[CRM]", - // "databaseName": "IndexAdvisor_test_3", - // "includedColumns": "[Apple]", - // "indexColumns": "[Protocol],[SessionId]", - // "indexName": "IX_FF", - // "indexType": "NONCLUSTERED", - // "originalIndexName": "IX_COM_SKU_SKUDepartmentID", - // "table": "[DataPoints1]", - // }, - // }, - // }}, - // }, - // }, - // { - // Name: to.Ptr("DbParameterization"), - // Type: to.Ptr("Microsoft.Sql/servers/advisors"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/workloadinsight-demos/providers/Microsoft.Sql/servers/misosisvr/advisors/DbParameterization"), - // Kind: to.Ptr(""), - // Location: to.Ptr("East Asia"), - // Properties: &armsql.AdvisorProperties{ - // AdvisorStatus: to.Ptr(armsql.AdvisorStatusGA), - // AutoExecuteStatus: to.Ptr(armsql.AutoExecuteStatusDisabled), - // AutoExecuteStatusInheritedFrom: to.Ptr(armsql.AutoExecuteStatusInheritedFromDefault), - // RecommendedActions: []*armsql.RecommendedAction{ - // { - // Name: to.Ptr("ForceDbParameterization"), - // Type: to.Ptr("Microsoft.Sql/servers/advisors/recommendedActions"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/workloadinsight-demos/providers/Microsoft.Sql/servers/misosisvr/advisors/DbParameterization/recommendedActions/ForceDbParameterization"), - // Kind: to.Ptr(""), - // Location: to.Ptr("East Asia"), - // Properties: &armsql.RecommendedActionProperties{ - // ErrorDetails: &armsql.RecommendedActionErrorInfo{ - // }, - // EstimatedImpact: []*armsql.RecommendedActionImpactRecord{ - // { - // ChangeValueAbsolute: to.Ptr[float64](22.5613696939135), - // DimensionName: to.Ptr("CpuSavings"), - // Unit: to.Ptr("Percent"), - // }, - // { - // ChangeValueAbsolute: to.Ptr[float64](0.701823681806341), - // DimensionName: to.Ptr("QueryDurationDecrease"), - // Unit: to.Ptr("secs"), - // }}, - // ExecuteActionInitiatedBy: to.Ptr(armsql.RecommendedActionInitiatedBySystem), - // ExecuteActionInitiatedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-05-11T15:08:31Z"); return t}()), - // ImplementationDetails: &armsql.RecommendedActionImplementationInfo{ - // Method: to.Ptr(armsql.ImplementationMethodTSQL), - // Script: to.Ptr("ALTER DATABASE [IndexAdvisor_test_3] SET PARAMETERIZATION FORCED"), - // }, - // IsArchivedAction: to.Ptr(false), - // IsExecutableAction: to.Ptr(true), - // IsRevertableAction: to.Ptr(true), - // LastRefresh: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-03-01T14:37:44Z"); return t}()), - // ObservedImpact: []*armsql.RecommendedActionImpactRecord{ - // }, - // RecommendationReason: to.Ptr(""), - // Score: to.Ptr[int32](3), - // State: &armsql.RecommendedActionStateInfo{ - // ActionInitiatedBy: to.Ptr(armsql.RecommendedActionInitiatedBySystem), - // CurrentValue: to.Ptr(armsql.RecommendedActionCurrentStatePending), - // LastModified: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-05-11T15:08:31Z"); return t}()), - // }, - // TimeSeries: []*armsql.RecommendedActionMetricInfo{ - // }, - // ValidSince: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-03-01T14:37:44Z"); return t}()), - // Details: map[string]any{ - // "databaseName": "IndexAdvisor_test_3", - // }, - // }, - // }}, - // }, - // }, - // { - // Name: to.Ptr("SchemaIssue"), - // Type: to.Ptr("Microsoft.Sql/servers/advisors"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/workloadinsight-demos/providers/Microsoft.Sql/servers/misosisvr/advisors/SchemaIssue"), - // Kind: to.Ptr(""), - // Location: to.Ptr("East Asia"), - // Properties: &armsql.AdvisorProperties{ - // AdvisorStatus: to.Ptr(armsql.AdvisorStatusPublicPreview), - // AutoExecuteStatus: to.Ptr(armsql.AutoExecuteStatusDisabled), - // AutoExecuteStatusInheritedFrom: to.Ptr(armsql.AutoExecuteStatusInheritedFromDefault), - // RecommendedActions: []*armsql.RecommendedAction{ - // { - // Name: to.Ptr("SchemaProblem_1A258C5714A7410C9D23"), - // Type: to.Ptr("Microsoft.Sql/servers/advisors/recommendedActions"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/workloadinsight-demos/providers/Microsoft.Sql/servers/misosisvr/advisors/SchemaIssue/recommendedActions/SchemaProblem_1A258C5714A7410C9D23"), - // Kind: to.Ptr(""), - // Location: to.Ptr("East Asia"), - // Properties: &armsql.RecommendedActionProperties{ - // ErrorDetails: &armsql.RecommendedActionErrorInfo{ - // }, - // EstimatedImpact: []*armsql.RecommendedActionImpactRecord{ - // }, - // ImplementationDetails: &armsql.RecommendedActionImplementationInfo{ - // }, - // IsArchivedAction: to.Ptr(false), - // IsExecutableAction: to.Ptr(false), - // IsRevertableAction: to.Ptr(false), - // LastRefresh: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-06-07T22:19:53Z"); return t}()), - // ObservedImpact: []*armsql.RecommendedActionImpactRecord{ - // }, - // RecommendationReason: to.Ptr("SchemaProblem"), - // Score: to.Ptr[int32](3), - // State: &armsql.RecommendedActionStateInfo{ - // CurrentValue: to.Ptr(armsql.RecommendedActionCurrentStateActive), - // LastModified: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-03-01T14:37:48Z"); return t}()), - // }, - // TimeSeries: []*armsql.RecommendedActionMetricInfo{ - // }, - // ValidSince: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-03-01T14:37:48Z"); return t}()), - // Details: map[string]any{ - // "databaseName": "IndexAdvisor_test_3", - // "sqlErrorCount": float64(342482), - // "sqlErrorMessage": "Invalid object name 'dbo.Companies'.", - // "sqlErrorNumber": float64(208), - // }, - // }, - // }}, - // }, - // }, - // { - // Name: to.Ptr("ForceLastGoodPlan"), - // Type: to.Ptr("Microsoft.Sql/servers/advisors"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/workloadinsight-demos/providers/Microsoft.Sql/servers/misosisvr/advisors/ForceLastGoodPlan"), - // Kind: to.Ptr(""), - // Location: to.Ptr("East Asia"), - // Properties: &armsql.AdvisorProperties{ - // AdvisorStatus: to.Ptr(armsql.AdvisorStatusPrivatePreview), - // AutoExecuteStatus: to.Ptr(armsql.AutoExecuteStatusDisabled), - // AutoExecuteStatusInheritedFrom: to.Ptr(armsql.AutoExecuteStatusInheritedFromDefault), - // RecommendedActions: []*armsql.RecommendedAction{ - // }, - // }, - // }} -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerAdvisorGet.json -func ExampleServerAdvisorsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewServerAdvisorsClient().Get(ctx, "workloadinsight-demos", "misosisvr", "CreateIndex", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Advisor = armsql.Advisor{ - // Name: to.Ptr("CreateIndex"), - // Type: to.Ptr("Microsoft.Sql/servers/advisors"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/workloadinsight-demos/providers/Microsoft.Sql/servers/misosisvr/advisors/CreateIndex"), - // Kind: to.Ptr(""), - // Location: to.Ptr("East Asia"), - // Properties: &armsql.AdvisorProperties{ - // AdvisorStatus: to.Ptr(armsql.AdvisorStatusGA), - // AutoExecuteStatus: to.Ptr(armsql.AutoExecuteStatusDisabled), - // AutoExecuteStatusInheritedFrom: to.Ptr(armsql.AutoExecuteStatusInheritedFromDefault), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerAdvisorUpdate.json -func ExampleServerAdvisorsClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewServerAdvisorsClient().Update(ctx, "workloadinsight-demos", "misosisvr", "CreateIndex", armsql.Advisor{ - Properties: &armsql.AdvisorProperties{ - AutoExecuteStatus: to.Ptr(armsql.AutoExecuteStatusDisabled), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Advisor = armsql.Advisor{ - // Name: to.Ptr("CreateIndex"), - // Type: to.Ptr("Microsoft.Sql/servers/advisors"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/workloadinsight-demos/providers/Microsoft.Sql/servers/misosisvr/advisors/CreateIndex"), - // Kind: to.Ptr(""), - // Location: to.Ptr("East Asia"), - // Properties: &armsql.AdvisorProperties{ - // AdvisorStatus: to.Ptr(armsql.AdvisorStatusGA), - // AutoExecuteStatus: to.Ptr(armsql.AutoExecuteStatusDisabled), - // AutoExecuteStatusInheritedFrom: to.Ptr(armsql.AutoExecuteStatusInheritedFromServer), - // }, - // } -} diff --git a/sdk/resourcemanager/sql/armsql/serverautomatictuning_client.go b/sdk/resourcemanager/sql/armsql/serverautomatictuning_client.go index ac52a75bbb06..78e877a25937 100644 --- a/sdk/resourcemanager/sql/armsql/serverautomatictuning_client.go +++ b/sdk/resourcemanager/sql/armsql/serverautomatictuning_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armsql @@ -47,25 +46,28 @@ func NewServerAutomaticTuningClient(subscriptionID string, credential azcore.Tok // Get - Retrieves server automatic tuning options. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. // - options - ServerAutomaticTuningClientGetOptions contains the optional parameters for the ServerAutomaticTuningClient.Get // method. func (client *ServerAutomaticTuningClient) Get(ctx context.Context, resourceGroupName string, serverName string, options *ServerAutomaticTuningClientGetOptions) (ServerAutomaticTuningClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, serverName, options) if err != nil { return ServerAutomaticTuningClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ServerAutomaticTuningClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ServerAutomaticTuningClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ServerAutomaticTuningClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -88,7 +90,7 @@ func (client *ServerAutomaticTuningClient) getCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -106,7 +108,7 @@ func (client *ServerAutomaticTuningClient) getHandleResponse(resp *http.Response // Update - Update automatic tuning options on server. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -114,18 +116,21 @@ func (client *ServerAutomaticTuningClient) getHandleResponse(resp *http.Response // - options - ServerAutomaticTuningClientUpdateOptions contains the optional parameters for the ServerAutomaticTuningClient.Update // method. func (client *ServerAutomaticTuningClient) Update(ctx context.Context, resourceGroupName string, serverName string, parameters ServerAutomaticTuning, options *ServerAutomaticTuningClientUpdateOptions) (ServerAutomaticTuningClientUpdateResponse, error) { + var err error req, err := client.updateCreateRequest(ctx, resourceGroupName, serverName, parameters, options) if err != nil { return ServerAutomaticTuningClientUpdateResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ServerAutomaticTuningClientUpdateResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ServerAutomaticTuningClientUpdateResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ServerAutomaticTuningClientUpdateResponse{}, err } - return client.updateHandleResponse(resp) + resp, err := client.updateHandleResponse(httpResp) + return resp, err } // updateCreateRequest creates the Update request. @@ -148,10 +153,13 @@ func (client *ServerAutomaticTuningClient) updateCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // updateHandleResponse handles the Update response. diff --git a/sdk/resourcemanager/sql/armsql/serverautomatictuning_client_example_test.go b/sdk/resourcemanager/sql/armsql/serverautomatictuning_client_example_test.go deleted file mode 100644 index b94eacfede4b..000000000000 --- a/sdk/resourcemanager/sql/armsql/serverautomatictuning_client_example_test.go +++ /dev/null @@ -1,199 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsql_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sql/armsql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerAutomaticTuningGet.json -func ExampleServerAutomaticTuningClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewServerAutomaticTuningClient().Get(ctx, "default-sql-onebox", "testsvr11", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ServerAutomaticTuning = armsql.ServerAutomaticTuning{ - // Name: to.Ptr("current"), - // Type: to.Ptr("Microsoft.Sql/servers/automaticTuning"), - // ID: to.Ptr("/subscriptions/c3aa9078-0000-0000-0000-e36f151182d7/resourceGroups/default-sql-onebox/providers/Microsoft.Sql/servers/testsvr11/automaticTuning/current"), - // Properties: &armsql.AutomaticTuningServerProperties{ - // ActualState: to.Ptr(armsql.AutomaticTuningServerModeAuto), - // DesiredState: to.Ptr(armsql.AutomaticTuningServerModeAuto), - // Options: map[string]*armsql.AutomaticTuningServerOptions{ - // "createIndex": &armsql.AutomaticTuningServerOptions{ - // ActualState: to.Ptr(armsql.AutomaticTuningOptionModeActualOn), - // DesiredState: to.Ptr(armsql.AutomaticTuningOptionModeDesiredDefault), - // ReasonCode: to.Ptr[int32](2), - // ReasonDesc: to.Ptr(armsql.AutomaticTuningServerReasonAutoConfigured), - // }, - // "dropIndex": &armsql.AutomaticTuningServerOptions{ - // ActualState: to.Ptr(armsql.AutomaticTuningOptionModeActualOff), - // DesiredState: to.Ptr(armsql.AutomaticTuningOptionModeDesiredDefault), - // ReasonCode: to.Ptr[int32](2), - // ReasonDesc: to.Ptr(armsql.AutomaticTuningServerReasonAutoConfigured), - // }, - // "forceLastGoodPlan": &armsql.AutomaticTuningServerOptions{ - // ActualState: to.Ptr(armsql.AutomaticTuningOptionModeActualOn), - // DesiredState: to.Ptr(armsql.AutomaticTuningOptionModeDesiredDefault), - // ReasonCode: to.Ptr[int32](2), - // ReasonDesc: to.Ptr(armsql.AutomaticTuningServerReasonAutoConfigured), - // }, - // "maintainIndex": &armsql.AutomaticTuningServerOptions{ - // ActualState: to.Ptr(armsql.AutomaticTuningOptionModeActualOff), - // DesiredState: to.Ptr(armsql.AutomaticTuningOptionModeDesiredDefault), - // ReasonCode: to.Ptr[int32](2), - // ReasonDesc: to.Ptr(armsql.AutomaticTuningServerReasonAutoConfigured), - // }, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerAutomaticTuningUpdateMax.json -func ExampleServerAutomaticTuningClient_Update_updatesServerAutomaticTuningSettingsWithAllProperties() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewServerAutomaticTuningClient().Update(ctx, "default-sql-onebox", "testsvr11", armsql.ServerAutomaticTuning{ - Properties: &armsql.AutomaticTuningServerProperties{ - DesiredState: to.Ptr(armsql.AutomaticTuningServerModeAuto), - Options: map[string]*armsql.AutomaticTuningServerOptions{ - "createIndex": { - DesiredState: to.Ptr(armsql.AutomaticTuningOptionModeDesiredOff), - }, - "dropIndex": { - DesiredState: to.Ptr(armsql.AutomaticTuningOptionModeDesiredOn), - }, - "forceLastGoodPlan": { - DesiredState: to.Ptr(armsql.AutomaticTuningOptionModeDesiredDefault), - }, - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ServerAutomaticTuning = armsql.ServerAutomaticTuning{ - // Name: to.Ptr("current"), - // Type: to.Ptr("Microsoft.Sql/servers/automaticTuning"), - // ID: to.Ptr("/subscriptions/c3aa9078-0000-0000-0000-e36f151182d7/resourceGroups/default-sql-onebox/providers/Microsoft.Sql/servers/testsvr11/automaticTuning/current"), - // Properties: &armsql.AutomaticTuningServerProperties{ - // ActualState: to.Ptr(armsql.AutomaticTuningServerModeAuto), - // DesiredState: to.Ptr(armsql.AutomaticTuningServerModeAuto), - // Options: map[string]*armsql.AutomaticTuningServerOptions{ - // "createIndex": &armsql.AutomaticTuningServerOptions{ - // ActualState: to.Ptr(armsql.AutomaticTuningOptionModeActualOff), - // DesiredState: to.Ptr(armsql.AutomaticTuningOptionModeDesiredOff), - // }, - // "dropIndex": &armsql.AutomaticTuningServerOptions{ - // ActualState: to.Ptr(armsql.AutomaticTuningOptionModeActualOn), - // DesiredState: to.Ptr(armsql.AutomaticTuningOptionModeDesiredOn), - // }, - // "forceLastGoodPlan": &armsql.AutomaticTuningServerOptions{ - // ActualState: to.Ptr(armsql.AutomaticTuningOptionModeActualOn), - // DesiredState: to.Ptr(armsql.AutomaticTuningOptionModeDesiredDefault), - // ReasonCode: to.Ptr[int32](2), - // ReasonDesc: to.Ptr(armsql.AutomaticTuningServerReasonAutoConfigured), - // }, - // "maintainIndex": &armsql.AutomaticTuningServerOptions{ - // ActualState: to.Ptr(armsql.AutomaticTuningOptionModeActualOff), - // DesiredState: to.Ptr(armsql.AutomaticTuningOptionModeDesiredDefault), - // ReasonCode: to.Ptr[int32](2), - // ReasonDesc: to.Ptr(armsql.AutomaticTuningServerReasonAutoConfigured), - // }, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerAutomaticTuningUpdateMin.json -func ExampleServerAutomaticTuningClient_Update_updatesServerAutomaticTuningSettingsWithMinimalProperties() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewServerAutomaticTuningClient().Update(ctx, "default-sql-onebox", "testsvr11", armsql.ServerAutomaticTuning{ - Properties: &armsql.AutomaticTuningServerProperties{ - DesiredState: to.Ptr(armsql.AutomaticTuningServerModeAuto), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ServerAutomaticTuning = armsql.ServerAutomaticTuning{ - // Name: to.Ptr("current"), - // Type: to.Ptr("Microsoft.Sql/servers/automaticTuning"), - // ID: to.Ptr("/subscriptions/c3aa9078-0000-0000-0000-e36f151182d7/resourceGroups/default-sql-onebox/providers/Microsoft.Sql/servers/testsvr11/automaticTuning/current"), - // Properties: &armsql.AutomaticTuningServerProperties{ - // ActualState: to.Ptr(armsql.AutomaticTuningServerModeAuto), - // DesiredState: to.Ptr(armsql.AutomaticTuningServerModeAuto), - // Options: map[string]*armsql.AutomaticTuningServerOptions{ - // "createIndex": &armsql.AutomaticTuningServerOptions{ - // ActualState: to.Ptr(armsql.AutomaticTuningOptionModeActualOn), - // DesiredState: to.Ptr(armsql.AutomaticTuningOptionModeDesiredDefault), - // ReasonCode: to.Ptr[int32](2), - // ReasonDesc: to.Ptr(armsql.AutomaticTuningServerReasonAutoConfigured), - // }, - // "dropIndex": &armsql.AutomaticTuningServerOptions{ - // ActualState: to.Ptr(armsql.AutomaticTuningOptionModeActualOff), - // DesiredState: to.Ptr(armsql.AutomaticTuningOptionModeDesiredDefault), - // ReasonCode: to.Ptr[int32](2), - // ReasonDesc: to.Ptr(armsql.AutomaticTuningServerReasonAutoConfigured), - // }, - // "forceLastGoodPlan": &armsql.AutomaticTuningServerOptions{ - // ActualState: to.Ptr(armsql.AutomaticTuningOptionModeActualOn), - // DesiredState: to.Ptr(armsql.AutomaticTuningOptionModeDesiredDefault), - // ReasonCode: to.Ptr[int32](2), - // ReasonDesc: to.Ptr(armsql.AutomaticTuningServerReasonAutoConfigured), - // }, - // "maintainIndex": &armsql.AutomaticTuningServerOptions{ - // ActualState: to.Ptr(armsql.AutomaticTuningOptionModeActualOff), - // DesiredState: to.Ptr(armsql.AutomaticTuningOptionModeDesiredDefault), - // ReasonCode: to.Ptr[int32](2), - // ReasonDesc: to.Ptr(armsql.AutomaticTuningServerReasonAutoConfigured), - // }, - // }, - // }, - // } -} diff --git a/sdk/resourcemanager/sql/armsql/serverazureadadministrators_client.go b/sdk/resourcemanager/sql/armsql/serverazureadadministrators_client.go index d5cac06b5b51..252b5a08e6f1 100644 --- a/sdk/resourcemanager/sql/armsql/serverazureadadministrators_client.go +++ b/sdk/resourcemanager/sql/armsql/serverazureadadministrators_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armsql @@ -47,7 +46,7 @@ func NewServerAzureADAdministratorsClient(subscriptionID string, credential azco // BeginCreateOrUpdate - Creates or updates an existing Azure Active Directory administrator. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -61,7 +60,8 @@ func (client *ServerAzureADAdministratorsClient) BeginCreateOrUpdate(ctx context if err != nil { return nil, err } - return runtime.NewPoller[ServerAzureADAdministratorsClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[ServerAzureADAdministratorsClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[ServerAzureADAdministratorsClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -70,20 +70,22 @@ func (client *ServerAzureADAdministratorsClient) BeginCreateOrUpdate(ctx context // CreateOrUpdate - Creates or updates an existing Azure Active Directory administrator. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview func (client *ServerAzureADAdministratorsClient) createOrUpdate(ctx context.Context, resourceGroupName string, serverName string, administratorName AdministratorName, parameters ServerAzureADAdministrator, options *ServerAzureADAdministratorsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, serverName, administratorName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createOrUpdateCreateRequest creates the CreateOrUpdate request. @@ -110,16 +112,19 @@ func (client *ServerAzureADAdministratorsClient) createOrUpdateCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // BeginDelete - Deletes the Azure Active Directory administrator with the given name. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -132,7 +137,8 @@ func (client *ServerAzureADAdministratorsClient) BeginDelete(ctx context.Context if err != nil { return nil, err } - return runtime.NewPoller[ServerAzureADAdministratorsClientDeleteResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[ServerAzureADAdministratorsClientDeleteResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[ServerAzureADAdministratorsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -141,20 +147,22 @@ func (client *ServerAzureADAdministratorsClient) BeginDelete(ctx context.Context // Delete - Deletes the Azure Active Directory administrator with the given name. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview func (client *ServerAzureADAdministratorsClient) deleteOperation(ctx context.Context, resourceGroupName string, serverName string, administratorName AdministratorName, options *ServerAzureADAdministratorsClientBeginDeleteOptions) (*http.Response, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, serverName, administratorName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteCreateRequest creates the Delete request. @@ -181,7 +189,7 @@ func (client *ServerAzureADAdministratorsClient) deleteCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -189,7 +197,7 @@ func (client *ServerAzureADAdministratorsClient) deleteCreateRequest(ctx context // Get - Gets a Azure Active Directory administrator. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -197,18 +205,21 @@ func (client *ServerAzureADAdministratorsClient) deleteCreateRequest(ctx context // - options - ServerAzureADAdministratorsClientGetOptions contains the optional parameters for the ServerAzureADAdministratorsClient.Get // method. func (client *ServerAzureADAdministratorsClient) Get(ctx context.Context, resourceGroupName string, serverName string, administratorName AdministratorName, options *ServerAzureADAdministratorsClientGetOptions) (ServerAzureADAdministratorsClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, serverName, administratorName, options) if err != nil { return ServerAzureADAdministratorsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ServerAzureADAdministratorsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ServerAzureADAdministratorsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ServerAzureADAdministratorsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -235,7 +246,7 @@ func (client *ServerAzureADAdministratorsClient) getCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -252,7 +263,7 @@ func (client *ServerAzureADAdministratorsClient) getHandleResponse(resp *http.Re // NewListByServerPager - Gets a list of Azure Active Directory administrators in a server. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -306,7 +317,7 @@ func (client *ServerAzureADAdministratorsClient) listByServerCreateRequest(ctx c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/sql/armsql/serverazureadadministrators_client_example_test.go b/sdk/resourcemanager/sql/armsql/serverazureadadministrators_client_example_test.go deleted file mode 100644 index d6811f1457c0..000000000000 --- a/sdk/resourcemanager/sql/armsql/serverazureadadministrators_client_example_test.go +++ /dev/null @@ -1,155 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsql_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sql/armsql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/AdministratorGet.json -func ExampleServerAzureADAdministratorsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewServerAzureADAdministratorsClient().Get(ctx, "sqlcrudtest-4799", "sqlcrudtest-6440", armsql.AdministratorNameActiveDirectory, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ServerAzureADAdministrator = armsql.ServerAzureADAdministrator{ - // Name: to.Ptr("ActiveDirectory"), - // Type: to.Ptr("Microsoft.Sql/servers/administrators"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/sqlcrudtest-4799/providers/Microsoft.Sql/servers/sqlcrudtest-6440/administrators/ActiveDirectory"), - // Properties: &armsql.AdministratorProperties{ - // AdministratorType: to.Ptr(armsql.AdministratorTypeActiveDirectory), - // AzureADOnlyAuthentication: to.Ptr(true), - // Login: to.Ptr("bob@contoso.com"), - // Sid: to.Ptr("c6b82b90-a647-49cb-8a62-0d2d3cb7ac7c"), - // TenantID: to.Ptr("c6b82b90-a647-49cb-8a62-0d2d3cb7ac7c"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/AdministratorCreateOrUpdate.json -func ExampleServerAzureADAdministratorsClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewServerAzureADAdministratorsClient().BeginCreateOrUpdate(ctx, "sqlcrudtest-4799", "sqlcrudtest-6440", armsql.AdministratorNameActiveDirectory, armsql.ServerAzureADAdministrator{ - Properties: &armsql.AdministratorProperties{ - AdministratorType: to.Ptr(armsql.AdministratorTypeActiveDirectory), - Login: to.Ptr("bob@contoso.com"), - Sid: to.Ptr("c6b82b90-a647-49cb-8a62-0d2d3cb7ac7c"), - TenantID: to.Ptr("c6b82b90-a647-49cb-8a62-0d2d3cb7ac7c"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ServerAzureADAdministrator = armsql.ServerAzureADAdministrator{ - // Name: to.Ptr("ActiveDirectory"), - // Type: to.Ptr("Microsoft.Sql/servers/administrators"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/sqlcrudtest-4799/providers/Microsoft.Sql/servers/sqlcrudtest-6440/administrators/ActiveDirectory"), - // Properties: &armsql.AdministratorProperties{ - // AdministratorType: to.Ptr(armsql.AdministratorTypeActiveDirectory), - // AzureADOnlyAuthentication: to.Ptr(true), - // Login: to.Ptr("bob@contoso.com"), - // Sid: to.Ptr("c6b82b90-a647-49cb-8a62-0d2d3cb7ac7c"), - // TenantID: to.Ptr("c6b82b90-a647-49cb-8a62-0d2d3cb7ac7c"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/AdministratorDelete.json -func ExampleServerAzureADAdministratorsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewServerAzureADAdministratorsClient().BeginDelete(ctx, "sqlcrudtest-4799", "sqlcrudtest-6440", armsql.AdministratorNameActiveDirectory, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/AdministratorList.json -func ExampleServerAzureADAdministratorsClient_NewListByServerPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewServerAzureADAdministratorsClient().NewListByServerPager("sqlcrudtest-4799", "sqlcrudtest-6440", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.AdministratorListResult = armsql.AdministratorListResult{ - // Value: []*armsql.ServerAzureADAdministrator{ - // { - // Name: to.Ptr("ActiveDirectory"), - // Type: to.Ptr("Microsoft.Sql/servers/administrators"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/sqlcrudtest-4799/providers/Microsoft.Sql/servers/sqlcrudtest-6440/administrators/ActiveDirectory"), - // Properties: &armsql.AdministratorProperties{ - // AdministratorType: to.Ptr(armsql.AdministratorTypeActiveDirectory), - // AzureADOnlyAuthentication: to.Ptr(true), - // Login: to.Ptr("bob@contoso.com"), - // Sid: to.Ptr("c6b82b90-a647-49cb-8a62-0d2d3cb7ac7c"), - // TenantID: to.Ptr("c6b82b90-a647-49cb-8a62-0d2d3cb7ac7c"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/sql/armsql/serverazureadonlyauthentications_client.go b/sdk/resourcemanager/sql/armsql/serverazureadonlyauthentications_client.go index c0df84cfa40e..5b6f06ac195e 100644 --- a/sdk/resourcemanager/sql/armsql/serverazureadonlyauthentications_client.go +++ b/sdk/resourcemanager/sql/armsql/serverazureadonlyauthentications_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armsql @@ -48,7 +47,7 @@ func NewServerAzureADOnlyAuthenticationsClient(subscriptionID string, credential // only authentication property. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -62,7 +61,8 @@ func (client *ServerAzureADOnlyAuthenticationsClient) BeginCreateOrUpdate(ctx co if err != nil { return nil, err } - return runtime.NewPoller[ServerAzureADOnlyAuthenticationsClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[ServerAzureADOnlyAuthenticationsClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[ServerAzureADOnlyAuthenticationsClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -72,20 +72,22 @@ func (client *ServerAzureADOnlyAuthenticationsClient) BeginCreateOrUpdate(ctx co // only authentication property. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview func (client *ServerAzureADOnlyAuthenticationsClient) createOrUpdate(ctx context.Context, resourceGroupName string, serverName string, authenticationName AuthenticationName, parameters ServerAzureADOnlyAuthentication, options *ServerAzureADOnlyAuthenticationsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, serverName, authenticationName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createOrUpdateCreateRequest creates the CreateOrUpdate request. @@ -112,16 +114,19 @@ func (client *ServerAzureADOnlyAuthenticationsClient) createOrUpdateCreateReques return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // BeginDelete - Deletes an existing server Active Directory only authentication property. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -134,7 +139,8 @@ func (client *ServerAzureADOnlyAuthenticationsClient) BeginDelete(ctx context.Co if err != nil { return nil, err } - return runtime.NewPoller[ServerAzureADOnlyAuthenticationsClientDeleteResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[ServerAzureADOnlyAuthenticationsClientDeleteResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[ServerAzureADOnlyAuthenticationsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -143,20 +149,22 @@ func (client *ServerAzureADOnlyAuthenticationsClient) BeginDelete(ctx context.Co // Delete - Deletes an existing server Active Directory only authentication property. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview func (client *ServerAzureADOnlyAuthenticationsClient) deleteOperation(ctx context.Context, resourceGroupName string, serverName string, authenticationName AuthenticationName, options *ServerAzureADOnlyAuthenticationsClientBeginDeleteOptions) (*http.Response, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, serverName, authenticationName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteCreateRequest creates the Delete request. @@ -183,7 +191,7 @@ func (client *ServerAzureADOnlyAuthenticationsClient) deleteCreateRequest(ctx co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -191,7 +199,7 @@ func (client *ServerAzureADOnlyAuthenticationsClient) deleteCreateRequest(ctx co // Get - Gets a specific Azure Active Directory only authentication property. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -199,18 +207,21 @@ func (client *ServerAzureADOnlyAuthenticationsClient) deleteCreateRequest(ctx co // - options - ServerAzureADOnlyAuthenticationsClientGetOptions contains the optional parameters for the ServerAzureADOnlyAuthenticationsClient.Get // method. func (client *ServerAzureADOnlyAuthenticationsClient) Get(ctx context.Context, resourceGroupName string, serverName string, authenticationName AuthenticationName, options *ServerAzureADOnlyAuthenticationsClientGetOptions) (ServerAzureADOnlyAuthenticationsClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, serverName, authenticationName, options) if err != nil { return ServerAzureADOnlyAuthenticationsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ServerAzureADOnlyAuthenticationsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ServerAzureADOnlyAuthenticationsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ServerAzureADOnlyAuthenticationsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -237,7 +248,7 @@ func (client *ServerAzureADOnlyAuthenticationsClient) getCreateRequest(ctx conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -254,7 +265,7 @@ func (client *ServerAzureADOnlyAuthenticationsClient) getHandleResponse(resp *ht // NewListByServerPager - Gets a list of server Azure Active Directory only authentications. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -308,7 +319,7 @@ func (client *ServerAzureADOnlyAuthenticationsClient) listByServerCreateRequest( return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/sql/armsql/serverazureadonlyauthentications_client_example_test.go b/sdk/resourcemanager/sql/armsql/serverazureadonlyauthentications_client_example_test.go deleted file mode 100644 index 68a9b1af8db0..000000000000 --- a/sdk/resourcemanager/sql/armsql/serverazureadonlyauthentications_client_example_test.go +++ /dev/null @@ -1,140 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsql_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sql/armsql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/AzureADOnlyAuthGet.json -func ExampleServerAzureADOnlyAuthenticationsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewServerAzureADOnlyAuthenticationsClient().Get(ctx, "sqlcrudtest-4799", "sqlcrudtest-6440", armsql.AuthenticationNameDefault, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ServerAzureADOnlyAuthentication = armsql.ServerAzureADOnlyAuthentication{ - // Name: to.Ptr("Default"), - // Type: to.Ptr("Microsoft.Sql/servers/azureadonlyauthentications"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/sqlcrudtest-4799/providers/Microsoft.Sql/servers/sqlcrudtest-6440/azureadonlyauthentications/default"), - // Properties: &armsql.AzureADOnlyAuthProperties{ - // AzureADOnlyAuthentication: to.Ptr(true), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/AzureADOnlyAuthCreateOrUpdate.json -func ExampleServerAzureADOnlyAuthenticationsClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewServerAzureADOnlyAuthenticationsClient().BeginCreateOrUpdate(ctx, "sqlcrudtest-4799", "sqlcrudtest-6440", armsql.AuthenticationNameDefault, armsql.ServerAzureADOnlyAuthentication{ - Properties: &armsql.AzureADOnlyAuthProperties{ - AzureADOnlyAuthentication: to.Ptr(false), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ServerAzureADOnlyAuthentication = armsql.ServerAzureADOnlyAuthentication{ - // Name: to.Ptr("Default"), - // Type: to.Ptr("Microsoft.Sql/servers/azureadonlyauthentications"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/sqlcrudtest-4799/providers/Microsoft.Sql/servers/sqlcrudtest-6440/azureadonlyauthentications/default"), - // Properties: &armsql.AzureADOnlyAuthProperties{ - // AzureADOnlyAuthentication: to.Ptr(false), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/AzureADOnlyAuthDelete.json -func ExampleServerAzureADOnlyAuthenticationsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewServerAzureADOnlyAuthenticationsClient().BeginDelete(ctx, "sqlcrudtest-4799", "sqlcrudtest-6440", armsql.AuthenticationNameDefault, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/AzureADOnlyAuthList.json -func ExampleServerAzureADOnlyAuthenticationsClient_NewListByServerPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewServerAzureADOnlyAuthenticationsClient().NewListByServerPager("sqlcrudtest-4799", "sqlcrudtest-6440", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.AzureADOnlyAuthListResult = armsql.AzureADOnlyAuthListResult{ - // Value: []*armsql.ServerAzureADOnlyAuthentication{ - // { - // Name: to.Ptr("Default"), - // Type: to.Ptr("Microsoft.Sql/servers/azureadonlyauthentications"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/sqlcrudtest-4799/providers/Microsoft.Sql/servers/sqlcrudtest-6440/azureadonlyauthentications/default"), - // Properties: &armsql.AzureADOnlyAuthProperties{ - // AzureADOnlyAuthentication: to.Ptr(true), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/sql/armsql/serverblobauditingpolicies_client.go b/sdk/resourcemanager/sql/armsql/serverblobauditingpolicies_client.go index cbbe9fc58537..f8a3983b1878 100644 --- a/sdk/resourcemanager/sql/armsql/serverblobauditingpolicies_client.go +++ b/sdk/resourcemanager/sql/armsql/serverblobauditingpolicies_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armsql @@ -47,7 +46,7 @@ func NewServerBlobAuditingPoliciesClient(subscriptionID string, credential azcor // BeginCreateOrUpdate - Creates or updates a server's blob auditing policy. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -60,7 +59,8 @@ func (client *ServerBlobAuditingPoliciesClient) BeginCreateOrUpdate(ctx context. if err != nil { return nil, err } - return runtime.NewPoller[ServerBlobAuditingPoliciesClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[ServerBlobAuditingPoliciesClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[ServerBlobAuditingPoliciesClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -69,20 +69,22 @@ func (client *ServerBlobAuditingPoliciesClient) BeginCreateOrUpdate(ctx context. // CreateOrUpdate - Creates or updates a server's blob auditing policy. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-11-01-preview +// Generated from API version 2022-11-01-preview func (client *ServerBlobAuditingPoliciesClient) createOrUpdate(ctx context.Context, resourceGroupName string, serverName string, parameters ServerBlobAuditingPolicy, options *ServerBlobAuditingPoliciesClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, serverName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createOrUpdateCreateRequest creates the CreateOrUpdate request. @@ -106,34 +108,40 @@ func (client *ServerBlobAuditingPoliciesClient) createOrUpdateCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // Get - Gets a server's blob auditing policy. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. // - options - ServerBlobAuditingPoliciesClientGetOptions contains the optional parameters for the ServerBlobAuditingPoliciesClient.Get // method. func (client *ServerBlobAuditingPoliciesClient) Get(ctx context.Context, resourceGroupName string, serverName string, options *ServerBlobAuditingPoliciesClientGetOptions) (ServerBlobAuditingPoliciesClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, serverName, options) if err != nil { return ServerBlobAuditingPoliciesClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ServerBlobAuditingPoliciesClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ServerBlobAuditingPoliciesClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ServerBlobAuditingPoliciesClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -157,7 +165,7 @@ func (client *ServerBlobAuditingPoliciesClient) getCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -174,7 +182,7 @@ func (client *ServerBlobAuditingPoliciesClient) getHandleResponse(resp *http.Res // NewListByServerPager - Lists auditing settings of a server. // -// Generated from API version 2021-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -228,7 +236,7 @@ func (client *ServerBlobAuditingPoliciesClient) listByServerCreateRequest(ctx co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/sql/armsql/serverblobauditingpolicies_client_example_test.go b/sdk/resourcemanager/sql/armsql/serverblobauditingpolicies_client_example_test.go deleted file mode 100644 index 52cae9c8122e..000000000000 --- a/sdk/resourcemanager/sql/armsql/serverblobauditingpolicies_client_example_test.go +++ /dev/null @@ -1,202 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsql_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sql/armsql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/ServerAuditingSettingsList.json -func ExampleServerBlobAuditingPoliciesClient_NewListByServerPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewServerBlobAuditingPoliciesClient().NewListByServerPager("blobauditingtest-4799", "blobauditingtest-6440", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ServerBlobAuditingPolicyListResult = armsql.ServerBlobAuditingPolicyListResult{ - // Value: []*armsql.ServerBlobAuditingPolicy{ - // { - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.Sql/servers/auditingSettings"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/blobauditingtest-6852/providers/Microsoft.Sql/servers/blobauditingtest-2080/auditingSettings/default"), - // Properties: &armsql.ServerBlobAuditingPolicyProperties{ - // AuditActionsAndGroups: []*string{ - // }, - // IsAzureMonitorTargetEnabled: to.Ptr(false), - // IsManagedIdentityInUse: to.Ptr(false), - // IsStorageSecondaryKeyInUse: to.Ptr(false), - // RetentionDays: to.Ptr[int32](0), - // State: to.Ptr(armsql.BlobAuditingPolicyStateDisabled), - // StorageAccountSubscriptionID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // StorageEndpoint: to.Ptr(""), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/ServerBlobAuditingGet.json -func ExampleServerBlobAuditingPoliciesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewServerBlobAuditingPoliciesClient().Get(ctx, "blobauditingtest-4799", "blobauditingtest-6440", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ServerBlobAuditingPolicy = armsql.ServerBlobAuditingPolicy{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.Sql/servers/auditingSettings"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/blobauditingtest-6852/providers/Microsoft.Sql/servers/blobauditingtest-2080/auditingSettings/default"), - // Properties: &armsql.ServerBlobAuditingPolicyProperties{ - // AuditActionsAndGroups: []*string{ - // }, - // IsAzureMonitorTargetEnabled: to.Ptr(false), - // IsManagedIdentityInUse: to.Ptr(false), - // IsStorageSecondaryKeyInUse: to.Ptr(false), - // RetentionDays: to.Ptr[int32](0), - // State: to.Ptr(armsql.BlobAuditingPolicyStateDisabled), - // StorageAccountSubscriptionID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // StorageEndpoint: to.Ptr(""), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/ServerBlobAuditingCreateMax.json -func ExampleServerBlobAuditingPoliciesClient_BeginCreateOrUpdate_updateAServersBlobAuditingPolicyWithAllParameters() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewServerBlobAuditingPoliciesClient().BeginCreateOrUpdate(ctx, "blobauditingtest-4799", "blobauditingtest-6440", armsql.ServerBlobAuditingPolicy{ - Properties: &armsql.ServerBlobAuditingPolicyProperties{ - AuditActionsAndGroups: []*string{ - to.Ptr("SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP"), - to.Ptr("FAILED_DATABASE_AUTHENTICATION_GROUP"), - to.Ptr("BATCH_COMPLETED_GROUP")}, - IsAzureMonitorTargetEnabled: to.Ptr(true), - IsStorageSecondaryKeyInUse: to.Ptr(false), - QueueDelayMs: to.Ptr[int32](4000), - RetentionDays: to.Ptr[int32](6), - State: to.Ptr(armsql.BlobAuditingPolicyStateEnabled), - StorageAccountAccessKey: to.Ptr("sdlfkjabc+sdlfkjsdlkfsjdfLDKFTERLKFDFKLjsdfksjdflsdkfD2342309432849328476458/3RSD=="), - StorageAccountSubscriptionID: to.Ptr("00000000-1234-0000-5678-000000000000"), - StorageEndpoint: to.Ptr("https://mystorage.blob.core.windows.net"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ServerBlobAuditingPolicy = armsql.ServerBlobAuditingPolicy{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.Sql/servers/auditingSettings"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/blobauditingtest-4799/providers/Microsoft.Sql/servers/blobauditingtest-6440/auditingSettings/default"), - // Properties: &armsql.ServerBlobAuditingPolicyProperties{ - // AuditActionsAndGroups: []*string{ - // to.Ptr("SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP"), - // to.Ptr("FAILED_DATABASE_AUTHENTICATION_GROUP"), - // to.Ptr("BATCH_COMPLETED_GROUP")}, - // IsAzureMonitorTargetEnabled: to.Ptr(true), - // IsStorageSecondaryKeyInUse: to.Ptr(false), - // QueueDelayMs: to.Ptr[int32](4000), - // RetentionDays: to.Ptr[int32](6), - // State: to.Ptr(armsql.BlobAuditingPolicyStateEnabled), - // StorageAccountSubscriptionID: to.Ptr("00000000-1234-0000-5678-000000000000"), - // StorageEndpoint: to.Ptr("https://mystorage.blob.core.windows.net"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/ServerBlobAuditingCreateMin.json -func ExampleServerBlobAuditingPoliciesClient_BeginCreateOrUpdate_updateAServersBlobAuditingPolicyWithMinimalParameters() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewServerBlobAuditingPoliciesClient().BeginCreateOrUpdate(ctx, "blobauditingtest-4799", "blobauditingtest-6440", armsql.ServerBlobAuditingPolicy{ - Properties: &armsql.ServerBlobAuditingPolicyProperties{ - State: to.Ptr(armsql.BlobAuditingPolicyStateEnabled), - StorageAccountAccessKey: to.Ptr("sdlfkjabc+sdlfkjsdlkfsjdfLDKFTERLKFDFKLjsdfksjdflsdkfD2342309432849328476458/3RSD=="), - StorageEndpoint: to.Ptr("https://mystorage.blob.core.windows.net"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ServerBlobAuditingPolicy = armsql.ServerBlobAuditingPolicy{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.Sql/servers/auditingSettings"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/blobauditingtest-4799/providers/Microsoft.Sql/servers/blobauditingtest-6440/auditingSettings/default"), - // Properties: &armsql.ServerBlobAuditingPolicyProperties{ - // AuditActionsAndGroups: []*string{ - // to.Ptr("SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP"), - // to.Ptr("FAILED_DATABASE_AUTHENTICATION_GROUP"), - // to.Ptr("BATCH_COMPLETED_GROUP")}, - // IsStorageSecondaryKeyInUse: to.Ptr(false), - // RetentionDays: to.Ptr[int32](6), - // State: to.Ptr(armsql.BlobAuditingPolicyStateEnabled), - // StorageAccountSubscriptionID: to.Ptr("00000000-1234-0000-5678-000000000000"), - // StorageEndpoint: to.Ptr("https://mystorage.blob.core.windows.net"), - // }, - // } -} diff --git a/sdk/resourcemanager/sql/armsql/servercommunicationlinks_client.go b/sdk/resourcemanager/sql/armsql/servercommunicationlinks_client.go deleted file mode 100644 index d6d8f71b1c0a..000000000000 --- a/sdk/resourcemanager/sql/armsql/servercommunicationlinks_client.go +++ /dev/null @@ -1,300 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsql - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "net/url" - "strings" -) - -// ServerCommunicationLinksClient contains the methods for the ServerCommunicationLinks group. -// Don't use this type directly, use NewServerCommunicationLinksClient() instead. -type ServerCommunicationLinksClient struct { - internal *arm.Client - subscriptionID string -} - -// NewServerCommunicationLinksClient creates a new instance of ServerCommunicationLinksClient with the specified values. -// - subscriptionID - The subscription ID that identifies an Azure subscription. -// - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. -func NewServerCommunicationLinksClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ServerCommunicationLinksClient, error) { - cl, err := arm.NewClient(moduleName+".ServerCommunicationLinksClient", moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &ServerCommunicationLinksClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// BeginCreateOrUpdate - Creates a server communication link. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2014-04-01 -// - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure -// Resource Manager API or the portal. -// - serverName - The name of the server. -// - communicationLinkName - The name of the server communication link. -// - parameters - The required parameters for creating a server communication link. -// - options - ServerCommunicationLinksClientBeginCreateOrUpdateOptions contains the optional parameters for the ServerCommunicationLinksClient.BeginCreateOrUpdate -// method. -func (client *ServerCommunicationLinksClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, communicationLinkName string, parameters ServerCommunicationLink, options *ServerCommunicationLinksClientBeginCreateOrUpdateOptions) (*runtime.Poller[ServerCommunicationLinksClientCreateOrUpdateResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.createOrUpdate(ctx, resourceGroupName, serverName, communicationLinkName, parameters, options) - if err != nil { - return nil, err - } - return runtime.NewPoller[ServerCommunicationLinksClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) - } else { - return runtime.NewPollerFromResumeToken[ServerCommunicationLinksClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) - } -} - -// CreateOrUpdate - Creates a server communication link. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2014-04-01 -func (client *ServerCommunicationLinksClient) createOrUpdate(ctx context.Context, resourceGroupName string, serverName string, communicationLinkName string, parameters ServerCommunicationLink, options *ServerCommunicationLinksClientBeginCreateOrUpdateOptions) (*http.Response, error) { - req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, serverName, communicationLinkName, parameters, options) - if err != nil { - return nil, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return nil, err - } - if !runtime.HasStatusCode(resp, http.StatusCreated, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) - } - return resp, nil -} - -// createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *ServerCommunicationLinksClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, serverName string, communicationLinkName string, parameters ServerCommunicationLink, options *ServerCommunicationLinksClientBeginCreateOrUpdateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/communicationLinks/{communicationLinkName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if serverName == "" { - return nil, errors.New("parameter serverName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{serverName}", url.PathEscape(serverName)) - if communicationLinkName == "" { - return nil, errors.New("parameter communicationLinkName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{communicationLinkName}", url.PathEscape(communicationLinkName)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2014-04-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) -} - -// Delete - Deletes a server communication link. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2014-04-01 -// - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure -// Resource Manager API or the portal. -// - serverName - The name of the server. -// - communicationLinkName - The name of the server communication link. -// - options - ServerCommunicationLinksClientDeleteOptions contains the optional parameters for the ServerCommunicationLinksClient.Delete -// method. -func (client *ServerCommunicationLinksClient) Delete(ctx context.Context, resourceGroupName string, serverName string, communicationLinkName string, options *ServerCommunicationLinksClientDeleteOptions) (ServerCommunicationLinksClientDeleteResponse, error) { - req, err := client.deleteCreateRequest(ctx, resourceGroupName, serverName, communicationLinkName, options) - if err != nil { - return ServerCommunicationLinksClientDeleteResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ServerCommunicationLinksClientDeleteResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ServerCommunicationLinksClientDeleteResponse{}, runtime.NewResponseError(resp) - } - return ServerCommunicationLinksClientDeleteResponse{}, nil -} - -// deleteCreateRequest creates the Delete request. -func (client *ServerCommunicationLinksClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, serverName string, communicationLinkName string, options *ServerCommunicationLinksClientDeleteOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/communicationLinks/{communicationLinkName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if serverName == "" { - return nil, errors.New("parameter serverName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{serverName}", url.PathEscape(serverName)) - if communicationLinkName == "" { - return nil, errors.New("parameter communicationLinkName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{communicationLinkName}", url.PathEscape(communicationLinkName)) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2014-04-01") - req.Raw().URL.RawQuery = reqQP.Encode() - return req, nil -} - -// Get - Returns a server communication link. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2014-04-01 -// - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure -// Resource Manager API or the portal. -// - serverName - The name of the server. -// - communicationLinkName - The name of the server communication link. -// - options - ServerCommunicationLinksClientGetOptions contains the optional parameters for the ServerCommunicationLinksClient.Get -// method. -func (client *ServerCommunicationLinksClient) Get(ctx context.Context, resourceGroupName string, serverName string, communicationLinkName string, options *ServerCommunicationLinksClientGetOptions) (ServerCommunicationLinksClientGetResponse, error) { - req, err := client.getCreateRequest(ctx, resourceGroupName, serverName, communicationLinkName, options) - if err != nil { - return ServerCommunicationLinksClientGetResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ServerCommunicationLinksClientGetResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ServerCommunicationLinksClientGetResponse{}, runtime.NewResponseError(resp) - } - return client.getHandleResponse(resp) -} - -// getCreateRequest creates the Get request. -func (client *ServerCommunicationLinksClient) getCreateRequest(ctx context.Context, resourceGroupName string, serverName string, communicationLinkName string, options *ServerCommunicationLinksClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/communicationLinks/{communicationLinkName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if serverName == "" { - return nil, errors.New("parameter serverName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{serverName}", url.PathEscape(serverName)) - if communicationLinkName == "" { - return nil, errors.New("parameter communicationLinkName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{communicationLinkName}", url.PathEscape(communicationLinkName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2014-04-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *ServerCommunicationLinksClient) getHandleResponse(resp *http.Response) (ServerCommunicationLinksClientGetResponse, error) { - result := ServerCommunicationLinksClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.ServerCommunicationLink); err != nil { - return ServerCommunicationLinksClientGetResponse{}, err - } - return result, nil -} - -// NewListByServerPager - Gets a list of server communication links. -// -// Generated from API version 2014-04-01 -// - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure -// Resource Manager API or the portal. -// - serverName - The name of the server. -// - options - ServerCommunicationLinksClientListByServerOptions contains the optional parameters for the ServerCommunicationLinksClient.NewListByServerPager -// method. -func (client *ServerCommunicationLinksClient) NewListByServerPager(resourceGroupName string, serverName string, options *ServerCommunicationLinksClientListByServerOptions) *runtime.Pager[ServerCommunicationLinksClientListByServerResponse] { - return runtime.NewPager(runtime.PagingHandler[ServerCommunicationLinksClientListByServerResponse]{ - More: func(page ServerCommunicationLinksClientListByServerResponse) bool { - return false - }, - Fetcher: func(ctx context.Context, page *ServerCommunicationLinksClientListByServerResponse) (ServerCommunicationLinksClientListByServerResponse, error) { - req, err := client.listByServerCreateRequest(ctx, resourceGroupName, serverName, options) - if err != nil { - return ServerCommunicationLinksClientListByServerResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ServerCommunicationLinksClientListByServerResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ServerCommunicationLinksClientListByServerResponse{}, runtime.NewResponseError(resp) - } - return client.listByServerHandleResponse(resp) - }, - }) -} - -// listByServerCreateRequest creates the ListByServer request. -func (client *ServerCommunicationLinksClient) listByServerCreateRequest(ctx context.Context, resourceGroupName string, serverName string, options *ServerCommunicationLinksClientListByServerOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/communicationLinks" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if serverName == "" { - return nil, errors.New("parameter serverName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{serverName}", url.PathEscape(serverName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2014-04-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listByServerHandleResponse handles the ListByServer response. -func (client *ServerCommunicationLinksClient) listByServerHandleResponse(resp *http.Response) (ServerCommunicationLinksClientListByServerResponse, error) { - result := ServerCommunicationLinksClientListByServerResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.ServerCommunicationLinkListResult); err != nil { - return ServerCommunicationLinksClientListByServerResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/sql/armsql/servercommunicationlinks_client_example_test.go b/sdk/resourcemanager/sql/armsql/servercommunicationlinks_client_example_test.go deleted file mode 100644 index 49da5629c6ff..000000000000 --- a/sdk/resourcemanager/sql/armsql/servercommunicationlinks_client_example_test.go +++ /dev/null @@ -1,129 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsql_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sql/armsql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/stable/2014-04-01/examples/ServerCommunicationLinkDelete.json -func ExampleServerCommunicationLinksClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewServerCommunicationLinksClient().Delete(ctx, "sqlcrudtest-7398", "sqlcrudtest-4645", "link1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/stable/2014-04-01/examples/ServerCommunicationLinkGet.json -func ExampleServerCommunicationLinksClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewServerCommunicationLinksClient().Get(ctx, "sqlcrudtest-7398", "sqlcrudtest-4645", "link1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ServerCommunicationLink = armsql.ServerCommunicationLink{ - // Name: to.Ptr("link1"), - // Type: to.Ptr("Microsoft.Sql/servers/communicationLinks"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/sqlcrudtest-7398/providers/Microsoft.Sql/servers/sqlcrudtest-4645/communicationLinks/link1"), - // Location: to.Ptr("Central US"), - // Properties: &armsql.ServerCommunicationLinkProperties{ - // PartnerServer: to.Ptr("sqlcrudtest-test"), - // State: to.Ptr("Ready"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/stable/2014-04-01/examples/ServerCommunicationLinkCreateOrUpdate.json -func ExampleServerCommunicationLinksClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewServerCommunicationLinksClient().BeginCreateOrUpdate(ctx, "sqlcrudtest-7398", "sqlcrudtest-4645", "link1", armsql.ServerCommunicationLink{ - Properties: &armsql.ServerCommunicationLinkProperties{ - PartnerServer: to.Ptr("sqldcrudtest-test"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/stable/2014-04-01/examples/ServerCommunicationLinkList.json -func ExampleServerCommunicationLinksClient_NewListByServerPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewServerCommunicationLinksClient().NewListByServerPager("sqlcrudtest-7398", "sqlcrudtest-4645", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ServerCommunicationLinkListResult = armsql.ServerCommunicationLinkListResult{ - // Value: []*armsql.ServerCommunicationLink{ - // { - // Name: to.Ptr("link1"), - // Type: to.Ptr("Microsoft.Sql/servers/communicationLinks"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/sqlcrudtest-7398/providers/Microsoft.Sql/servers/sqlcrudtest-4645/communicationLinks/link1"), - // Location: to.Ptr("Central US"), - // Properties: &armsql.ServerCommunicationLinkProperties{ - // PartnerServer: to.Ptr("sqlcrudtest-test"), - // State: to.Ptr("Ready"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/sql/armsql/serverconfigurationoptions_client.go b/sdk/resourcemanager/sql/armsql/serverconfigurationoptions_client.go new file mode 100644 index 000000000000..6fef0b619c42 --- /dev/null +++ b/sdk/resourcemanager/sql/armsql/serverconfigurationoptions_client.go @@ -0,0 +1,260 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armsql + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// ServerConfigurationOptionsClient contains the methods for the ServerConfigurationOptions group. +// Don't use this type directly, use NewServerConfigurationOptionsClient() instead. +type ServerConfigurationOptionsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewServerConfigurationOptionsClient creates a new instance of ServerConfigurationOptionsClient with the specified values. +// - subscriptionID - The subscription ID that identifies an Azure subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewServerConfigurationOptionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ServerConfigurationOptionsClient, error) { + cl, err := arm.NewClient(moduleName+".ServerConfigurationOptionsClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ServerConfigurationOptionsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreateOrUpdate - Updates managed instance server configuration option. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-11-01-preview +// - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure +// Resource Manager API or the portal. +// - managedInstanceName - The name of the managed instance. +// - serverConfigurationOptionName - The name of the server configuration option. +// - parameters - Server configuration option parameters. +// - options - ServerConfigurationOptionsClientBeginCreateOrUpdateOptions contains the optional parameters for the ServerConfigurationOptionsClient.BeginCreateOrUpdate +// method. +func (client *ServerConfigurationOptionsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, managedInstanceName string, serverConfigurationOptionName ServerConfigurationOptionName, parameters ServerConfigurationOption, options *ServerConfigurationOptionsClientBeginCreateOrUpdateOptions) (*runtime.Poller[ServerConfigurationOptionsClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, managedInstanceName, serverConfigurationOptionName, parameters, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller[ServerConfigurationOptionsClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[ServerConfigurationOptionsClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// CreateOrUpdate - Updates managed instance server configuration option. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-11-01-preview +func (client *ServerConfigurationOptionsClient) createOrUpdate(ctx context.Context, resourceGroupName string, managedInstanceName string, serverConfigurationOptionName ServerConfigurationOptionName, parameters ServerConfigurationOption, options *ServerConfigurationOptionsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, managedInstanceName, serverConfigurationOptionName, parameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *ServerConfigurationOptionsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, managedInstanceName string, serverConfigurationOptionName ServerConfigurationOptionName, parameters ServerConfigurationOption, options *ServerConfigurationOptionsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/serverConfigurationOptions/{serverConfigurationOptionName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if managedInstanceName == "" { + return nil, errors.New("parameter managedInstanceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{managedInstanceName}", url.PathEscape(managedInstanceName)) + if serverConfigurationOptionName == "" { + return nil, errors.New("parameter serverConfigurationOptionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serverConfigurationOptionName}", url.PathEscape(string(serverConfigurationOptionName))) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// Get - Gets managed instance server configuration option. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-11-01-preview +// - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure +// Resource Manager API or the portal. +// - managedInstanceName - The name of the managed instance. +// - serverConfigurationOptionName - The name of the server configuration option. +// - options - ServerConfigurationOptionsClientGetOptions contains the optional parameters for the ServerConfigurationOptionsClient.Get +// method. +func (client *ServerConfigurationOptionsClient) Get(ctx context.Context, resourceGroupName string, managedInstanceName string, serverConfigurationOptionName ServerConfigurationOptionName, options *ServerConfigurationOptionsClientGetOptions) (ServerConfigurationOptionsClientGetResponse, error) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, managedInstanceName, serverConfigurationOptionName, options) + if err != nil { + return ServerConfigurationOptionsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ServerConfigurationOptionsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ServerConfigurationOptionsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *ServerConfigurationOptionsClient) getCreateRequest(ctx context.Context, resourceGroupName string, managedInstanceName string, serverConfigurationOptionName ServerConfigurationOptionName, options *ServerConfigurationOptionsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/serverConfigurationOptions/{serverConfigurationOptionName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if managedInstanceName == "" { + return nil, errors.New("parameter managedInstanceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{managedInstanceName}", url.PathEscape(managedInstanceName)) + if serverConfigurationOptionName == "" { + return nil, errors.New("parameter serverConfigurationOptionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serverConfigurationOptionName}", url.PathEscape(string(serverConfigurationOptionName))) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *ServerConfigurationOptionsClient) getHandleResponse(resp *http.Response) (ServerConfigurationOptionsClientGetResponse, error) { + result := ServerConfigurationOptionsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ServerConfigurationOption); err != nil { + return ServerConfigurationOptionsClientGetResponse{}, err + } + return result, nil +} + +// NewListByManagedInstancePager - Gets a list of managed instance server configuration options. +// +// Generated from API version 2022-11-01-preview +// - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure +// Resource Manager API or the portal. +// - managedInstanceName - The name of the managed instance. +// - options - ServerConfigurationOptionsClientListByManagedInstanceOptions contains the optional parameters for the ServerConfigurationOptionsClient.NewListByManagedInstancePager +// method. +func (client *ServerConfigurationOptionsClient) NewListByManagedInstancePager(resourceGroupName string, managedInstanceName string, options *ServerConfigurationOptionsClientListByManagedInstanceOptions) *runtime.Pager[ServerConfigurationOptionsClientListByManagedInstanceResponse] { + return runtime.NewPager(runtime.PagingHandler[ServerConfigurationOptionsClientListByManagedInstanceResponse]{ + More: func(page ServerConfigurationOptionsClientListByManagedInstanceResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ServerConfigurationOptionsClientListByManagedInstanceResponse) (ServerConfigurationOptionsClientListByManagedInstanceResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByManagedInstanceCreateRequest(ctx, resourceGroupName, managedInstanceName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ServerConfigurationOptionsClientListByManagedInstanceResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ServerConfigurationOptionsClientListByManagedInstanceResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ServerConfigurationOptionsClientListByManagedInstanceResponse{}, runtime.NewResponseError(resp) + } + return client.listByManagedInstanceHandleResponse(resp) + }, + }) +} + +// listByManagedInstanceCreateRequest creates the ListByManagedInstance request. +func (client *ServerConfigurationOptionsClient) listByManagedInstanceCreateRequest(ctx context.Context, resourceGroupName string, managedInstanceName string, options *ServerConfigurationOptionsClientListByManagedInstanceOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/serverConfigurationOptions" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if managedInstanceName == "" { + return nil, errors.New("parameter managedInstanceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{managedInstanceName}", url.PathEscape(managedInstanceName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByManagedInstanceHandleResponse handles the ListByManagedInstance response. +func (client *ServerConfigurationOptionsClient) listByManagedInstanceHandleResponse(resp *http.Response) (ServerConfigurationOptionsClientListByManagedInstanceResponse, error) { + result := ServerConfigurationOptionsClientListByManagedInstanceResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ServerConfigurationOptionListResult); err != nil { + return ServerConfigurationOptionsClientListByManagedInstanceResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/sql/armsql/serverconnectionpolicies_client.go b/sdk/resourcemanager/sql/armsql/serverconnectionpolicies_client.go index 9db722c895ed..f4506167ae29 100644 --- a/sdk/resourcemanager/sql/armsql/serverconnectionpolicies_client.go +++ b/sdk/resourcemanager/sql/armsql/serverconnectionpolicies_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armsql @@ -47,7 +46,7 @@ func NewServerConnectionPoliciesClient(subscriptionID string, credential azcore. // BeginCreateOrUpdate - Updates a server connection policy // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-05-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -61,7 +60,8 @@ func (client *ServerConnectionPoliciesClient) BeginCreateOrUpdate(ctx context.Co if err != nil { return nil, err } - return runtime.NewPoller[ServerConnectionPoliciesClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[ServerConnectionPoliciesClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[ServerConnectionPoliciesClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -70,20 +70,22 @@ func (client *ServerConnectionPoliciesClient) BeginCreateOrUpdate(ctx context.Co // CreateOrUpdate - Updates a server connection policy // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-05-01-preview +// Generated from API version 2022-11-01-preview func (client *ServerConnectionPoliciesClient) createOrUpdate(ctx context.Context, resourceGroupName string, serverName string, connectionPolicyName ConnectionPolicyName, parameters ServerConnectionPolicy, options *ServerConnectionPoliciesClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, serverName, connectionPolicyName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createOrUpdateCreateRequest creates the CreateOrUpdate request. @@ -110,16 +112,19 @@ func (client *ServerConnectionPoliciesClient) createOrUpdateCreateRequest(ctx co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-05-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // Get - Gets a server connection policy // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-05-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -127,18 +132,21 @@ func (client *ServerConnectionPoliciesClient) createOrUpdateCreateRequest(ctx co // - options - ServerConnectionPoliciesClientGetOptions contains the optional parameters for the ServerConnectionPoliciesClient.Get // method. func (client *ServerConnectionPoliciesClient) Get(ctx context.Context, resourceGroupName string, serverName string, connectionPolicyName ConnectionPolicyName, options *ServerConnectionPoliciesClientGetOptions) (ServerConnectionPoliciesClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, serverName, connectionPolicyName, options) if err != nil { return ServerConnectionPoliciesClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ServerConnectionPoliciesClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ServerConnectionPoliciesClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ServerConnectionPoliciesClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -165,7 +173,7 @@ func (client *ServerConnectionPoliciesClient) getCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-05-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -182,7 +190,7 @@ func (client *ServerConnectionPoliciesClient) getHandleResponse(resp *http.Respo // NewListByServerPager - Lists connection policy // -// Generated from API version 2021-05-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -236,7 +244,7 @@ func (client *ServerConnectionPoliciesClient) listByServerCreateRequest(ctx cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-05-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/sql/armsql/serverconnectionpolicies_client_example_test.go b/sdk/resourcemanager/sql/armsql/serverconnectionpolicies_client_example_test.go deleted file mode 100644 index 0742d7dd96b7..000000000000 --- a/sdk/resourcemanager/sql/armsql/serverconnectionpolicies_client_example_test.go +++ /dev/null @@ -1,122 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsql_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sql/armsql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ServerConnectionPoliciesGet.json -func ExampleServerConnectionPoliciesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewServerConnectionPoliciesClient().Get(ctx, "rgtest-12", "servertest-6285", armsql.ConnectionPolicyNameDefault, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ServerConnectionPolicy = armsql.ServerConnectionPolicy{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.Sql/servers/connectionPolicies"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/rgtest-12/providers/Microsoft.Sql/servers/servertest-6285/connectionPolicies/default"), - // Location: to.Ptr("eastus"), - // Properties: &armsql.ServerConnectionPolicyProperties{ - // ConnectionType: to.Ptr(armsql.ServerConnectionTypeRedirect), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ServerConnectionPoliciesUpdate.json -func ExampleServerConnectionPoliciesClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewServerConnectionPoliciesClient().BeginCreateOrUpdate(ctx, "testrg", "testserver", armsql.ConnectionPolicyNameDefault, armsql.ServerConnectionPolicy{ - Properties: &armsql.ServerConnectionPolicyProperties{ - ConnectionType: to.Ptr(armsql.ServerConnectionTypeRedirect), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ServerConnectionPolicy = armsql.ServerConnectionPolicy{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.Sql/servers/connectionPolicies"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.Sql/servers/testserver/connectionPolicies/default"), - // Location: to.Ptr("eastus"), - // Properties: &armsql.ServerConnectionPolicyProperties{ - // ConnectionType: to.Ptr(armsql.ServerConnectionTypeRedirect), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ServerConnectionPoliciesList.json -func ExampleServerConnectionPoliciesClient_NewListByServerPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewServerConnectionPoliciesClient().NewListByServerPager("rgtest-12", "servertest-6285", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ServerConnectionPolicyListResult = armsql.ServerConnectionPolicyListResult{ - // Value: []*armsql.ServerConnectionPolicy{ - // { - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.Sql/servers/connectionPolicies"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/rgtest-12/providers/Microsoft.Sql/servers/servertest-6285/connectionPolicies/default"), - // Location: to.Ptr("eastus"), - // Properties: &armsql.ServerConnectionPolicyProperties{ - // ConnectionType: to.Ptr(armsql.ServerConnectionTypeRedirect), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/sql/armsql/serverdevopsauditsettings_client.go b/sdk/resourcemanager/sql/armsql/serverdevopsauditsettings_client.go index 48f222bad976..9552bdc7cffc 100644 --- a/sdk/resourcemanager/sql/armsql/serverdevopsauditsettings_client.go +++ b/sdk/resourcemanager/sql/armsql/serverdevopsauditsettings_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armsql @@ -47,23 +46,23 @@ func NewServerDevOpsAuditSettingsClient(subscriptionID string, credential azcore // BeginCreateOrUpdate - Creates or updates a server's DevOps audit settings. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. -// - devOpsAuditingSettingsName - The name of the devops audit settings. This should always be 'default'. // - parameters - Properties of DevOps audit settings // - options - ServerDevOpsAuditSettingsClientBeginCreateOrUpdateOptions contains the optional parameters for the ServerDevOpsAuditSettingsClient.BeginCreateOrUpdate // method. -func (client *ServerDevOpsAuditSettingsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, devOpsAuditingSettingsName string, parameters ServerDevOpsAuditingSettings, options *ServerDevOpsAuditSettingsClientBeginCreateOrUpdateOptions) (*runtime.Poller[ServerDevOpsAuditSettingsClientCreateOrUpdateResponse], error) { +func (client *ServerDevOpsAuditSettingsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, devOpsAuditingSettingsName DevOpsAuditingSettingsName, parameters ServerDevOpsAuditingSettings, options *ServerDevOpsAuditSettingsClientBeginCreateOrUpdateOptions) (*runtime.Poller[ServerDevOpsAuditSettingsClientCreateOrUpdateResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.createOrUpdate(ctx, resourceGroupName, serverName, devOpsAuditingSettingsName, parameters, options) if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ServerDevOpsAuditSettingsClientCreateOrUpdateResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ServerDevOpsAuditSettingsClientCreateOrUpdateResponse]{ FinalStateVia: runtime.FinalStateViaAzureAsyncOp, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[ServerDevOpsAuditSettingsClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -72,24 +71,26 @@ func (client *ServerDevOpsAuditSettingsClient) BeginCreateOrUpdate(ctx context.C // CreateOrUpdate - Creates or updates a server's DevOps audit settings. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview -func (client *ServerDevOpsAuditSettingsClient) createOrUpdate(ctx context.Context, resourceGroupName string, serverName string, devOpsAuditingSettingsName string, parameters ServerDevOpsAuditingSettings, options *ServerDevOpsAuditSettingsClientBeginCreateOrUpdateOptions) (*http.Response, error) { +// Generated from API version 2022-11-01-preview +func (client *ServerDevOpsAuditSettingsClient) createOrUpdate(ctx context.Context, resourceGroupName string, serverName string, devOpsAuditingSettingsName DevOpsAuditingSettingsName, parameters ServerDevOpsAuditingSettings, options *ServerDevOpsAuditSettingsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, serverName, devOpsAuditingSettingsName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *ServerDevOpsAuditSettingsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, serverName string, devOpsAuditingSettingsName string, parameters ServerDevOpsAuditingSettings, options *ServerDevOpsAuditSettingsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { +func (client *ServerDevOpsAuditSettingsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, serverName string, devOpsAuditingSettingsName DevOpsAuditingSettingsName, parameters ServerDevOpsAuditingSettings, options *ServerDevOpsAuditSettingsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/devOpsAuditingSettings/{devOpsAuditingSettingsName}" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -102,7 +103,7 @@ func (client *ServerDevOpsAuditSettingsClient) createOrUpdateCreateRequest(ctx c if devOpsAuditingSettingsName == "" { return nil, errors.New("parameter devOpsAuditingSettingsName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{devOpsAuditingSettingsName}", url.PathEscape(devOpsAuditingSettingsName)) + urlPath = strings.ReplaceAll(urlPath, "{devOpsAuditingSettingsName}", url.PathEscape(string(devOpsAuditingSettingsName))) if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -112,39 +113,44 @@ func (client *ServerDevOpsAuditSettingsClient) createOrUpdateCreateRequest(ctx c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // Get - Gets a server's DevOps audit settings. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. -// - devOpsAuditingSettingsName - The name of the devops audit settings. This should always be 'default'. // - options - ServerDevOpsAuditSettingsClientGetOptions contains the optional parameters for the ServerDevOpsAuditSettingsClient.Get // method. -func (client *ServerDevOpsAuditSettingsClient) Get(ctx context.Context, resourceGroupName string, serverName string, devOpsAuditingSettingsName string, options *ServerDevOpsAuditSettingsClientGetOptions) (ServerDevOpsAuditSettingsClientGetResponse, error) { +func (client *ServerDevOpsAuditSettingsClient) Get(ctx context.Context, resourceGroupName string, serverName string, devOpsAuditingSettingsName DevOpsAuditingSettingsName, options *ServerDevOpsAuditSettingsClientGetOptions) (ServerDevOpsAuditSettingsClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, serverName, devOpsAuditingSettingsName, options) if err != nil { return ServerDevOpsAuditSettingsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ServerDevOpsAuditSettingsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ServerDevOpsAuditSettingsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ServerDevOpsAuditSettingsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. -func (client *ServerDevOpsAuditSettingsClient) getCreateRequest(ctx context.Context, resourceGroupName string, serverName string, devOpsAuditingSettingsName string, options *ServerDevOpsAuditSettingsClientGetOptions) (*policy.Request, error) { +func (client *ServerDevOpsAuditSettingsClient) getCreateRequest(ctx context.Context, resourceGroupName string, serverName string, devOpsAuditingSettingsName DevOpsAuditingSettingsName, options *ServerDevOpsAuditSettingsClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/devOpsAuditingSettings/{devOpsAuditingSettingsName}" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -157,7 +163,7 @@ func (client *ServerDevOpsAuditSettingsClient) getCreateRequest(ctx context.Cont if devOpsAuditingSettingsName == "" { return nil, errors.New("parameter devOpsAuditingSettingsName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{devOpsAuditingSettingsName}", url.PathEscape(devOpsAuditingSettingsName)) + urlPath = strings.ReplaceAll(urlPath, "{devOpsAuditingSettingsName}", url.PathEscape(string(devOpsAuditingSettingsName))) if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -167,7 +173,7 @@ func (client *ServerDevOpsAuditSettingsClient) getCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -184,7 +190,7 @@ func (client *ServerDevOpsAuditSettingsClient) getHandleResponse(resp *http.Resp // NewListByServerPager - Lists DevOps audit settings of a server. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -238,7 +244,7 @@ func (client *ServerDevOpsAuditSettingsClient) listByServerCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/sql/armsql/serverdevopsauditsettings_client_example_test.go b/sdk/resourcemanager/sql/armsql/serverdevopsauditsettings_client_example_test.go deleted file mode 100644 index 5d3aedcd4e70..000000000000 --- a/sdk/resourcemanager/sql/armsql/serverdevopsauditsettings_client_example_test.go +++ /dev/null @@ -1,172 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsql_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sql/armsql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerDevOpsAuditGet.json -func ExampleServerDevOpsAuditSettingsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewServerDevOpsAuditSettingsClient().Get(ctx, "devAuditTestRG", "devOpsAuditTestSvr", "default", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ServerDevOpsAuditingSettings = armsql.ServerDevOpsAuditingSettings{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.Sql/servers/devOpsAuditingSettings"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/devAuditTestRG/providers/Microsoft.Sql/servers/devOpsAuditTestSvr/devOpsAuditingSettings/default"), - // Properties: &armsql.ServerDevOpsAuditSettingsProperties{ - // IsAzureMonitorTargetEnabled: to.Ptr(false), - // State: to.Ptr(armsql.BlobAuditingPolicyStateDisabled), - // StorageAccountSubscriptionID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // StorageEndpoint: to.Ptr(""), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerDevOpsAuditCreateMax.json -func ExampleServerDevOpsAuditSettingsClient_BeginCreateOrUpdate_updateAServersDevOpsAuditSettingsWithAllParams() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewServerDevOpsAuditSettingsClient().BeginCreateOrUpdate(ctx, "devAuditTestRG", "devOpsAuditTestSvr", "default", armsql.ServerDevOpsAuditingSettings{ - Properties: &armsql.ServerDevOpsAuditSettingsProperties{ - IsAzureMonitorTargetEnabled: to.Ptr(true), - State: to.Ptr(armsql.BlobAuditingPolicyStateEnabled), - StorageAccountAccessKey: to.Ptr("sdlfkjabc+sdlfkjsdlkfsjdfLDKFTERLKFDFKLjsdfksjdflsdkfD2342309432849328476458/3RSD=="), - StorageAccountSubscriptionID: to.Ptr("00000000-1234-0000-5678-000000000000"), - StorageEndpoint: to.Ptr("https://mystorage.blob.core.windows.net"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ServerDevOpsAuditingSettings = armsql.ServerDevOpsAuditingSettings{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.Sql/servers/devOpsAuditingSettings"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/devAuditTestRG/providers/Microsoft.Sql/servers/devOpsAuditTestSvr/devOpsAuditingSettings/default"), - // Properties: &armsql.ServerDevOpsAuditSettingsProperties{ - // IsAzureMonitorTargetEnabled: to.Ptr(true), - // State: to.Ptr(armsql.BlobAuditingPolicyStateEnabled), - // StorageAccountSubscriptionID: to.Ptr("00000000-1234-0000-5678-000000000000"), - // StorageEndpoint: to.Ptr("https://mystorage.blob.core.windows.net"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerDevOpsAuditCreateMin.json -func ExampleServerDevOpsAuditSettingsClient_BeginCreateOrUpdate_updateAServersDevOpsAuditSettingsWithMinimalInput() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewServerDevOpsAuditSettingsClient().BeginCreateOrUpdate(ctx, "devAuditTestRG", "devOpsAuditTestSvr", "default", armsql.ServerDevOpsAuditingSettings{ - Properties: &armsql.ServerDevOpsAuditSettingsProperties{ - State: to.Ptr(armsql.BlobAuditingPolicyStateEnabled), - StorageAccountAccessKey: to.Ptr("sdlfkjabc+sdlfkjsdlkfsjdfLDKFTERLKFDFKLjsdfksjdflsdkfD2342309432849328476458/3RSD=="), - StorageEndpoint: to.Ptr("https://mystorage.blob.core.windows.net"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ServerDevOpsAuditingSettings = armsql.ServerDevOpsAuditingSettings{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.Sql/servers/devOpsAuditingSettings"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/devAuditTestRG/providers/Microsoft.Sql/servers/devOpsAuditTestSvr/devOpsAuditingSettings/default"), - // Properties: &armsql.ServerDevOpsAuditSettingsProperties{ - // State: to.Ptr(armsql.BlobAuditingPolicyStateEnabled), - // StorageAccountSubscriptionID: to.Ptr("00000000-1234-0000-5678-000000000000"), - // StorageEndpoint: to.Ptr("https://mystorage.blob.core.windows.net"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerDevOpsAuditSettingsList.json -func ExampleServerDevOpsAuditSettingsClient_NewListByServerPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewServerDevOpsAuditSettingsClient().NewListByServerPager("devAuditTestRG", "devOpsAuditTestSvr", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ServerDevOpsAuditSettingsListResult = armsql.ServerDevOpsAuditSettingsListResult{ - // Value: []*armsql.ServerDevOpsAuditingSettings{ - // { - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.Sql/servers/devOpsAuditingSettings"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/devAuditTestRG/providers/Microsoft.Sql/servers/devOpsAuditTestSvr/devOpsAuditingSettings/default"), - // Properties: &armsql.ServerDevOpsAuditSettingsProperties{ - // IsAzureMonitorTargetEnabled: to.Ptr(false), - // State: to.Ptr(armsql.BlobAuditingPolicyStateDisabled), - // StorageAccountSubscriptionID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // StorageEndpoint: to.Ptr(""), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/sql/armsql/serverdnsaliases_client.go b/sdk/resourcemanager/sql/armsql/serverdnsaliases_client.go index bd74dd460a27..18aeae66d26c 100644 --- a/sdk/resourcemanager/sql/armsql/serverdnsaliases_client.go +++ b/sdk/resourcemanager/sql/armsql/serverdnsaliases_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armsql @@ -47,7 +46,7 @@ func NewServerDNSAliasesClient(subscriptionID string, credential azcore.TokenCre // BeginAcquire - Acquires server DNS alias from another server. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server that the alias is pointing to. @@ -60,7 +59,8 @@ func (client *ServerDNSAliasesClient) BeginAcquire(ctx context.Context, resource if err != nil { return nil, err } - return runtime.NewPoller[ServerDNSAliasesClientAcquireResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[ServerDNSAliasesClientAcquireResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[ServerDNSAliasesClientAcquireResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -69,20 +69,22 @@ func (client *ServerDNSAliasesClient) BeginAcquire(ctx context.Context, resource // Acquire - Acquires server DNS alias from another server. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview func (client *ServerDNSAliasesClient) acquire(ctx context.Context, resourceGroupName string, serverName string, dnsAliasName string, parameters ServerDNSAliasAcquisition, options *ServerDNSAliasesClientBeginAcquireOptions) (*http.Response, error) { + var err error req, err := client.acquireCreateRequest(ctx, resourceGroupName, serverName, dnsAliasName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // acquireCreateRequest creates the Acquire request. @@ -109,16 +111,19 @@ func (client *ServerDNSAliasesClient) acquireCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // BeginCreateOrUpdate - Creates a server DNS alias. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server that the alias is pointing to. @@ -131,7 +136,8 @@ func (client *ServerDNSAliasesClient) BeginCreateOrUpdate(ctx context.Context, r if err != nil { return nil, err } - return runtime.NewPoller[ServerDNSAliasesClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[ServerDNSAliasesClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[ServerDNSAliasesClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -140,20 +146,22 @@ func (client *ServerDNSAliasesClient) BeginCreateOrUpdate(ctx context.Context, r // CreateOrUpdate - Creates a server DNS alias. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview func (client *ServerDNSAliasesClient) createOrUpdate(ctx context.Context, resourceGroupName string, serverName string, dnsAliasName string, options *ServerDNSAliasesClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, serverName, dnsAliasName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createOrUpdateCreateRequest creates the CreateOrUpdate request. @@ -180,7 +188,7 @@ func (client *ServerDNSAliasesClient) createOrUpdateCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -189,7 +197,7 @@ func (client *ServerDNSAliasesClient) createOrUpdateCreateRequest(ctx context.Co // BeginDelete - Deletes the server DNS alias with the given name. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server that the alias is pointing to. @@ -202,7 +210,8 @@ func (client *ServerDNSAliasesClient) BeginDelete(ctx context.Context, resourceG if err != nil { return nil, err } - return runtime.NewPoller[ServerDNSAliasesClientDeleteResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[ServerDNSAliasesClientDeleteResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[ServerDNSAliasesClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -211,20 +220,22 @@ func (client *ServerDNSAliasesClient) BeginDelete(ctx context.Context, resourceG // Delete - Deletes the server DNS alias with the given name. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview func (client *ServerDNSAliasesClient) deleteOperation(ctx context.Context, resourceGroupName string, serverName string, dnsAliasName string, options *ServerDNSAliasesClientBeginDeleteOptions) (*http.Response, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, serverName, dnsAliasName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteCreateRequest creates the Delete request. @@ -251,7 +262,7 @@ func (client *ServerDNSAliasesClient) deleteCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -259,25 +270,28 @@ func (client *ServerDNSAliasesClient) deleteCreateRequest(ctx context.Context, r // Get - Gets a server DNS alias. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server that the alias is pointing to. // - dnsAliasName - The name of the server dns alias. // - options - ServerDNSAliasesClientGetOptions contains the optional parameters for the ServerDNSAliasesClient.Get method. func (client *ServerDNSAliasesClient) Get(ctx context.Context, resourceGroupName string, serverName string, dnsAliasName string, options *ServerDNSAliasesClientGetOptions) (ServerDNSAliasesClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, serverName, dnsAliasName, options) if err != nil { return ServerDNSAliasesClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ServerDNSAliasesClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ServerDNSAliasesClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ServerDNSAliasesClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -304,7 +318,7 @@ func (client *ServerDNSAliasesClient) getCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -321,7 +335,7 @@ func (client *ServerDNSAliasesClient) getHandleResponse(resp *http.Response) (Se // NewListByServerPager - Gets a list of server DNS aliases for a server. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server that the alias is pointing to. @@ -375,7 +389,7 @@ func (client *ServerDNSAliasesClient) listByServerCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/sql/armsql/serverdnsaliases_client_example_test.go b/sdk/resourcemanager/sql/armsql/serverdnsaliases_client_example_test.go deleted file mode 100644 index 4ee7f0afe521..000000000000 --- a/sdk/resourcemanager/sql/armsql/serverdnsaliases_client_example_test.go +++ /dev/null @@ -1,178 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsql_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sql/armsql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerDnsAliasGet.json -func ExampleServerDNSAliasesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewServerDNSAliasesClient().Get(ctx, "Default", "dns-alias-server", "dns-alias-name-1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ServerDNSAlias = armsql.ServerDNSAlias{ - // Name: to.Ptr("dns-alias-name-1"), - // Type: to.Ptr("Microsoft.Sql/servers/dnsAliases"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/servers/dns-alias-server/dnsAliases/dns-alias-name-1"), - // Properties: &armsql.ServerDNSAliasProperties{ - // AzureDNSRecord: to.Ptr("dns-alias-name-1.database.windows.net"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerDnsAliasCreateOrUpdate.json -func ExampleServerDNSAliasesClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewServerDNSAliasesClient().BeginCreateOrUpdate(ctx, "Default", "dns-alias-server", "dns-alias-name-1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ServerDNSAlias = armsql.ServerDNSAlias{ - // Name: to.Ptr("dns-alias-name-1"), - // Type: to.Ptr("Microsoft.Sql/servers/dnsAliases"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/servers/dns-alias-server/dnsAliases/dns-alias-name-1"), - // Properties: &armsql.ServerDNSAliasProperties{ - // AzureDNSRecord: to.Ptr("dns-alias-name-1.database.windows.net"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerDnsAliasDelete.json -func ExampleServerDNSAliasesClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewServerDNSAliasesClient().BeginDelete(ctx, "Default", "dns-alias-server", "dns-alias-name-1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerDnsAliasList.json -func ExampleServerDNSAliasesClient_NewListByServerPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewServerDNSAliasesClient().NewListByServerPager("Default", "dns-alias-server", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ServerDNSAliasListResult = armsql.ServerDNSAliasListResult{ - // Value: []*armsql.ServerDNSAlias{ - // { - // Name: to.Ptr("server-dns-alias-1"), - // Type: to.Ptr("Microsoft.Sql/servers/dnsAliases"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/servers/dns-alias-server/dnsAliases/dns-alias-1"), - // Properties: &armsql.ServerDNSAliasProperties{ - // AzureDNSRecord: to.Ptr("dns-alias-1.database.windows.net"), - // }, - // }, - // { - // Name: to.Ptr("server-dns-alias-2"), - // Type: to.Ptr("Microsoft.Sql/servers/dnsAliases"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/servers/dns-alias-server/dnsAliases/dns-alias-2"), - // Properties: &armsql.ServerDNSAliasProperties{ - // AzureDNSRecord: to.Ptr("dns-alias-2.database.windows.net"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerDnsAliasAcquire.json -func ExampleServerDNSAliasesClient_BeginAcquire() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewServerDNSAliasesClient().BeginAcquire(ctx, "Default", "dns-alias-new-server", "dns-alias-name-1", armsql.ServerDNSAliasAcquisition{ - OldServerDNSAliasID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/servers/dns-alias-old-server/dnsAliases/dns-alias-name-1"), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ServerDNSAlias = armsql.ServerDNSAlias{ - // Name: to.Ptr("server-dns-alias-name-1"), - // Type: to.Ptr("Microsoft.Sql/servers/dnsAliases"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/servers/dns-alias-new-server/dnsAliases/dns-alias-name-1"), - // Properties: &armsql.ServerDNSAliasProperties{ - // AzureDNSRecord: to.Ptr("dns-alias-name-1.database.windows.net"), - // }, - // } -} diff --git a/sdk/resourcemanager/sql/armsql/serverkeys_client.go b/sdk/resourcemanager/sql/armsql/serverkeys_client.go index 7fe19d9e7a0f..b6ce547d6dc4 100644 --- a/sdk/resourcemanager/sql/armsql/serverkeys_client.go +++ b/sdk/resourcemanager/sql/armsql/serverkeys_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armsql @@ -47,7 +46,7 @@ func NewServerKeysClient(subscriptionID string, credential azcore.TokenCredentia // BeginCreateOrUpdate - Creates or updates a server key. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -64,7 +63,8 @@ func (client *ServerKeysClient) BeginCreateOrUpdate(ctx context.Context, resourc if err != nil { return nil, err } - return runtime.NewPoller[ServerKeysClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[ServerKeysClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[ServerKeysClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -73,20 +73,22 @@ func (client *ServerKeysClient) BeginCreateOrUpdate(ctx context.Context, resourc // CreateOrUpdate - Creates or updates a server key. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview func (client *ServerKeysClient) createOrUpdate(ctx context.Context, resourceGroupName string, serverName string, keyName string, parameters ServerKey, options *ServerKeysClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, serverName, keyName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createOrUpdateCreateRequest creates the CreateOrUpdate request. @@ -113,16 +115,19 @@ func (client *ServerKeysClient) createOrUpdateCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // BeginDelete - Deletes the server key with the given name. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -134,7 +139,8 @@ func (client *ServerKeysClient) BeginDelete(ctx context.Context, resourceGroupNa if err != nil { return nil, err } - return runtime.NewPoller[ServerKeysClientDeleteResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[ServerKeysClientDeleteResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[ServerKeysClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -143,20 +149,22 @@ func (client *ServerKeysClient) BeginDelete(ctx context.Context, resourceGroupNa // Delete - Deletes the server key with the given name. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview func (client *ServerKeysClient) deleteOperation(ctx context.Context, resourceGroupName string, serverName string, keyName string, options *ServerKeysClientBeginDeleteOptions) (*http.Response, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, serverName, keyName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteCreateRequest creates the Delete request. @@ -183,7 +191,7 @@ func (client *ServerKeysClient) deleteCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -191,25 +199,28 @@ func (client *ServerKeysClient) deleteCreateRequest(ctx context.Context, resourc // Get - Gets a server key. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. // - keyName - The name of the server key to be retrieved. // - options - ServerKeysClientGetOptions contains the optional parameters for the ServerKeysClient.Get method. func (client *ServerKeysClient) Get(ctx context.Context, resourceGroupName string, serverName string, keyName string, options *ServerKeysClientGetOptions) (ServerKeysClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, serverName, keyName, options) if err != nil { return ServerKeysClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ServerKeysClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ServerKeysClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ServerKeysClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -236,7 +247,7 @@ func (client *ServerKeysClient) getCreateRequest(ctx context.Context, resourceGr return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -253,7 +264,7 @@ func (client *ServerKeysClient) getHandleResponse(resp *http.Response) (ServerKe // NewListByServerPager - Gets a list of server keys. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -307,7 +318,7 @@ func (client *ServerKeysClient) listByServerCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/sql/armsql/serverkeys_client_example_test.go b/sdk/resourcemanager/sql/armsql/serverkeys_client_example_test.go deleted file mode 100644 index b64dbfc70144..000000000000 --- a/sdk/resourcemanager/sql/armsql/serverkeys_client_example_test.go +++ /dev/null @@ -1,174 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsql_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sql/armsql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerKeyList.json -func ExampleServerKeysClient_NewListByServerPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewServerKeysClient().NewListByServerPager("sqlcrudtest-7398", "sqlcrudtest-4645", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ServerKeyListResult = armsql.ServerKeyListResult{ - // Value: []*armsql.ServerKey{ - // { - // Name: to.Ptr("someVault_someKey_01234567890123456789012345678901"), - // Type: to.Ptr("Microsoft.Sql/servers/keys"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/sqlcrudtest-7398/providers/Microsoft.Sql/servers/sqlcrudtest-4645/keys/someVault_someKey_01234567890123456789012345678901"), - // Kind: to.Ptr("azurekeyvault"), - // Location: to.Ptr("Japan East"), - // Properties: &armsql.ServerKeyProperties{ - // AutoRotationEnabled: to.Ptr(false), - // CreationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-15T00:00:00Z"); return t}()), - // Thumbprint: to.Ptr("00112233445566778899AABBCCDDEEFFAABBCCDD"), - // }, - // }, - // { - // Name: to.Ptr("myVault_myKey_11111111111111111111111111111111"), - // Type: to.Ptr("Microsoft.Sql/servers/keys"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/sqlcrudtest-7398/providers/Microsoft.Sql/servers/sqlcrudtest-4645/keys/myVault_myKey_11111111111111111111111111111111"), - // Kind: to.Ptr("azurekeyvault"), - // Location: to.Ptr("Japan East"), - // Properties: &armsql.ServerKeyProperties{ - // AutoRotationEnabled: to.Ptr(false), - // CreationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-15T00:00:00Z"); return t}()), - // Thumbprint: to.Ptr("AAAAAAAAAAAAAAABBBBBBBBBBBBBBBBBBBBBBBBB"), - // }, - // }, - // { - // Name: to.Ptr("ServiceManaged"), - // Type: to.Ptr("Microsoft.Sql/servers/keys"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/sqlcrudtest-7398/providers/Microsoft.Sql/servers/sqlcrudtest-4645/keys/ServiceManaged"), - // Kind: to.Ptr("servicemanaged"), - // Location: to.Ptr("Japan East"), - // Properties: &armsql.ServerKeyProperties{ - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerKeyGet.json -func ExampleServerKeysClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewServerKeysClient().Get(ctx, "sqlcrudtest-7398", "sqlcrudtest-4645", "someVault_someKey_01234567890123456789012345678901", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ServerKey = armsql.ServerKey{ - // Name: to.Ptr("sqlcrudtest-4645"), - // Type: to.Ptr("Microsoft.Sql/servers/keys"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/sqlcrudtest-7398/providers/Microsoft.Sql/servers/sqlcrudtest-4645/keys/someVault_someKey_01234567890123456789012345678901"), - // Kind: to.Ptr("azurekeyvault"), - // Location: to.Ptr("Japan East"), - // Properties: &armsql.ServerKeyProperties{ - // AutoRotationEnabled: to.Ptr(false), - // CreationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-15T00:00:00Z"); return t}()), - // Thumbprint: to.Ptr("00112233445566778899AABBCCDDEEFFAABBCCDD"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerKeyCreateOrUpdate.json -func ExampleServerKeysClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewServerKeysClient().BeginCreateOrUpdate(ctx, "sqlcrudtest-7398", "sqlcrudtest-4645", "someVault_someKey_01234567890123456789012345678901", armsql.ServerKey{ - Properties: &armsql.ServerKeyProperties{ - ServerKeyType: to.Ptr(armsql.ServerKeyTypeAzureKeyVault), - URI: to.Ptr("https://someVault.vault.azure.net/keys/someKey/01234567890123456789012345678901"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ServerKey = armsql.ServerKey{ - // Name: to.Ptr("sqlcrudtest-4645"), - // Type: to.Ptr("Microsoft.Sql/servers/keys"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/sqlcrudtest-7398/providers/Microsoft.Sql/servers/sqlcrudtest-4645/keys/someVault_someKey_01234567890123456789012345678901"), - // Kind: to.Ptr("azurekeyvault"), - // Location: to.Ptr("Japan East"), - // Properties: &armsql.ServerKeyProperties{ - // AutoRotationEnabled: to.Ptr(false), - // CreationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-15T00:00:00Z"); return t}()), - // Thumbprint: to.Ptr("00112233445566778899AABBCCDDEEFFAABBCCDD"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerKeyDelete.json -func ExampleServerKeysClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewServerKeysClient().BeginDelete(ctx, "sqlcrudtest-7398", "sqlcrudtest-4645", "someVault_someKey_01234567890123456789012345678901", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} diff --git a/sdk/resourcemanager/sql/armsql/serveroperations_client.go b/sdk/resourcemanager/sql/armsql/serveroperations_client.go index a339c9a7b3bf..302f9c18b088 100644 --- a/sdk/resourcemanager/sql/armsql/serveroperations_client.go +++ b/sdk/resourcemanager/sql/armsql/serveroperations_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armsql @@ -46,7 +45,7 @@ func NewServerOperationsClient(subscriptionID string, credential azcore.TokenCre // NewListByServerPager - Gets a list of operations performed on the server. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -100,7 +99,7 @@ func (client *ServerOperationsClient) listByServerCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/sql/armsql/serveroperations_client_example_test.go b/sdk/resourcemanager/sql/armsql/serveroperations_client_example_test.go deleted file mode 100644 index 48f13933d910..000000000000 --- a/sdk/resourcemanager/sql/armsql/serveroperations_client_example_test.go +++ /dev/null @@ -1,72 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsql_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sql/armsql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ListServerOperations.json -func ExampleServerOperationsClient_NewListByServerPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewServerOperationsClient().NewListByServerPager("sqlcrudtest-7398", "sqlcrudtest-4645", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ServerOperationListResult = armsql.ServerOperationListResult{ - // Value: []*armsql.ServerOperation{ - // { - // Name: to.Ptr("11111111-1111-1111-1111-111111111111"), - // Type: to.Ptr("Microsoft.Sql/servers/operations"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/sqlcrudtest-7398/providers/Microsoft.Sql/servers/sqlcrudtest-4645/operations/11111111-1111-1111-1111-111111111111"), - // Properties: &armsql.ServerOperationProperties{ - // Operation: to.Ptr("MakeAllLogicalDatabasesAccessible"), - // OperationFriendlyName: to.Ptr("MAKE ALL DBS ACCESSIBLE"), - // PercentComplete: to.Ptr[int32](0), - // ServerName: to.Ptr("sqlcrudtest-4645"), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-06-01T09:10:08.1Z"); return t}()), - // State: to.Ptr(armsql.ManagementOperationStateInProgress), - // }, - // }, - // { - // Name: to.Ptr("22222222-2222-2222-2222-222222222222"), - // Type: to.Ptr("Microsoft.Sql/servers/operations"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/sqlcrudtest-7398/providers/Microsoft.Sql/servers/sqlcrudtest-4645/operations/22222222-2222-2222-2222-222222222222"), - // Properties: &armsql.ServerOperationProperties{ - // Operation: to.Ptr("MakeAllLogicalDatabasesAccessible"), - // OperationFriendlyName: to.Ptr("MAKE ALL DBS ACCESSIBLE"), - // PercentComplete: to.Ptr[int32](100), - // ServerName: to.Ptr("sqlcrudtest-4645"), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-06-01T09:00:08.1Z"); return t}()), - // State: to.Ptr(armsql.ManagementOperationStateSucceeded), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/sql/armsql/servers_client.go b/sdk/resourcemanager/sql/armsql/servers_client.go index b97e8f01cf5f..5e3ae7bc7f41 100644 --- a/sdk/resourcemanager/sql/armsql/servers_client.go +++ b/sdk/resourcemanager/sql/armsql/servers_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armsql @@ -47,23 +46,26 @@ func NewServersClient(subscriptionID string, credential azcore.TokenCredential, // CheckNameAvailability - Determines whether a resource can be created with the specified name. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-02-01-preview +// Generated from API version 2022-11-01-preview // - parameters - The name availability request parameters. // - options - ServersClientCheckNameAvailabilityOptions contains the optional parameters for the ServersClient.CheckNameAvailability // method. func (client *ServersClient) CheckNameAvailability(ctx context.Context, parameters CheckNameAvailabilityRequest, options *ServersClientCheckNameAvailabilityOptions) (ServersClientCheckNameAvailabilityResponse, error) { + var err error req, err := client.checkNameAvailabilityCreateRequest(ctx, parameters, options) if err != nil { return ServersClientCheckNameAvailabilityResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ServersClientCheckNameAvailabilityResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ServersClientCheckNameAvailabilityResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ServersClientCheckNameAvailabilityResponse{}, err } - return client.checkNameAvailabilityHandleResponse(resp) + resp, err := client.checkNameAvailabilityHandleResponse(httpResp) + return resp, err } // checkNameAvailabilityCreateRequest creates the CheckNameAvailability request. @@ -78,10 +80,13 @@ func (client *ServersClient) checkNameAvailabilityCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-02-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // checkNameAvailabilityHandleResponse handles the CheckNameAvailability response. @@ -96,7 +101,7 @@ func (client *ServersClient) checkNameAvailabilityHandleResponse(resp *http.Resp // BeginCreateOrUpdate - Creates or updates a server. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-02-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -109,7 +114,8 @@ func (client *ServersClient) BeginCreateOrUpdate(ctx context.Context, resourceGr if err != nil { return nil, err } - return runtime.NewPoller[ServersClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[ServersClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[ServersClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -118,20 +124,22 @@ func (client *ServersClient) BeginCreateOrUpdate(ctx context.Context, resourceGr // CreateOrUpdate - Creates or updates a server. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-02-01-preview +// Generated from API version 2022-11-01-preview func (client *ServersClient) createOrUpdate(ctx context.Context, resourceGroupName string, serverName string, parameters Server, options *ServersClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, serverName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createOrUpdateCreateRequest creates the CreateOrUpdate request. @@ -154,16 +162,19 @@ func (client *ServersClient) createOrUpdateCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-02-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // BeginDelete - Deletes a server. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-02-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -174,7 +185,8 @@ func (client *ServersClient) BeginDelete(ctx context.Context, resourceGroupName if err != nil { return nil, err } - return runtime.NewPoller[ServersClientDeleteResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[ServersClientDeleteResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[ServersClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -183,20 +195,22 @@ func (client *ServersClient) BeginDelete(ctx context.Context, resourceGroupName // Delete - Deletes a server. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-02-01-preview +// Generated from API version 2022-11-01-preview func (client *ServersClient) deleteOperation(ctx context.Context, resourceGroupName string, serverName string, options *ServersClientBeginDeleteOptions) (*http.Response, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, serverName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteCreateRequest creates the Delete request. @@ -219,7 +233,7 @@ func (client *ServersClient) deleteCreateRequest(ctx context.Context, resourceGr return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-02-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -227,24 +241,27 @@ func (client *ServersClient) deleteCreateRequest(ctx context.Context, resourceGr // Get - Gets a server. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-02-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. // - options - ServersClientGetOptions contains the optional parameters for the ServersClient.Get method. func (client *ServersClient) Get(ctx context.Context, resourceGroupName string, serverName string, options *ServersClientGetOptions) (ServersClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, serverName, options) if err != nil { return ServersClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ServersClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ServersClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ServersClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -270,7 +287,7 @@ func (client *ServersClient) getCreateRequest(ctx context.Context, resourceGroup if options != nil && options.Expand != nil { reqQP.Set("$expand", *options.Expand) } - reqQP.Set("api-version", "2021-02-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -288,7 +305,7 @@ func (client *ServersClient) getHandleResponse(resp *http.Response) (ServersClie // BeginImportDatabase - Imports a bacpac into a new database. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-02-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -301,7 +318,8 @@ func (client *ServersClient) BeginImportDatabase(ctx context.Context, resourceGr if err != nil { return nil, err } - return runtime.NewPoller[ServersClientImportDatabaseResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[ServersClientImportDatabaseResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[ServersClientImportDatabaseResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -310,20 +328,22 @@ func (client *ServersClient) BeginImportDatabase(ctx context.Context, resourceGr // ImportDatabase - Imports a bacpac into a new database. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-02-01-preview +// Generated from API version 2022-11-01-preview func (client *ServersClient) importDatabase(ctx context.Context, resourceGroupName string, serverName string, parameters ImportNewDatabaseDefinition, options *ServersClientBeginImportDatabaseOptions) (*http.Response, error) { + var err error req, err := client.importDatabaseCreateRequest(ctx, resourceGroupName, serverName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // importDatabaseCreateRequest creates the ImportDatabase request. @@ -346,15 +366,18 @@ func (client *ServersClient) importDatabaseCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-02-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // NewListPager - Gets a list of all servers in the subscription. // -// Generated from API version 2021-02-01-preview +// Generated from API version 2022-11-01-preview // - options - ServersClientListOptions contains the optional parameters for the ServersClient.NewListPager method. func (client *ServersClient) NewListPager(options *ServersClientListOptions) *runtime.Pager[ServersClientListResponse] { return runtime.NewPager(runtime.PagingHandler[ServersClientListResponse]{ @@ -399,7 +422,7 @@ func (client *ServersClient) listCreateRequest(ctx context.Context, options *Ser if options != nil && options.Expand != nil { reqQP.Set("$expand", *options.Expand) } - reqQP.Set("api-version", "2021-02-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -416,7 +439,7 @@ func (client *ServersClient) listHandleResponse(resp *http.Response) (ServersCli // NewListByResourceGroupPager - Gets a list of servers in a resource groups. // -// Generated from API version 2021-02-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - options - ServersClientListByResourceGroupOptions contains the optional parameters for the ServersClient.NewListByResourceGroupPager @@ -468,7 +491,7 @@ func (client *ServersClient) listByResourceGroupCreateRequest(ctx context.Contex if options != nil && options.Expand != nil { reqQP.Set("$expand", *options.Expand) } - reqQP.Set("api-version", "2021-02-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -483,10 +506,81 @@ func (client *ServersClient) listByResourceGroupHandleResponse(resp *http.Respon return result, nil } +// BeginRefreshStatus - Refresh external governance enablement status. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-11-01-preview +// - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure +// Resource Manager API or the portal. +// - serverName - The name of the server. +// - options - ServersClientBeginRefreshStatusOptions contains the optional parameters for the ServersClient.BeginRefreshStatus +// method. +func (client *ServersClient) BeginRefreshStatus(ctx context.Context, resourceGroupName string, serverName string, options *ServersClientBeginRefreshStatusOptions) (*runtime.Poller[ServersClientRefreshStatusResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.refreshStatus(ctx, resourceGroupName, serverName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ServersClientRefreshStatusResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[ServersClientRefreshStatusResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// RefreshStatus - Refresh external governance enablement status. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-11-01-preview +func (client *ServersClient) refreshStatus(ctx context.Context, resourceGroupName string, serverName string, options *ServersClientBeginRefreshStatusOptions) (*http.Response, error) { + var err error + req, err := client.refreshStatusCreateRequest(ctx, resourceGroupName, serverName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// refreshStatusCreateRequest creates the RefreshStatus request. +func (client *ServersClient) refreshStatusCreateRequest(ctx context.Context, resourceGroupName string, serverName string, options *ServersClientBeginRefreshStatusOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/refreshExternalGovernanceStatus" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serverName == "" { + return nil, errors.New("parameter serverName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serverName}", url.PathEscape(serverName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + // BeginUpdate - Updates a server. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-02-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -498,7 +592,8 @@ func (client *ServersClient) BeginUpdate(ctx context.Context, resourceGroupName if err != nil { return nil, err } - return runtime.NewPoller[ServersClientUpdateResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[ServersClientUpdateResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[ServersClientUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -507,20 +602,22 @@ func (client *ServersClient) BeginUpdate(ctx context.Context, resourceGroupName // Update - Updates a server. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-02-01-preview +// Generated from API version 2022-11-01-preview func (client *ServersClient) update(ctx context.Context, resourceGroupName string, serverName string, parameters ServerUpdate, options *ServersClientBeginUpdateOptions) (*http.Response, error) { + var err error req, err := client.updateCreateRequest(ctx, resourceGroupName, serverName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // updateCreateRequest creates the Update request. @@ -543,8 +640,11 @@ func (client *ServersClient) updateCreateRequest(ctx context.Context, resourceGr return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-02-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } diff --git a/sdk/resourcemanager/sql/armsql/servers_client_example_test.go b/sdk/resourcemanager/sql/armsql/servers_client_example_test.go deleted file mode 100644 index 42afc500c0b7..000000000000 --- a/sdk/resourcemanager/sql/armsql/servers_client_example_test.go +++ /dev/null @@ -1,866 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsql_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sql/armsql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/ServerListByResourceGroup.json -func ExampleServersClient_NewListByResourceGroupPager_listServersByResourceGroup() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewServersClient().NewListByResourceGroupPager("sqlcrudtest-7398", &armsql.ServersClientListByResourceGroupOptions{Expand: nil}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ServerListResult = armsql.ServerListResult{ - // Value: []*armsql.Server{ - // { - // Name: to.Ptr("sqlcrudtest-4645"), - // Type: to.Ptr("Microsoft.Sql/servers"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/sqlcrudtest-7398/providers/Microsoft.Sql/servers/sqlcrudtest-4645"), - // Location: to.Ptr("japaneast"), - // Kind: to.Ptr("v12.0"), - // Properties: &armsql.ServerProperties{ - // AdministratorLogin: to.Ptr("dummylogin"), - // FullyQualifiedDomainName: to.Ptr("sqlcrudtest-4645.database.windows.net"), - // PrivateEndpointConnections: []*armsql.ServerPrivateEndpointConnection{ - // { - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/sqlcrudtest-7398/providers/Microsoft.Sql/servers/sqlcrudtest-4645/privateEndpointConnections/private-endpoint-name-00000000-1111-2222-3333-444444444444"), - // Properties: &armsql.PrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armsql.PrivateEndpointProperty{ - // ID: to.Ptr("/subscriptions/55555555-6666-7777-8888-999999999999/resourceGroups/Default-Network/providers/Microsoft.Network/privateEndpoints/private-endpoint-name"), - // }, - // PrivateLinkServiceConnectionState: &armsql.PrivateLinkServiceConnectionStateProperty{ - // Description: to.Ptr("Auto-approved"), - // ActionsRequired: to.Ptr(armsql.PrivateLinkServiceConnectionStateActionsRequireNone), - // Status: to.Ptr(armsql.PrivateLinkServiceConnectionStateStatusApproved), - // }, - // ProvisioningState: to.Ptr(armsql.PrivateEndpointProvisioningState("Succeeded")), - // }, - // }}, - // PublicNetworkAccess: to.Ptr(armsql.ServerNetworkAccessFlagEnabled), - // RestrictOutboundNetworkAccess: to.Ptr(armsql.ServerNetworkAccessFlagEnabled), - // State: to.Ptr("Ready"), - // Version: to.Ptr("12.0"), - // WorkspaceFeature: to.Ptr(armsql.ServerWorkspaceFeatureConnected), - // }, - // }, - // { - // Name: to.Ptr("sqlcrudtest-6661"), - // Type: to.Ptr("Microsoft.Sql/servers"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/sqlcrudtest-7398/providers/Microsoft.Sql/servers/sqlcrudtest-6661"), - // Location: to.Ptr("japaneast"), - // Kind: to.Ptr("v12.0"), - // Properties: &armsql.ServerProperties{ - // AdministratorLogin: to.Ptr("dummylogin"), - // FullyQualifiedDomainName: to.Ptr("sqlcrudtest-6661.database.windows.net"), - // PrivateEndpointConnections: []*armsql.ServerPrivateEndpointConnection{ - // { - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/sqlcrudtest-7398/providers/Microsoft.Sql/servers/sqlcrudtest-4645/privateEndpointConnections/private-endpoint-name-00000000-1111-2222-3333-444444444444"), - // Properties: &armsql.PrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armsql.PrivateEndpointProperty{ - // ID: to.Ptr("/subscriptions/55555555-6666-7777-8888-999999999999/resourceGroups/Default-Network/providers/Microsoft.Network/privateEndpoints/private-endpoint-name"), - // }, - // PrivateLinkServiceConnectionState: &armsql.PrivateLinkServiceConnectionStateProperty{ - // Description: to.Ptr("Auto-approved"), - // ActionsRequired: to.Ptr(armsql.PrivateLinkServiceConnectionStateActionsRequireNone), - // Status: to.Ptr(armsql.PrivateLinkServiceConnectionStateStatusApproved), - // }, - // ProvisioningState: to.Ptr(armsql.PrivateEndpointProvisioningState("Succeeded")), - // }, - // }}, - // PublicNetworkAccess: to.Ptr(armsql.ServerNetworkAccessFlagEnabled), - // RestrictOutboundNetworkAccess: to.Ptr(armsql.ServerNetworkAccessFlagEnabled), - // State: to.Ptr("Ready"), - // Version: to.Ptr("12.0"), - // WorkspaceFeature: to.Ptr(armsql.ServerWorkspaceFeatureConnected), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/ServerListByResourceGroupWithExpandEqualsAdministrators.json -func ExampleServersClient_NewListByResourceGroupPager_listServersByResourceGroupWithExpandAdministrators() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewServersClient().NewListByResourceGroupPager("sqlcrudtest-7398", &armsql.ServersClientListByResourceGroupOptions{Expand: nil}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ServerListResult = armsql.ServerListResult{ - // Value: []*armsql.Server{ - // { - // Name: to.Ptr("sqlcrudtest-4645"), - // Type: to.Ptr("Microsoft.Sql/servers"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/sqlcrudtest-7398/providers/Microsoft.Sql/servers/sqlcrudtest-4645"), - // Location: to.Ptr("japaneast"), - // Kind: to.Ptr("v12.0"), - // Properties: &armsql.ServerProperties{ - // AdministratorLogin: to.Ptr("dummylogin"), - // Administrators: &armsql.ServerExternalAdministrator{ - // AzureADOnlyAuthentication: to.Ptr(true), - // Login: to.Ptr("bob@contoso.com"), - // PrincipalType: to.Ptr(armsql.PrincipalTypeUser), - // Sid: to.Ptr("00000011-1111-2222-2222-123456789111"), - // TenantID: to.Ptr("00000011-1111-2222-2222-123456789111"), - // }, - // FullyQualifiedDomainName: to.Ptr("sqlcrudtest-4645.database.windows.net"), - // PrivateEndpointConnections: []*armsql.ServerPrivateEndpointConnection{ - // { - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/sqlcrudtest-7398/providers/Microsoft.Sql/servers/sqlcrudtest-4645/privateEndpointConnections/private-endpoint-name-00000000-1111-2222-3333-444444444444"), - // Properties: &armsql.PrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armsql.PrivateEndpointProperty{ - // ID: to.Ptr("/subscriptions/55555555-6666-7777-8888-999999999999/resourceGroups/Default-Network/providers/Microsoft.Network/privateEndpoints/private-endpoint-name"), - // }, - // PrivateLinkServiceConnectionState: &armsql.PrivateLinkServiceConnectionStateProperty{ - // Description: to.Ptr("Auto-approved"), - // ActionsRequired: to.Ptr(armsql.PrivateLinkServiceConnectionStateActionsRequireNone), - // Status: to.Ptr(armsql.PrivateLinkServiceConnectionStateStatusApproved), - // }, - // ProvisioningState: to.Ptr(armsql.PrivateEndpointProvisioningState("Succeeded")), - // }, - // }}, - // PublicNetworkAccess: to.Ptr(armsql.ServerNetworkAccessFlagEnabled), - // RestrictOutboundNetworkAccess: to.Ptr(armsql.ServerNetworkAccessFlagEnabled), - // State: to.Ptr("Ready"), - // Version: to.Ptr("12.0"), - // WorkspaceFeature: to.Ptr(armsql.ServerWorkspaceFeatureConnected), - // }, - // }, - // { - // Name: to.Ptr("sqlcrudtest-6661"), - // Type: to.Ptr("Microsoft.Sql/servers"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/sqlcrudtest-7398/providers/Microsoft.Sql/servers/sqlcrudtest-6661"), - // Location: to.Ptr("japaneast"), - // Kind: to.Ptr("v12.0"), - // Properties: &armsql.ServerProperties{ - // AdministratorLogin: to.Ptr("dummylogin"), - // Administrators: &armsql.ServerExternalAdministrator{ - // AzureADOnlyAuthentication: to.Ptr(true), - // Login: to.Ptr("bob@contoso.com"), - // PrincipalType: to.Ptr(armsql.PrincipalTypeUser), - // Sid: to.Ptr("00000011-1111-2222-2222-123456789111"), - // TenantID: to.Ptr("00000011-1111-2222-2222-123456789111"), - // }, - // FullyQualifiedDomainName: to.Ptr("sqlcrudtest-6661.database.windows.net"), - // PrivateEndpointConnections: []*armsql.ServerPrivateEndpointConnection{ - // { - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/sqlcrudtest-7398/providers/Microsoft.Sql/servers/sqlcrudtest-4645/privateEndpointConnections/private-endpoint-name-00000000-1111-2222-3333-444444444444"), - // Properties: &armsql.PrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armsql.PrivateEndpointProperty{ - // ID: to.Ptr("/subscriptions/55555555-6666-7777-8888-999999999999/resourceGroups/Default-Network/providers/Microsoft.Network/privateEndpoints/private-endpoint-name"), - // }, - // PrivateLinkServiceConnectionState: &armsql.PrivateLinkServiceConnectionStateProperty{ - // Description: to.Ptr("Auto-approved"), - // ActionsRequired: to.Ptr(armsql.PrivateLinkServiceConnectionStateActionsRequireNone), - // Status: to.Ptr(armsql.PrivateLinkServiceConnectionStateStatusApproved), - // }, - // ProvisioningState: to.Ptr(armsql.PrivateEndpointProvisioningState("Succeeded")), - // }, - // }}, - // PublicNetworkAccess: to.Ptr(armsql.ServerNetworkAccessFlagEnabled), - // RestrictOutboundNetworkAccess: to.Ptr(armsql.ServerNetworkAccessFlagEnabled), - // State: to.Ptr("Ready"), - // Version: to.Ptr("12.0"), - // WorkspaceFeature: to.Ptr(armsql.ServerWorkspaceFeatureConnected), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/ServerGet.json -func ExampleServersClient_Get_getServer() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewServersClient().Get(ctx, "sqlcrudtest-7398", "sqlcrudtest-4645", &armsql.ServersClientGetOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Server = armsql.Server{ - // Name: to.Ptr("sqlcrudtest-4645"), - // Type: to.Ptr("Microsoft.Sql/servers"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/sqlcrudtest-7398/providers/Microsoft.Sql/servers/sqlcrudtest-4645"), - // Location: to.Ptr("japaneast"), - // Tags: map[string]*string{ - // "tagKey1": to.Ptr("TagValue1"), - // }, - // Kind: to.Ptr("v12.0"), - // Properties: &armsql.ServerProperties{ - // AdministratorLogin: to.Ptr("dummylogin"), - // FullyQualifiedDomainName: to.Ptr("sqlcrudtest-4645.database.windows.net"), - // PrivateEndpointConnections: []*armsql.ServerPrivateEndpointConnection{ - // { - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/sqlcrudtest-7398/providers/Microsoft.Sql/servers/sqlcrudtest-4645/privateEndpointConnections/private-endpoint-name-00000000-1111-2222-3333-444444444444"), - // Properties: &armsql.PrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armsql.PrivateEndpointProperty{ - // ID: to.Ptr("/subscriptions/55555555-6666-7777-8888-999999999999/resourceGroups/Default-Network/providers/Microsoft.Network/privateEndpoints/private-endpoint-name"), - // }, - // PrivateLinkServiceConnectionState: &armsql.PrivateLinkServiceConnectionStateProperty{ - // Description: to.Ptr("Auto-approved"), - // ActionsRequired: to.Ptr(armsql.PrivateLinkServiceConnectionStateActionsRequireNone), - // Status: to.Ptr(armsql.PrivateLinkServiceConnectionStateStatusApproved), - // }, - // ProvisioningState: to.Ptr(armsql.PrivateEndpointProvisioningState("Succeeded")), - // }, - // }}, - // PublicNetworkAccess: to.Ptr(armsql.ServerNetworkAccessFlagEnabled), - // RestrictOutboundNetworkAccess: to.Ptr(armsql.ServerNetworkAccessFlagEnabled), - // State: to.Ptr("Ready"), - // Version: to.Ptr("12.0"), - // WorkspaceFeature: to.Ptr(armsql.ServerWorkspaceFeatureConnected), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/ServerGetWithExpandEqualsAdministrators.json -func ExampleServersClient_Get_getServerWithExpandAdministrators() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewServersClient().Get(ctx, "sqlcrudtest-7398", "sqlcrudtest-4645", &armsql.ServersClientGetOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Server = armsql.Server{ - // Name: to.Ptr("sqlcrudtest-4645"), - // Type: to.Ptr("Microsoft.Sql/servers"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/sqlcrudtest-7398/providers/Microsoft.Sql/servers/sqlcrudtest-4645"), - // Location: to.Ptr("japaneast"), - // Tags: map[string]*string{ - // "tagKey1": to.Ptr("TagValue1"), - // }, - // Kind: to.Ptr("v12.0"), - // Properties: &armsql.ServerProperties{ - // AdministratorLogin: to.Ptr("dummylogin"), - // Administrators: &armsql.ServerExternalAdministrator{ - // AzureADOnlyAuthentication: to.Ptr(true), - // Login: to.Ptr("bob@contoso.com"), - // PrincipalType: to.Ptr(armsql.PrincipalTypeUser), - // Sid: to.Ptr("00000011-1111-2222-2222-123456789111"), - // TenantID: to.Ptr("00000011-1111-2222-2222-123456789111"), - // }, - // FullyQualifiedDomainName: to.Ptr("sqlcrudtest-4645.database.windows.net"), - // PrivateEndpointConnections: []*armsql.ServerPrivateEndpointConnection{ - // { - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/sqlcrudtest-7398/providers/Microsoft.Sql/servers/sqlcrudtest-4645/privateEndpointConnections/private-endpoint-name-00000000-1111-2222-3333-444444444444"), - // Properties: &armsql.PrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armsql.PrivateEndpointProperty{ - // ID: to.Ptr("/subscriptions/55555555-6666-7777-8888-999999999999/resourceGroups/Default-Network/providers/Microsoft.Network/privateEndpoints/private-endpoint-name"), - // }, - // PrivateLinkServiceConnectionState: &armsql.PrivateLinkServiceConnectionStateProperty{ - // Description: to.Ptr("Auto-approved"), - // ActionsRequired: to.Ptr(armsql.PrivateLinkServiceConnectionStateActionsRequireNone), - // Status: to.Ptr(armsql.PrivateLinkServiceConnectionStateStatusApproved), - // }, - // ProvisioningState: to.Ptr(armsql.PrivateEndpointProvisioningState("Succeeded")), - // }, - // }}, - // PublicNetworkAccess: to.Ptr(armsql.ServerNetworkAccessFlagEnabled), - // RestrictOutboundNetworkAccess: to.Ptr(armsql.ServerNetworkAccessFlagEnabled), - // State: to.Ptr("Ready"), - // Version: to.Ptr("12.0"), - // WorkspaceFeature: to.Ptr(armsql.ServerWorkspaceFeatureConnected), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/ServerCreate.json -func ExampleServersClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewServersClient().BeginCreateOrUpdate(ctx, "sqlcrudtest-7398", "sqlcrudtest-4645", armsql.Server{ - Location: to.Ptr("Japan East"), - Properties: &armsql.ServerProperties{ - AdministratorLogin: to.Ptr("dummylogin"), - AdministratorLoginPassword: to.Ptr("PLACEHOLDER"), - Administrators: &armsql.ServerExternalAdministrator{ - AzureADOnlyAuthentication: to.Ptr(true), - Login: to.Ptr("bob@contoso.com"), - PrincipalType: to.Ptr(armsql.PrincipalTypeUser), - Sid: to.Ptr("00000011-1111-2222-2222-123456789111"), - TenantID: to.Ptr("00000011-1111-2222-2222-123456789111"), - }, - PublicNetworkAccess: to.Ptr(armsql.ServerNetworkAccessFlagEnabled), - RestrictOutboundNetworkAccess: to.Ptr(armsql.ServerNetworkAccessFlagEnabled), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Server = armsql.Server{ - // Name: to.Ptr("sqlcrudtest-4645"), - // Type: to.Ptr("Microsoft.Sql/servers"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/sqlcrudtest-7398/providers/Microsoft.Sql/servers/sqlcrudtest-4645"), - // Location: to.Ptr("japaneast"), - // Kind: to.Ptr("v12.0"), - // Properties: &armsql.ServerProperties{ - // AdministratorLogin: to.Ptr("dummylogin"), - // Administrators: &armsql.ServerExternalAdministrator{ - // AzureADOnlyAuthentication: to.Ptr(true), - // Login: to.Ptr("bob@contoso.com"), - // PrincipalType: to.Ptr(armsql.PrincipalTypeUser), - // Sid: to.Ptr("00000011-1111-2222-2222-123456789111"), - // TenantID: to.Ptr("00000011-1111-2222-2222-123456789111"), - // }, - // FullyQualifiedDomainName: to.Ptr("sqlcrudtest-4645.database.windows.net"), - // PrivateEndpointConnections: []*armsql.ServerPrivateEndpointConnection{ - // { - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/sqlcrudtest-7398/providers/Microsoft.Sql/servers/sqlcrudtest-4645/privateEndpointConnections/private-endpoint-name-00000000-1111-2222-3333-444444444444"), - // Properties: &armsql.PrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armsql.PrivateEndpointProperty{ - // ID: to.Ptr("/subscriptions/55555555-6666-7777-8888-999999999999/resourceGroups/Default-Network/providers/Microsoft.Network/privateEndpoints/private-endpoint-name"), - // }, - // PrivateLinkServiceConnectionState: &armsql.PrivateLinkServiceConnectionStateProperty{ - // Description: to.Ptr("Auto-approved"), - // ActionsRequired: to.Ptr(armsql.PrivateLinkServiceConnectionStateActionsRequireNone), - // Status: to.Ptr(armsql.PrivateLinkServiceConnectionStateStatusApproved), - // }, - // ProvisioningState: to.Ptr(armsql.PrivateEndpointProvisioningState("Succeeded")), - // }, - // }}, - // PublicNetworkAccess: to.Ptr(armsql.ServerNetworkAccessFlagEnabled), - // RestrictOutboundNetworkAccess: to.Ptr(armsql.ServerNetworkAccessFlagEnabled), - // State: to.Ptr("Ready"), - // Version: to.Ptr("12.0"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/ServerDelete.json -func ExampleServersClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewServersClient().BeginDelete(ctx, "sqlcrudtest-7398", "sqlcrudtest-6661", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/ServerUpdate.json -func ExampleServersClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewServersClient().BeginUpdate(ctx, "sqlcrudtest-7398", "sqlcrudtest-4645", armsql.ServerUpdate{ - Properties: &armsql.ServerProperties{ - AdministratorLogin: to.Ptr("dummylogin"), - AdministratorLoginPassword: to.Ptr("placeholder"), - PublicNetworkAccess: to.Ptr(armsql.ServerNetworkAccessFlagDisabled), - RestrictOutboundNetworkAccess: to.Ptr(armsql.ServerNetworkAccessFlagEnabled), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Server = armsql.Server{ - // Name: to.Ptr("sqlcrudtest-4645"), - // Type: to.Ptr("Microsoft.Sql/servers"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/sqlcrudtest-7398/providers/Microsoft.Sql/servers/sqlcrudtest-4645"), - // Location: to.Ptr("japaneast"), - // Tags: map[string]*string{ - // "tagKey1": to.Ptr("TagValue1"), - // }, - // Kind: to.Ptr("v12.0"), - // Properties: &armsql.ServerProperties{ - // AdministratorLogin: to.Ptr("dummylogin"), - // FullyQualifiedDomainName: to.Ptr("sqlcrudtest-4645.database.windows.net"), - // PrivateEndpointConnections: []*armsql.ServerPrivateEndpointConnection{ - // { - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/sqlcrudtest-7398/providers/Microsoft.Sql/servers/sqlcrudtest-4645/privateEndpointConnections/private-endpoint-name-00000000-1111-2222-3333-444444444444"), - // Properties: &armsql.PrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armsql.PrivateEndpointProperty{ - // ID: to.Ptr("/subscriptions/55555555-6666-7777-8888-999999999999/resourceGroups/Default-Network/providers/Microsoft.Network/privateEndpoints/private-endpoint-name"), - // }, - // PrivateLinkServiceConnectionState: &armsql.PrivateLinkServiceConnectionStateProperty{ - // Description: to.Ptr("Auto-approved"), - // ActionsRequired: to.Ptr(armsql.PrivateLinkServiceConnectionStateActionsRequireNone), - // Status: to.Ptr(armsql.PrivateLinkServiceConnectionStateStatusApproved), - // }, - // ProvisioningState: to.Ptr(armsql.PrivateEndpointProvisioningState("Succeeded")), - // }, - // }}, - // PublicNetworkAccess: to.Ptr(armsql.ServerNetworkAccessFlagDisabled), - // RestrictOutboundNetworkAccess: to.Ptr(armsql.ServerNetworkAccessFlagEnabled), - // State: to.Ptr("Ready"), - // Version: to.Ptr("12.0"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/ServerList.json -func ExampleServersClient_NewListPager_listServers() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewServersClient().NewListPager(&armsql.ServersClientListOptions{Expand: nil}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ServerListResult = armsql.ServerListResult{ - // Value: []*armsql.Server{ - // { - // Name: to.Ptr("sqlcrudtest-4645"), - // Type: to.Ptr("Microsoft.Sql/servers"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/sqlcrudtest-7398/providers/Microsoft.Sql/servers/sqlcrudtest-4645"), - // Location: to.Ptr("japaneast"), - // Kind: to.Ptr("v12.0"), - // Properties: &armsql.ServerProperties{ - // AdministratorLogin: to.Ptr("dummylogin"), - // FullyQualifiedDomainName: to.Ptr("sqlcrudtest-4645.database.windows.net"), - // PrivateEndpointConnections: []*armsql.ServerPrivateEndpointConnection{ - // { - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/sqlcrudtest-7398/providers/Microsoft.Sql/servers/sqlcrudtest-4645/privateEndpointConnections/private-endpoint-name-00000000-1111-2222-3333-444444444444"), - // Properties: &armsql.PrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armsql.PrivateEndpointProperty{ - // ID: to.Ptr("/subscriptions/55555555-6666-7777-8888-999999999999/resourceGroups/Default-Network/providers/Microsoft.Network/privateEndpoints/private-endpoint-name"), - // }, - // PrivateLinkServiceConnectionState: &armsql.PrivateLinkServiceConnectionStateProperty{ - // Description: to.Ptr("Auto-approved"), - // ActionsRequired: to.Ptr(armsql.PrivateLinkServiceConnectionStateActionsRequireNone), - // Status: to.Ptr(armsql.PrivateLinkServiceConnectionStateStatusApproved), - // }, - // ProvisioningState: to.Ptr(armsql.PrivateEndpointProvisioningState("Succeeded")), - // }, - // }}, - // PublicNetworkAccess: to.Ptr(armsql.ServerNetworkAccessFlagEnabled), - // RestrictOutboundNetworkAccess: to.Ptr(armsql.ServerNetworkAccessFlagEnabled), - // State: to.Ptr("Ready"), - // Version: to.Ptr("12.0"), - // WorkspaceFeature: to.Ptr(armsql.ServerWorkspaceFeatureConnected), - // }, - // }, - // { - // Name: to.Ptr("sqlcrudtest-6661"), - // Type: to.Ptr("Microsoft.Sql/servers"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/sqlcrudtest-7398/providers/Microsoft.Sql/servers/sqlcrudtest-6661"), - // Location: to.Ptr("japaneast"), - // Kind: to.Ptr("v12.0"), - // Properties: &armsql.ServerProperties{ - // AdministratorLogin: to.Ptr("dummylogin"), - // FullyQualifiedDomainName: to.Ptr("sqlcrudtest-6661.database.windows.net"), - // PrivateEndpointConnections: []*armsql.ServerPrivateEndpointConnection{ - // { - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/sqlcrudtest-7398/providers/Microsoft.Sql/servers/sqlcrudtest-4645/privateEndpointConnections/private-endpoint-name-00000000-1111-2222-3333-444444444444"), - // Properties: &armsql.PrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armsql.PrivateEndpointProperty{ - // ID: to.Ptr("/subscriptions/55555555-6666-7777-8888-999999999999/resourceGroups/Default-Network/providers/Microsoft.Network/privateEndpoints/private-endpoint-name"), - // }, - // PrivateLinkServiceConnectionState: &armsql.PrivateLinkServiceConnectionStateProperty{ - // Description: to.Ptr("Auto-approved"), - // ActionsRequired: to.Ptr(armsql.PrivateLinkServiceConnectionStateActionsRequireNone), - // Status: to.Ptr(armsql.PrivateLinkServiceConnectionStateStatusApproved), - // }, - // ProvisioningState: to.Ptr(armsql.PrivateEndpointProvisioningState("Succeeded")), - // }, - // }}, - // PublicNetworkAccess: to.Ptr(armsql.ServerNetworkAccessFlagEnabled), - // RestrictOutboundNetworkAccess: to.Ptr(armsql.ServerNetworkAccessFlagEnabled), - // State: to.Ptr("Ready"), - // Version: to.Ptr("12.0"), - // WorkspaceFeature: to.Ptr(armsql.ServerWorkspaceFeatureConnected), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/ServerListWithExpandEqualsAdministrators.json -func ExampleServersClient_NewListPager_listServersWithExpandEqualsAdministrators() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewServersClient().NewListPager(&armsql.ServersClientListOptions{Expand: nil}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ServerListResult = armsql.ServerListResult{ - // Value: []*armsql.Server{ - // { - // Name: to.Ptr("sqlcrudtest-4645"), - // Type: to.Ptr("Microsoft.Sql/servers"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/sqlcrudtest-7398/providers/Microsoft.Sql/servers/sqlcrudtest-4645"), - // Location: to.Ptr("japaneast"), - // Kind: to.Ptr("v12.0"), - // Properties: &armsql.ServerProperties{ - // AdministratorLogin: to.Ptr("dummylogin"), - // Administrators: &armsql.ServerExternalAdministrator{ - // AzureADOnlyAuthentication: to.Ptr(true), - // Login: to.Ptr("bob@contoso.com"), - // PrincipalType: to.Ptr(armsql.PrincipalTypeUser), - // Sid: to.Ptr("00000011-1111-2222-2222-123456789111"), - // TenantID: to.Ptr("00000011-1111-2222-2222-123456789111"), - // }, - // FullyQualifiedDomainName: to.Ptr("sqlcrudtest-4645.database.windows.net"), - // PrivateEndpointConnections: []*armsql.ServerPrivateEndpointConnection{ - // { - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/sqlcrudtest-7398/providers/Microsoft.Sql/servers/sqlcrudtest-4645/privateEndpointConnections/private-endpoint-name-00000000-1111-2222-3333-444444444444"), - // Properties: &armsql.PrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armsql.PrivateEndpointProperty{ - // ID: to.Ptr("/subscriptions/55555555-6666-7777-8888-999999999999/resourceGroups/Default-Network/providers/Microsoft.Network/privateEndpoints/private-endpoint-name"), - // }, - // PrivateLinkServiceConnectionState: &armsql.PrivateLinkServiceConnectionStateProperty{ - // Description: to.Ptr("Auto-approved"), - // ActionsRequired: to.Ptr(armsql.PrivateLinkServiceConnectionStateActionsRequireNone), - // Status: to.Ptr(armsql.PrivateLinkServiceConnectionStateStatusApproved), - // }, - // ProvisioningState: to.Ptr(armsql.PrivateEndpointProvisioningState("Succeeded")), - // }, - // }}, - // PublicNetworkAccess: to.Ptr(armsql.ServerNetworkAccessFlagEnabled), - // RestrictOutboundNetworkAccess: to.Ptr(armsql.ServerNetworkAccessFlagEnabled), - // State: to.Ptr("Ready"), - // Version: to.Ptr("12.0"), - // WorkspaceFeature: to.Ptr(armsql.ServerWorkspaceFeatureConnected), - // }, - // }, - // { - // Name: to.Ptr("sqlcrudtest-6661"), - // Type: to.Ptr("Microsoft.Sql/servers"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/sqlcrudtest-7398/providers/Microsoft.Sql/servers/sqlcrudtest-6661"), - // Location: to.Ptr("japaneast"), - // Kind: to.Ptr("v12.0"), - // Properties: &armsql.ServerProperties{ - // AdministratorLogin: to.Ptr("dummylogin"), - // Administrators: &armsql.ServerExternalAdministrator{ - // AzureADOnlyAuthentication: to.Ptr(true), - // Login: to.Ptr("bob@contoso.com"), - // PrincipalType: to.Ptr(armsql.PrincipalTypeUser), - // Sid: to.Ptr("00000011-1111-2222-2222-123456789111"), - // TenantID: to.Ptr("00000011-1111-2222-2222-123456789111"), - // }, - // FullyQualifiedDomainName: to.Ptr("sqlcrudtest-6661.database.windows.net"), - // PrivateEndpointConnections: []*armsql.ServerPrivateEndpointConnection{ - // { - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/sqlcrudtest-7398/providers/Microsoft.Sql/servers/sqlcrudtest-4645/privateEndpointConnections/private-endpoint-name-00000000-1111-2222-3333-444444444444"), - // Properties: &armsql.PrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armsql.PrivateEndpointProperty{ - // ID: to.Ptr("/subscriptions/55555555-6666-7777-8888-999999999999/resourceGroups/Default-Network/providers/Microsoft.Network/privateEndpoints/private-endpoint-name"), - // }, - // PrivateLinkServiceConnectionState: &armsql.PrivateLinkServiceConnectionStateProperty{ - // Description: to.Ptr("Auto-approved"), - // ActionsRequired: to.Ptr(armsql.PrivateLinkServiceConnectionStateActionsRequireNone), - // Status: to.Ptr(armsql.PrivateLinkServiceConnectionStateStatusApproved), - // }, - // ProvisioningState: to.Ptr(armsql.PrivateEndpointProvisioningState("Succeeded")), - // }, - // }}, - // PublicNetworkAccess: to.Ptr(armsql.ServerNetworkAccessFlagEnabled), - // RestrictOutboundNetworkAccess: to.Ptr(armsql.ServerNetworkAccessFlagEnabled), - // State: to.Ptr("Ready"), - // Version: to.Ptr("12.0"), - // WorkspaceFeature: to.Ptr(armsql.ServerWorkspaceFeatureConnected), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/ImportNewDatabaseWithNetworkIsolation.json -func ExampleServersClient_BeginImportDatabase_importsToANewDatabaseUsingPrivateLinkForTheSqlServerAndStorageAccount() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewServersClient().BeginImportDatabase(ctx, "Default-SQL-SouthEastAsia", "testsvr", armsql.ImportNewDatabaseDefinition{ - AdministratorLogin: to.Ptr("login"), - AdministratorLoginPassword: to.Ptr("password"), - AuthenticationType: to.Ptr("Sql"), - DatabaseName: to.Ptr("testdb"), - NetworkIsolation: &armsql.NetworkIsolationSettings{ - SQLServerResourceID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/servers/testsvr"), - StorageAccountResourceID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Storage/storageAccounts/test-privatelink"), - }, - StorageKey: to.Ptr("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx=="), - StorageKeyType: to.Ptr(armsql.StorageKeyTypeStorageAccessKey), - StorageURI: to.Ptr("https://test.blob.core.windows.net/test.bacpac"), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ImportExportOperationResult = armsql.ImportExportOperationResult{ - // Name: to.Ptr("9d9a794a-5cec-4f23-af70-d29511b522a4"), - // Type: to.Ptr("Microsoft.Sql/servers/databases/importExportOperationResults"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/servers/testsvr/databases/testdb/importExportOperationResults/9d9a794a-5cec-4f23-af70-d29511b522a4"), - // Properties: &armsql.ImportExportOperationResultProperties{ - // BlobURI: to.Ptr("https://test.blob.core.windows.net/test.bacpac"), - // DatabaseName: to.Ptr("testdb"), - // LastModifiedTime: to.Ptr("2/2/2020 8:34:47 PM"), - // QueuedTime: to.Ptr("2/2/2020 8:33:27 PM"), - // RequestID: to.Ptr("9d9a794a-5cec-4f23-af70-d29511b522a4"), - // RequestType: to.Ptr("Import"), - // ServerName: to.Ptr("testsvr.database.windows.net"), - // Status: to.Ptr("Completed"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/ImportNewDatabase.json -func ExampleServersClient_BeginImportDatabase_importsToANewDatabase() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewServersClient().BeginImportDatabase(ctx, "Default-SQL-SouthEastAsia", "testsvr", armsql.ImportNewDatabaseDefinition{ - AdministratorLogin: to.Ptr("login"), - AdministratorLoginPassword: to.Ptr("password"), - AuthenticationType: to.Ptr("Sql"), - DatabaseName: to.Ptr("testdb"), - StorageKey: to.Ptr("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx=="), - StorageKeyType: to.Ptr(armsql.StorageKeyTypeStorageAccessKey), - StorageURI: to.Ptr("https://test.blob.core.windows.net/test.bacpac"), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ImportExportOperationResult = armsql.ImportExportOperationResult{ - // Name: to.Ptr("9d9a794a-5cec-4f23-af70-d29511b522a4"), - // Type: to.Ptr("Microsoft.Sql/servers/databases/importExportOperationResults"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/servers/testsvr/databases/testdb/importExportOperationResults/9d9a794a-5cec-4f23-af70-d29511b522a4"), - // Properties: &armsql.ImportExportOperationResultProperties{ - // BlobURI: to.Ptr("https://test.blob.core.windows.net/test.bacpac"), - // DatabaseName: to.Ptr("testdb"), - // LastModifiedTime: to.Ptr("2/2/2020 8:34:47 PM"), - // QueuedTime: to.Ptr("2/2/2020 8:33:27 PM"), - // RequestID: to.Ptr("9d9a794a-5cec-4f23-af70-d29511b522a4"), - // RequestType: to.Ptr("Import"), - // ServerName: to.Ptr("testsvr.database.windows.net"), - // Status: to.Ptr("Completed"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/CheckNameAvailabilityServerAlreadyExists.json -func ExampleServersClient_CheckNameAvailability_checkForAServerNameThatAlreadyExists() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewServersClient().CheckNameAvailability(ctx, armsql.CheckNameAvailabilityRequest{ - Name: to.Ptr("server1"), - Type: to.Ptr("Microsoft.Sql/servers"), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.CheckNameAvailabilityResponse = armsql.CheckNameAvailabilityResponse{ - // Name: to.Ptr("server1"), - // Available: to.Ptr(false), - // Message: to.Ptr("Specified server name is already used"), - // Reason: to.Ptr(armsql.CheckNameAvailabilityReasonAlreadyExists), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/CheckNameAvailabilityServerAvailable.json -func ExampleServersClient_CheckNameAvailability_checkForAServerNameThatIsAvailable() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewServersClient().CheckNameAvailability(ctx, armsql.CheckNameAvailabilityRequest{ - Name: to.Ptr("server1"), - Type: to.Ptr("Microsoft.Sql/servers"), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.CheckNameAvailabilityResponse = armsql.CheckNameAvailabilityResponse{ - // Name: to.Ptr("server1"), - // Available: to.Ptr(true), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/CheckNameAvailabilityServerInvalid.json -func ExampleServersClient_CheckNameAvailability_checkForAServerNameThatIsInvalid() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewServersClient().CheckNameAvailability(ctx, armsql.CheckNameAvailabilityRequest{ - Name: to.Ptr("SERVER1"), - Type: to.Ptr("Microsoft.Sql/servers"), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.CheckNameAvailabilityResponse = armsql.CheckNameAvailabilityResponse{ - // Name: to.Ptr("SERVER1"), - // Available: to.Ptr(false), - // Message: to.Ptr("Specified server name contains unsupported characters or is too long. Server name must be no longer than 63 characters long, contain only lower-case characters or digits, cannot contain '.' or '_' characters and can't start or end with '-' character."), - // Reason: to.Ptr(armsql.CheckNameAvailabilityReasonInvalid), - // } -} diff --git a/sdk/resourcemanager/sql/armsql/serversecurityalertpolicies_client.go b/sdk/resourcemanager/sql/armsql/serversecurityalertpolicies_client.go index 93d32cc490c0..6bc1426dd40a 100644 --- a/sdk/resourcemanager/sql/armsql/serversecurityalertpolicies_client.go +++ b/sdk/resourcemanager/sql/armsql/serversecurityalertpolicies_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armsql @@ -47,7 +46,7 @@ func NewServerSecurityAlertPoliciesClient(subscriptionID string, credential azco // BeginCreateOrUpdate - Creates or updates a threat detection policy. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -55,13 +54,14 @@ func NewServerSecurityAlertPoliciesClient(subscriptionID string, credential azco // - parameters - The server security alert policy. // - options - ServerSecurityAlertPoliciesClientBeginCreateOrUpdateOptions contains the optional parameters for the ServerSecurityAlertPoliciesClient.BeginCreateOrUpdate // method. -func (client *ServerSecurityAlertPoliciesClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, securityAlertPolicyName SecurityAlertPolicyName, parameters ServerSecurityAlertPolicy, options *ServerSecurityAlertPoliciesClientBeginCreateOrUpdateOptions) (*runtime.Poller[ServerSecurityAlertPoliciesClientCreateOrUpdateResponse], error) { +func (client *ServerSecurityAlertPoliciesClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, securityAlertPolicyName SecurityAlertPolicyNameAutoGenerated, parameters ServerSecurityAlertPolicy, options *ServerSecurityAlertPoliciesClientBeginCreateOrUpdateOptions) (*runtime.Poller[ServerSecurityAlertPoliciesClientCreateOrUpdateResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.createOrUpdate(ctx, resourceGroupName, serverName, securityAlertPolicyName, parameters, options) if err != nil { return nil, err } - return runtime.NewPoller[ServerSecurityAlertPoliciesClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[ServerSecurityAlertPoliciesClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[ServerSecurityAlertPoliciesClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -70,24 +70,26 @@ func (client *ServerSecurityAlertPoliciesClient) BeginCreateOrUpdate(ctx context // CreateOrUpdate - Creates or updates a threat detection policy. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview -func (client *ServerSecurityAlertPoliciesClient) createOrUpdate(ctx context.Context, resourceGroupName string, serverName string, securityAlertPolicyName SecurityAlertPolicyName, parameters ServerSecurityAlertPolicy, options *ServerSecurityAlertPoliciesClientBeginCreateOrUpdateOptions) (*http.Response, error) { +// Generated from API version 2022-11-01-preview +func (client *ServerSecurityAlertPoliciesClient) createOrUpdate(ctx context.Context, resourceGroupName string, serverName string, securityAlertPolicyName SecurityAlertPolicyNameAutoGenerated, parameters ServerSecurityAlertPolicy, options *ServerSecurityAlertPoliciesClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, serverName, securityAlertPolicyName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *ServerSecurityAlertPoliciesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, serverName string, securityAlertPolicyName SecurityAlertPolicyName, parameters ServerSecurityAlertPolicy, options *ServerSecurityAlertPoliciesClientBeginCreateOrUpdateOptions) (*policy.Request, error) { +func (client *ServerSecurityAlertPoliciesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, serverName string, securityAlertPolicyName SecurityAlertPolicyNameAutoGenerated, parameters ServerSecurityAlertPolicy, options *ServerSecurityAlertPoliciesClientBeginCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/securityAlertPolicies/{securityAlertPolicyName}" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -110,39 +112,45 @@ func (client *ServerSecurityAlertPoliciesClient) createOrUpdateCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // Get - Get a server's security alert policy. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. // - securityAlertPolicyName - The name of the security alert policy. // - options - ServerSecurityAlertPoliciesClientGetOptions contains the optional parameters for the ServerSecurityAlertPoliciesClient.Get // method. -func (client *ServerSecurityAlertPoliciesClient) Get(ctx context.Context, resourceGroupName string, serverName string, securityAlertPolicyName SecurityAlertPolicyName, options *ServerSecurityAlertPoliciesClientGetOptions) (ServerSecurityAlertPoliciesClientGetResponse, error) { +func (client *ServerSecurityAlertPoliciesClient) Get(ctx context.Context, resourceGroupName string, serverName string, securityAlertPolicyName SecurityAlertPolicyNameAutoGenerated, options *ServerSecurityAlertPoliciesClientGetOptions) (ServerSecurityAlertPoliciesClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, serverName, securityAlertPolicyName, options) if err != nil { return ServerSecurityAlertPoliciesClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ServerSecurityAlertPoliciesClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ServerSecurityAlertPoliciesClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ServerSecurityAlertPoliciesClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. -func (client *ServerSecurityAlertPoliciesClient) getCreateRequest(ctx context.Context, resourceGroupName string, serverName string, securityAlertPolicyName SecurityAlertPolicyName, options *ServerSecurityAlertPoliciesClientGetOptions) (*policy.Request, error) { +func (client *ServerSecurityAlertPoliciesClient) getCreateRequest(ctx context.Context, resourceGroupName string, serverName string, securityAlertPolicyName SecurityAlertPolicyNameAutoGenerated, options *ServerSecurityAlertPoliciesClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/securityAlertPolicies/{securityAlertPolicyName}" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -165,7 +173,7 @@ func (client *ServerSecurityAlertPoliciesClient) getCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -182,7 +190,7 @@ func (client *ServerSecurityAlertPoliciesClient) getHandleResponse(resp *http.Re // NewListByServerPager - Get the server's threat detection policies. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -236,7 +244,7 @@ func (client *ServerSecurityAlertPoliciesClient) listByServerCreateRequest(ctx c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/sql/armsql/serversecurityalertpolicies_client_example_test.go b/sdk/resourcemanager/sql/armsql/serversecurityalertpolicies_client_example_test.go deleted file mode 100644 index 20d4afb0649b..000000000000 --- a/sdk/resourcemanager/sql/armsql/serversecurityalertpolicies_client_example_test.go +++ /dev/null @@ -1,231 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsql_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sql/armsql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerSecurityAlertsGet.json -func ExampleServerSecurityAlertPoliciesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewServerSecurityAlertPoliciesClient().Get(ctx, "securityalert-4799", "securityalert-6440", armsql.SecurityAlertPolicyNameDefault, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ServerSecurityAlertPolicy = armsql.ServerSecurityAlertPolicy{ - // Name: to.Ptr("Default"), - // Type: to.Ptr("Microsoft.Sql/servers/securityAlertPolicies"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/securityalert-4799/providers/Microsoft.Sql/servers/securityalert-6440/securityAlertPolicies/default"), - // Properties: &armsql.SecurityAlertsPolicyProperties{ - // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-04-03T04:41:33.937Z"); return t}()), - // DisabledAlerts: []*string{ - // to.Ptr("Access_Anomaly")}, - // EmailAccountAdmins: to.Ptr(true), - // EmailAddresses: []*string{ - // to.Ptr("test@consoto.com;user@consoto.com")}, - // RetentionDays: to.Ptr[int32](0), - // State: to.Ptr(armsql.SecurityAlertsPolicyStateEnabled), - // StorageAccountAccessKey: to.Ptr(""), - // StorageEndpoint: to.Ptr("https://mystorage.blob.core.windows.net"), - // }, - // SystemData: &armsql.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-04-03T04:41:33.937Z"); return t}()), - // CreatedBy: to.Ptr("string"), - // CreatedByType: to.Ptr(armsql.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-04-03T04:41:33.937Z"); return t}()), - // LastModifiedBy: to.Ptr("string"), - // LastModifiedByType: to.Ptr(armsql.CreatedByTypeUser), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerSecurityAlertsCreateMax.json -func ExampleServerSecurityAlertPoliciesClient_BeginCreateOrUpdate_updateAServersThreatDetectionPolicyWithAllParameters() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewServerSecurityAlertPoliciesClient().BeginCreateOrUpdate(ctx, "securityalert-4799", "securityalert-6440", armsql.SecurityAlertPolicyNameDefault, armsql.ServerSecurityAlertPolicy{ - Properties: &armsql.SecurityAlertsPolicyProperties{ - DisabledAlerts: []*string{ - to.Ptr("Access_Anomaly"), - to.Ptr("Usage_Anomaly")}, - EmailAccountAdmins: to.Ptr(true), - EmailAddresses: []*string{ - to.Ptr("testSecurityAlert@microsoft.com")}, - RetentionDays: to.Ptr[int32](5), - State: to.Ptr(armsql.SecurityAlertsPolicyStateEnabled), - StorageAccountAccessKey: to.Ptr("sdlfkjabc+sdlfkjsdlkfsjdfLDKFTERLKFDFKLjsdfksjdflsdkfD2342309432849328476458/3RSD=="), - StorageEndpoint: to.Ptr("https://mystorage.blob.core.windows.net"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ServerSecurityAlertPolicy = armsql.ServerSecurityAlertPolicy{ - // Name: to.Ptr("Default"), - // Type: to.Ptr("Microsoft.Sql/servers/securityAlertPolicies"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/securityalert-4799/providers/Microsoft.Sql/servers/securityalert-6440/securityAlertPolicies/default"), - // Properties: &armsql.SecurityAlertsPolicyProperties{ - // DisabledAlerts: []*string{ - // to.Ptr("Access_Anomaly"), - // to.Ptr("Usage_Anomaly")}, - // EmailAccountAdmins: to.Ptr(true), - // EmailAddresses: []*string{ - // to.Ptr("testSecurityAlert@microsoft.com")}, - // RetentionDays: to.Ptr[int32](5), - // State: to.Ptr(armsql.SecurityAlertsPolicyStateEnabled), - // StorageAccountAccessKey: to.Ptr(""), - // StorageEndpoint: to.Ptr("https://mystorage.blob.core.windows.net"), - // }, - // SystemData: &armsql.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-04-03T04:41:33.937Z"); return t}()), - // CreatedBy: to.Ptr("string"), - // CreatedByType: to.Ptr(armsql.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-04-03T04:41:33.937Z"); return t}()), - // LastModifiedBy: to.Ptr("string"), - // LastModifiedByType: to.Ptr(armsql.CreatedByTypeUser), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerSecurityAlertsCreateMin.json -func ExampleServerSecurityAlertPoliciesClient_BeginCreateOrUpdate_updateAServersThreatDetectionPolicyWithMinimalParameters() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewServerSecurityAlertPoliciesClient().BeginCreateOrUpdate(ctx, "securityalert-4799", "securityalert-6440", armsql.SecurityAlertPolicyNameDefault, armsql.ServerSecurityAlertPolicy{ - Properties: &armsql.SecurityAlertsPolicyProperties{ - State: to.Ptr(armsql.SecurityAlertsPolicyStateEnabled), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ServerSecurityAlertPolicy = armsql.ServerSecurityAlertPolicy{ - // Name: to.Ptr("Default"), - // Type: to.Ptr("Microsoft.Sql/servers/securityAlertPolicies"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/securityalert-4799/providers/Microsoft.Sql/servers/securityalert-6440/securityAlertPolicies/default"), - // Properties: &armsql.SecurityAlertsPolicyProperties{ - // DisabledAlerts: []*string{ - // to.Ptr("")}, - // EmailAccountAdmins: to.Ptr(false), - // EmailAddresses: []*string{ - // to.Ptr("")}, - // RetentionDays: to.Ptr[int32](0), - // State: to.Ptr(armsql.SecurityAlertsPolicyStateEnabled), - // StorageAccountAccessKey: to.Ptr(""), - // StorageEndpoint: to.Ptr("https://mystorage.blob.core.windows.net"), - // }, - // SystemData: &armsql.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-04-03T04:41:33.937Z"); return t}()), - // CreatedBy: to.Ptr("string"), - // CreatedByType: to.Ptr(armsql.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-04-03T04:41:33.937Z"); return t}()), - // LastModifiedBy: to.Ptr("string"), - // LastModifiedByType: to.Ptr(armsql.CreatedByTypeUser), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerSecurityAlertsListByServer.json -func ExampleServerSecurityAlertPoliciesClient_NewListByServerPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewServerSecurityAlertPoliciesClient().NewListByServerPager("securityalert-4799", "securityalert-6440", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.LogicalServerSecurityAlertPolicyListResult = armsql.LogicalServerSecurityAlertPolicyListResult{ - // Value: []*armsql.ServerSecurityAlertPolicy{ - // { - // Name: to.Ptr("Default"), - // Type: to.Ptr("Microsoft.Sql/servers/securityAlertPolicies"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/securityalert-4799/providers/Microsoft.Sql/servers/securityalert-6440/securityAlertPolicies"), - // Properties: &armsql.SecurityAlertsPolicyProperties{ - // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-04-03T04:41:33.937Z"); return t}()), - // DisabledAlerts: []*string{ - // to.Ptr("Access_Anomaly")}, - // EmailAccountAdmins: to.Ptr(true), - // EmailAddresses: []*string{ - // to.Ptr("test@consoto.com;user@consoto.com")}, - // RetentionDays: to.Ptr[int32](0), - // State: to.Ptr(armsql.SecurityAlertsPolicyStateEnabled), - // StorageAccountAccessKey: to.Ptr(""), - // StorageEndpoint: to.Ptr("https://mystorage.blob.core.windows.net"), - // }, - // SystemData: &armsql.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-04-03T04:41:33.937Z"); return t}()), - // CreatedBy: to.Ptr("string"), - // CreatedByType: to.Ptr(armsql.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-04-03T04:41:33.937Z"); return t}()), - // LastModifiedBy: to.Ptr("string"), - // LastModifiedByType: to.Ptr(armsql.CreatedByTypeUser), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/sql/armsql/servertrustcertificates_client.go b/sdk/resourcemanager/sql/armsql/servertrustcertificates_client.go index 572dc78fea58..47493810af7f 100644 --- a/sdk/resourcemanager/sql/armsql/servertrustcertificates_client.go +++ b/sdk/resourcemanager/sql/armsql/servertrustcertificates_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armsql @@ -47,7 +46,7 @@ func NewServerTrustCertificatesClient(subscriptionID string, credential azcore.T // BeginCreateOrUpdate - Uploads a server trust certificate from box to Sql Managed Instance. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - managedInstanceName - The name of the managed instance. @@ -61,7 +60,8 @@ func (client *ServerTrustCertificatesClient) BeginCreateOrUpdate(ctx context.Con if err != nil { return nil, err } - return runtime.NewPoller[ServerTrustCertificatesClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[ServerTrustCertificatesClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[ServerTrustCertificatesClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -70,20 +70,22 @@ func (client *ServerTrustCertificatesClient) BeginCreateOrUpdate(ctx context.Con // CreateOrUpdate - Uploads a server trust certificate from box to Sql Managed Instance. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-11-01-preview +// Generated from API version 2022-11-01-preview func (client *ServerTrustCertificatesClient) createOrUpdate(ctx context.Context, resourceGroupName string, managedInstanceName string, certificateName string, parameters ServerTrustCertificate, options *ServerTrustCertificatesClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, managedInstanceName, certificateName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createOrUpdateCreateRequest creates the CreateOrUpdate request. @@ -110,16 +112,19 @@ func (client *ServerTrustCertificatesClient) createOrUpdateCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // BeginDelete - Deletes a server trust certificate that was uploaded from box to Sql Managed Instance. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - managedInstanceName - The name of the managed instance. @@ -132,7 +137,8 @@ func (client *ServerTrustCertificatesClient) BeginDelete(ctx context.Context, re if err != nil { return nil, err } - return runtime.NewPoller[ServerTrustCertificatesClientDeleteResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[ServerTrustCertificatesClientDeleteResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[ServerTrustCertificatesClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -141,20 +147,22 @@ func (client *ServerTrustCertificatesClient) BeginDelete(ctx context.Context, re // Delete - Deletes a server trust certificate that was uploaded from box to Sql Managed Instance. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-11-01-preview +// Generated from API version 2022-11-01-preview func (client *ServerTrustCertificatesClient) deleteOperation(ctx context.Context, resourceGroupName string, managedInstanceName string, certificateName string, options *ServerTrustCertificatesClientBeginDeleteOptions) (*http.Response, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, managedInstanceName, certificateName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteCreateRequest creates the Delete request. @@ -181,7 +189,7 @@ func (client *ServerTrustCertificatesClient) deleteCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -189,7 +197,7 @@ func (client *ServerTrustCertificatesClient) deleteCreateRequest(ctx context.Con // Get - Gets a server trust certificate that was uploaded from box to Sql Managed Instance. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - managedInstanceName - The name of the managed instance. @@ -197,18 +205,21 @@ func (client *ServerTrustCertificatesClient) deleteCreateRequest(ctx context.Con // - options - ServerTrustCertificatesClientGetOptions contains the optional parameters for the ServerTrustCertificatesClient.Get // method. func (client *ServerTrustCertificatesClient) Get(ctx context.Context, resourceGroupName string, managedInstanceName string, certificateName string, options *ServerTrustCertificatesClientGetOptions) (ServerTrustCertificatesClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, managedInstanceName, certificateName, options) if err != nil { return ServerTrustCertificatesClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ServerTrustCertificatesClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ServerTrustCertificatesClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ServerTrustCertificatesClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -235,7 +246,7 @@ func (client *ServerTrustCertificatesClient) getCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -253,7 +264,7 @@ func (client *ServerTrustCertificatesClient) getHandleResponse(resp *http.Respon // NewListByInstancePager - Gets a list of server trust certificates that were uploaded from box to the given Sql Managed // Instance. // -// Generated from API version 2021-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - managedInstanceName - The name of the managed instance. @@ -307,7 +318,7 @@ func (client *ServerTrustCertificatesClient) listByInstanceCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/sql/armsql/servertrustcertificates_client_example_test.go b/sdk/resourcemanager/sql/armsql/servertrustcertificates_client_example_test.go deleted file mode 100644 index 1283a2bb8059..000000000000 --- a/sdk/resourcemanager/sql/armsql/servertrustcertificates_client_example_test.go +++ /dev/null @@ -1,152 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsql_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sql/armsql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/ServerTrustCertificatesListByInstance.json -func ExampleServerTrustCertificatesClient_NewListByInstancePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewServerTrustCertificatesClient().NewListByInstancePager("testrg", "testcl", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ServerTrustCertificatesListResult = armsql.ServerTrustCertificatesListResult{ - // Value: []*armsql.ServerTrustCertificate{ - // { - // Name: to.Ptr("customerCertificate1"), - // Type: to.Ptr("Microsoft.Sql/managedInstances/serverTrustCertificates"), - // ID: to.Ptr("/subscriptions/38e0dc56-907f-45ba-a97c-74233baad471/resourceGroups/testrg/providers/Microsoft.Sql/managedInstances/testcl/serverTrustCertificates/customerCertificate1"), - // Properties: &armsql.ServerTrustCertificateProperties{ - // CertificateName: to.Ptr("customerCertificate1"), - // Thumbprint: to.Ptr("33702D20EC861199852837AE6BD1A71544B681E2"), - // }, - // }, - // { - // Name: to.Ptr("customerCertificate2"), - // Type: to.Ptr("Microsoft.Sql/managedInstances/serverTrustCertificates"), - // ID: to.Ptr("/subscriptions/38e0dc56-907f-45ba-a97c-74233baad471/resourceGroups/testrg/providers/Microsoft.Sql/managedInstances/testcl/serverTrustCertificates/customerCertificate2"), - // Properties: &armsql.ServerTrustCertificateProperties{ - // CertificateName: to.Ptr("customerCertificate2"), - // Thumbprint: to.Ptr("57CFA9CF16F2FB2775AF059A95C6D5B897DA2C05"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/ServerTrustCertificatesGet.json -func ExampleServerTrustCertificatesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewServerTrustCertificatesClient().Get(ctx, "testrg", "testcl", "customerCertificateName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ServerTrustCertificate = armsql.ServerTrustCertificate{ - // Name: to.Ptr("customerCertificateName"), - // Type: to.Ptr("Microsoft.Sql/managedInstances/serverTrustCertificates"), - // ID: to.Ptr("/subscriptions/38e0dc56-907f-45ba-a97c-74233baad471/resourceGroups/testrg/providers/Microsoft.Sql/managedInstances/testcl/serverTrustCertificates/customerCertificateName"), - // Properties: &armsql.ServerTrustCertificateProperties{ - // CertificateName: to.Ptr("customerCertificateName"), - // Thumbprint: to.Ptr("57CFA9CF16F2FB2775AF059A95C6D5B897DA2C05"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/ServerTrustCertificatesCreate.json -func ExampleServerTrustCertificatesClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewServerTrustCertificatesClient().BeginCreateOrUpdate(ctx, "testrg", "testcl", "customerCertificateName", armsql.ServerTrustCertificate{ - Properties: &armsql.ServerTrustCertificateProperties{ - PublicBlob: to.Ptr("308203AE30820296A0030201020210"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ServerTrustCertificate = armsql.ServerTrustCertificate{ - // Name: to.Ptr("customerCertificateName"), - // Type: to.Ptr("Microsoft.Sql/managedInstances/serverTrustCertificates"), - // ID: to.Ptr("/subscriptions/0574222d-5c7f-489c-a172-b3013eafab53/resourceGroups/testrg/providers/Microsoft.Sql/managedInstances/testcl/serverTrustCertificates/customerCertificateName"), - // Properties: &armsql.ServerTrustCertificateProperties{ - // CertificateName: to.Ptr("customerCertificateName"), - // Thumbprint: to.Ptr("33702D20EC86119985283"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/ServerTrustCertificatesDelete.json -func ExampleServerTrustCertificatesClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewServerTrustCertificatesClient().BeginDelete(ctx, "testrg", "testcl", "customerCertificateName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} diff --git a/sdk/resourcemanager/sql/armsql/servertrustgroups_client.go b/sdk/resourcemanager/sql/armsql/servertrustgroups_client.go index 8e52b16348e0..0c5acee83aea 100644 --- a/sdk/resourcemanager/sql/armsql/servertrustgroups_client.go +++ b/sdk/resourcemanager/sql/armsql/servertrustgroups_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armsql @@ -47,7 +46,7 @@ func NewServerTrustGroupsClient(subscriptionID string, credential azcore.TokenCr // BeginCreateOrUpdate - Creates or updates a server trust group. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - locationName - The name of the region where the resource is located. @@ -61,7 +60,8 @@ func (client *ServerTrustGroupsClient) BeginCreateOrUpdate(ctx context.Context, if err != nil { return nil, err } - return runtime.NewPoller[ServerTrustGroupsClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[ServerTrustGroupsClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[ServerTrustGroupsClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -70,20 +70,22 @@ func (client *ServerTrustGroupsClient) BeginCreateOrUpdate(ctx context.Context, // CreateOrUpdate - Creates or updates a server trust group. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview func (client *ServerTrustGroupsClient) createOrUpdate(ctx context.Context, resourceGroupName string, locationName string, serverTrustGroupName string, parameters ServerTrustGroup, options *ServerTrustGroupsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, locationName, serverTrustGroupName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createOrUpdateCreateRequest creates the CreateOrUpdate request. @@ -110,16 +112,19 @@ func (client *ServerTrustGroupsClient) createOrUpdateCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // BeginDelete - Deletes a server trust group. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - locationName - The name of the region where the resource is located. @@ -132,7 +137,8 @@ func (client *ServerTrustGroupsClient) BeginDelete(ctx context.Context, resource if err != nil { return nil, err } - return runtime.NewPoller[ServerTrustGroupsClientDeleteResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[ServerTrustGroupsClientDeleteResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[ServerTrustGroupsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -141,20 +147,22 @@ func (client *ServerTrustGroupsClient) BeginDelete(ctx context.Context, resource // Delete - Deletes a server trust group. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview func (client *ServerTrustGroupsClient) deleteOperation(ctx context.Context, resourceGroupName string, locationName string, serverTrustGroupName string, options *ServerTrustGroupsClientBeginDeleteOptions) (*http.Response, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, locationName, serverTrustGroupName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteCreateRequest creates the Delete request. @@ -181,7 +189,7 @@ func (client *ServerTrustGroupsClient) deleteCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -189,25 +197,28 @@ func (client *ServerTrustGroupsClient) deleteCreateRequest(ctx context.Context, // Get - Gets a server trust group. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - locationName - The name of the region where the resource is located. // - serverTrustGroupName - The name of the server trust group. // - options - ServerTrustGroupsClientGetOptions contains the optional parameters for the ServerTrustGroupsClient.Get method. func (client *ServerTrustGroupsClient) Get(ctx context.Context, resourceGroupName string, locationName string, serverTrustGroupName string, options *ServerTrustGroupsClientGetOptions) (ServerTrustGroupsClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, locationName, serverTrustGroupName, options) if err != nil { return ServerTrustGroupsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ServerTrustGroupsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ServerTrustGroupsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ServerTrustGroupsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -234,7 +245,7 @@ func (client *ServerTrustGroupsClient) getCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -251,7 +262,7 @@ func (client *ServerTrustGroupsClient) getHandleResponse(resp *http.Response) (S // NewListByInstancePager - Gets a server trust groups by instance name. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - managedInstanceName - The name of the managed instance. @@ -305,7 +316,7 @@ func (client *ServerTrustGroupsClient) listByInstanceCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -322,7 +333,7 @@ func (client *ServerTrustGroupsClient) listByInstanceHandleResponse(resp *http.R // NewListByLocationPager - Lists a server trust group. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - locationName - The name of the region where the resource is located. @@ -376,7 +387,7 @@ func (client *ServerTrustGroupsClient) listByLocationCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/sql/armsql/servertrustgroups_client_example_test.go b/sdk/resourcemanager/sql/armsql/servertrustgroups_client_example_test.go deleted file mode 100644 index aeb9b7c473ff..000000000000 --- a/sdk/resourcemanager/sql/armsql/servertrustgroups_client_example_test.go +++ /dev/null @@ -1,255 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsql_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sql/armsql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerTrustGroupGet.json -func ExampleServerTrustGroupsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewServerTrustGroupsClient().Get(ctx, "Default", "Japan East", "server-trust-group-test", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ServerTrustGroup = armsql.ServerTrustGroup{ - // Name: to.Ptr("server-trust-group-test"), - // Type: to.Ptr("Microsoft.Sql/locations/serverTrustGroups"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/locations/Japan East/serverTrustGroups/server-trust-group-test"), - // Properties: &armsql.ServerTrustGroupProperties{ - // GroupMembers: []*armsql.ServerInfo{ - // { - // ServerID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/managedInstances/managedInstance-1"), - // }, - // { - // ServerID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/managedInstances/managedInstance-2"), - // }}, - // TrustScopes: []*armsql.ServerTrustGroupPropertiesTrustScopesItem{ - // to.Ptr(armsql.ServerTrustGroupPropertiesTrustScopesItemGlobalTransactions), - // to.Ptr(armsql.ServerTrustGroupPropertiesTrustScopesItemServiceBroker)}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerTrustGroupCreate.json -func ExampleServerTrustGroupsClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewServerTrustGroupsClient().BeginCreateOrUpdate(ctx, "Default", "Japan East", "server-trust-group-test", armsql.ServerTrustGroup{ - Properties: &armsql.ServerTrustGroupProperties{ - GroupMembers: []*armsql.ServerInfo{ - { - ServerID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/managedInstances/managedInstance-1"), - }, - { - ServerID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/managedInstances/managedInstance-2"), - }}, - TrustScopes: []*armsql.ServerTrustGroupPropertiesTrustScopesItem{ - to.Ptr(armsql.ServerTrustGroupPropertiesTrustScopesItemGlobalTransactions), - to.Ptr(armsql.ServerTrustGroupPropertiesTrustScopesItemServiceBroker)}, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ServerTrustGroup = armsql.ServerTrustGroup{ - // Name: to.Ptr("server-trust-group-test"), - // Type: to.Ptr("Microsoft.Sql/locations/serverTrustGroups"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/locations/Japan East/serverTrustGroups/server-trust-group-test"), - // Properties: &armsql.ServerTrustGroupProperties{ - // GroupMembers: []*armsql.ServerInfo{ - // { - // ServerID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/managedInstances/managedInstance-1"), - // }, - // { - // ServerID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/managedInstances/managedInstance-2"), - // }}, - // TrustScopes: []*armsql.ServerTrustGroupPropertiesTrustScopesItem{ - // to.Ptr(armsql.ServerTrustGroupPropertiesTrustScopesItemGlobalTransactions), - // to.Ptr(armsql.ServerTrustGroupPropertiesTrustScopesItemServiceBroker)}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerTrustGroupDelete.json -func ExampleServerTrustGroupsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewServerTrustGroupsClient().BeginDelete(ctx, "Default", "Japan East", "server-trust-group-test", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerTrustGroupList.json -func ExampleServerTrustGroupsClient_NewListByLocationPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewServerTrustGroupsClient().NewListByLocationPager("Default", "Japan East", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ServerTrustGroupListResult = armsql.ServerTrustGroupListResult{ - // Value: []*armsql.ServerTrustGroup{ - // { - // Name: to.Ptr("server-trust-group-test"), - // Type: to.Ptr("Microsoft.Sql/locations/serverTrustGroups"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/locations/Japan East/serverTrustGroups/server-trust-group-test"), - // Properties: &armsql.ServerTrustGroupProperties{ - // GroupMembers: []*armsql.ServerInfo{ - // { - // ServerID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/managedInstances/managedInstance-1"), - // }, - // { - // ServerID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/managedInstances/managedInstance-2"), - // }}, - // TrustScopes: []*armsql.ServerTrustGroupPropertiesTrustScopesItem{ - // to.Ptr(armsql.ServerTrustGroupPropertiesTrustScopesItemGlobalTransactions), - // to.Ptr(armsql.ServerTrustGroupPropertiesTrustScopesItemServiceBroker)}, - // }, - // }, - // { - // Name: to.Ptr("server-trust-group-test-2"), - // Type: to.Ptr("Microsoft.Sql/locations/serverTrustGroups"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/locations/Japan East/serverTrustGroups/server-trust-group-test-2"), - // Properties: &armsql.ServerTrustGroupProperties{ - // GroupMembers: []*armsql.ServerInfo{ - // { - // ServerID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/managedInstances/managedInstance-1"), - // }, - // { - // ServerID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/managedInstances/managedInstance-3"), - // }}, - // TrustScopes: []*armsql.ServerTrustGroupPropertiesTrustScopesItem{ - // to.Ptr(armsql.ServerTrustGroupPropertiesTrustScopesItemGlobalTransactions), - // to.Ptr(armsql.ServerTrustGroupPropertiesTrustScopesItemServiceBroker)}, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerTrustGroupListByManagedInstance.json -func ExampleServerTrustGroupsClient_NewListByInstancePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewServerTrustGroupsClient().NewListByInstancePager("Default-SQL-SouthEastAsia", "managedInstance-1", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ServerTrustGroupListResult = armsql.ServerTrustGroupListResult{ - // Value: []*armsql.ServerTrustGroup{ - // { - // Name: to.Ptr("server-trust-group-test"), - // Type: to.Ptr("Microsoft.Sql/locations/serverTrustGroups"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/locations/Japan East/serverTrustGroups/server-trust-group-test"), - // Properties: &armsql.ServerTrustGroupProperties{ - // GroupMembers: []*armsql.ServerInfo{ - // { - // ServerID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/managedInstances/managedInstance-1"), - // }, - // { - // ServerID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/managedInstances/managedInstance-2"), - // }}, - // TrustScopes: []*armsql.ServerTrustGroupPropertiesTrustScopesItem{ - // to.Ptr(armsql.ServerTrustGroupPropertiesTrustScopesItemGlobalTransactions), - // to.Ptr(armsql.ServerTrustGroupPropertiesTrustScopesItemServiceBroker)}, - // }, - // }, - // { - // Name: to.Ptr("server-trust-group-test-2"), - // Type: to.Ptr("Microsoft.Sql/locations/serverTrustGroups"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/locations/Japan East/serverTrustGroups/server-trust-group-test-2"), - // Properties: &armsql.ServerTrustGroupProperties{ - // GroupMembers: []*armsql.ServerInfo{ - // { - // ServerID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/managedInstances/managedInstance-1"), - // }, - // { - // ServerID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/managedInstances/managedInstance-3"), - // }}, - // TrustScopes: []*armsql.ServerTrustGroupPropertiesTrustScopesItem{ - // to.Ptr(armsql.ServerTrustGroupPropertiesTrustScopesItemGlobalTransactions), - // to.Ptr(armsql.ServerTrustGroupPropertiesTrustScopesItemServiceBroker)}, - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/sql/armsql/serverusages_client.go b/sdk/resourcemanager/sql/armsql/serverusages_client.go index b200d5696729..93b587943198 100644 --- a/sdk/resourcemanager/sql/armsql/serverusages_client.go +++ b/sdk/resourcemanager/sql/armsql/serverusages_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armsql @@ -44,9 +43,9 @@ func NewServerUsagesClient(subscriptionID string, credential azcore.TokenCredent return client, nil } -// NewListByServerPager - Returns server usages. +// NewListByServerPager - Gets server usages. // -// Generated from API version 2014-04-01 +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -55,10 +54,16 @@ func NewServerUsagesClient(subscriptionID string, credential azcore.TokenCredent func (client *ServerUsagesClient) NewListByServerPager(resourceGroupName string, serverName string, options *ServerUsagesClientListByServerOptions) *runtime.Pager[ServerUsagesClientListByServerResponse] { return runtime.NewPager(runtime.PagingHandler[ServerUsagesClientListByServerResponse]{ More: func(page ServerUsagesClientListByServerResponse) bool { - return false + return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *ServerUsagesClientListByServerResponse) (ServerUsagesClientListByServerResponse, error) { - req, err := client.listByServerCreateRequest(ctx, resourceGroupName, serverName, options) + var req *policy.Request + var err error + if page == nil { + req, err = client.listByServerCreateRequest(ctx, resourceGroupName, serverName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } if err != nil { return ServerUsagesClientListByServerResponse{}, err } @@ -77,10 +82,6 @@ func (client *ServerUsagesClient) NewListByServerPager(resourceGroupName string, // listByServerCreateRequest creates the ListByServer request. func (client *ServerUsagesClient) listByServerCreateRequest(ctx context.Context, resourceGroupName string, serverName string, options *ServerUsagesClientListByServerOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/usages" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") } @@ -89,12 +90,16 @@ func (client *ServerUsagesClient) listByServerCreateRequest(ctx context.Context, return nil, errors.New("parameter serverName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{serverName}", url.PathEscape(serverName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2014-04-01") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/sql/armsql/serverusages_client_example_test.go b/sdk/resourcemanager/sql/armsql/serverusages_client_example_test.go deleted file mode 100644 index 064c691a6d4b..000000000000 --- a/sdk/resourcemanager/sql/armsql/serverusages_client_example_test.go +++ /dev/null @@ -1,62 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsql_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sql/armsql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/stable/2014-04-01-legacy/examples/ServerUsageMetricsList.json -func ExampleServerUsagesClient_NewListByServerPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewServerUsagesClient().NewListByServerPager("sqlcrudtest-6730", "sqlcrudtest-9007", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ServerUsageListResult = armsql.ServerUsageListResult{ - // Value: []*armsql.ServerUsage{ - // { - // Name: to.Ptr("server_dtu_quota"), - // CurrentValue: to.Ptr[float64](0), - // DisplayName: to.Ptr("Database Throughput Unit Quota"), - // Limit: to.Ptr[float64](45000), - // ResourceName: to.Ptr("sqlcrudtest-9007"), - // Unit: to.Ptr("DTUs"), - // }, - // { - // Name: to.Ptr("server_dtu_quota_current"), - // CurrentValue: to.Ptr[float64](0), - // DisplayName: to.Ptr("Database Throughput Unit Quota"), - // Limit: to.Ptr[float64](45000), - // ResourceName: to.Ptr("sqlcrudtest-9007"), - // Unit: to.Ptr("DTUs"), - // }}, - // } - } -} diff --git a/sdk/resourcemanager/sql/armsql/servervulnerabilityassessments_client.go b/sdk/resourcemanager/sql/armsql/servervulnerabilityassessments_client.go index ccab0c996d61..dd764153d2eb 100644 --- a/sdk/resourcemanager/sql/armsql/servervulnerabilityassessments_client.go +++ b/sdk/resourcemanager/sql/armsql/servervulnerabilityassessments_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armsql @@ -49,7 +48,7 @@ func NewServerVulnerabilityAssessmentsClient(subscriptionID string, credential a // https://docs.microsoft.com/azure/azure-sql/database/sql-database-vulnerability-assessment-storage // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server for which the vulnerability assessment is defined. @@ -58,18 +57,21 @@ func NewServerVulnerabilityAssessmentsClient(subscriptionID string, credential a // - options - ServerVulnerabilityAssessmentsClientCreateOrUpdateOptions contains the optional parameters for the ServerVulnerabilityAssessmentsClient.CreateOrUpdate // method. func (client *ServerVulnerabilityAssessmentsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, vulnerabilityAssessmentName VulnerabilityAssessmentName, parameters ServerVulnerabilityAssessment, options *ServerVulnerabilityAssessmentsClientCreateOrUpdateOptions) (ServerVulnerabilityAssessmentsClientCreateOrUpdateResponse, error) { + var err error req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, serverName, vulnerabilityAssessmentName, parameters, options) if err != nil { return ServerVulnerabilityAssessmentsClientCreateOrUpdateResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ServerVulnerabilityAssessmentsClientCreateOrUpdateResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { - return ServerVulnerabilityAssessmentsClientCreateOrUpdateResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return ServerVulnerabilityAssessmentsClientCreateOrUpdateResponse{}, err } - return client.createOrUpdateHandleResponse(resp) + resp, err := client.createOrUpdateHandleResponse(httpResp) + return resp, err } // createOrUpdateCreateRequest creates the CreateOrUpdate request. @@ -96,10 +98,13 @@ func (client *ServerVulnerabilityAssessmentsClient) createOrUpdateCreateRequest( return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // createOrUpdateHandleResponse handles the CreateOrUpdate response. @@ -114,7 +119,7 @@ func (client *ServerVulnerabilityAssessmentsClient) createOrUpdateHandleResponse // Delete - Removes the server's vulnerability assessment. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server for which the vulnerability assessment is defined. @@ -122,16 +127,18 @@ func (client *ServerVulnerabilityAssessmentsClient) createOrUpdateHandleResponse // - options - ServerVulnerabilityAssessmentsClientDeleteOptions contains the optional parameters for the ServerVulnerabilityAssessmentsClient.Delete // method. func (client *ServerVulnerabilityAssessmentsClient) Delete(ctx context.Context, resourceGroupName string, serverName string, vulnerabilityAssessmentName VulnerabilityAssessmentName, options *ServerVulnerabilityAssessmentsClientDeleteOptions) (ServerVulnerabilityAssessmentsClientDeleteResponse, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, serverName, vulnerabilityAssessmentName, options) if err != nil { return ServerVulnerabilityAssessmentsClientDeleteResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ServerVulnerabilityAssessmentsClientDeleteResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ServerVulnerabilityAssessmentsClientDeleteResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ServerVulnerabilityAssessmentsClientDeleteResponse{}, err } return ServerVulnerabilityAssessmentsClientDeleteResponse{}, nil } @@ -160,7 +167,7 @@ func (client *ServerVulnerabilityAssessmentsClient) deleteCreateRequest(ctx cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -168,7 +175,7 @@ func (client *ServerVulnerabilityAssessmentsClient) deleteCreateRequest(ctx cont // Get - Gets the server's vulnerability assessment. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server for which the vulnerability assessment is defined. @@ -176,18 +183,21 @@ func (client *ServerVulnerabilityAssessmentsClient) deleteCreateRequest(ctx cont // - options - ServerVulnerabilityAssessmentsClientGetOptions contains the optional parameters for the ServerVulnerabilityAssessmentsClient.Get // method. func (client *ServerVulnerabilityAssessmentsClient) Get(ctx context.Context, resourceGroupName string, serverName string, vulnerabilityAssessmentName VulnerabilityAssessmentName, options *ServerVulnerabilityAssessmentsClientGetOptions) (ServerVulnerabilityAssessmentsClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, serverName, vulnerabilityAssessmentName, options) if err != nil { return ServerVulnerabilityAssessmentsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ServerVulnerabilityAssessmentsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ServerVulnerabilityAssessmentsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ServerVulnerabilityAssessmentsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -214,7 +224,7 @@ func (client *ServerVulnerabilityAssessmentsClient) getCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -231,7 +241,7 @@ func (client *ServerVulnerabilityAssessmentsClient) getHandleResponse(resp *http // NewListByServerPager - Lists the vulnerability assessment policies associated with a server. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -285,7 +295,7 @@ func (client *ServerVulnerabilityAssessmentsClient) listByServerCreateRequest(ct return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/sql/armsql/servervulnerabilityassessments_client_example_test.go b/sdk/resourcemanager/sql/armsql/servervulnerabilityassessments_client_example_test.go deleted file mode 100644 index e1c33196934b..000000000000 --- a/sdk/resourcemanager/sql/armsql/servervulnerabilityassessments_client_example_test.go +++ /dev/null @@ -1,235 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsql_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sql/armsql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerVulnerabilityAssessmentGet.json -func ExampleServerVulnerabilityAssessmentsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewServerVulnerabilityAssessmentsClient().Get(ctx, "vulnerabilityaseessmenttest-4799", "vulnerabilityaseessmenttest-6440", armsql.VulnerabilityAssessmentNameDefault, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ServerVulnerabilityAssessment = armsql.ServerVulnerabilityAssessment{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.Sql/servers/vulnerabilityAssessments"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/vulnerabilityaseessmenttest-4799/providers/Microsoft.Sql/servers/vulnerabilityaseessmenttest-6440/vulnerabilityAssessments/default"), - // Properties: &armsql.ServerVulnerabilityAssessmentProperties{ - // RecurringScans: &armsql.VulnerabilityAssessmentRecurringScansProperties{ - // EmailSubscriptionAdmins: to.Ptr(true), - // Emails: []*string{ - // to.Ptr("email1@mail.com"), - // to.Ptr("email2@mail.com")}, - // IsEnabled: to.Ptr(true), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerVulnerabilityAssessmentCreateMax.json -func ExampleServerVulnerabilityAssessmentsClient_CreateOrUpdate_createAServersVulnerabilityAssessmentWithAllParameters() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewServerVulnerabilityAssessmentsClient().CreateOrUpdate(ctx, "vulnerabilityaseessmenttest-4799", "vulnerabilityaseessmenttest-6440", armsql.VulnerabilityAssessmentNameDefault, armsql.ServerVulnerabilityAssessment{ - Properties: &armsql.ServerVulnerabilityAssessmentProperties{ - RecurringScans: &armsql.VulnerabilityAssessmentRecurringScansProperties{ - EmailSubscriptionAdmins: to.Ptr(true), - Emails: []*string{ - to.Ptr("email1@mail.com"), - to.Ptr("email2@mail.com")}, - IsEnabled: to.Ptr(true), - }, - StorageAccountAccessKey: to.Ptr("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"), - StorageContainerPath: to.Ptr("https://myStorage.blob.core.windows.net/vulnerability-assessment/"), - StorageContainerSasKey: to.Ptr("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ServerVulnerabilityAssessment = armsql.ServerVulnerabilityAssessment{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.Sql/servers/vulnerabilityAssessments"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/vulnerabilityaseessmenttest-4799/providers/Microsoft.Sql/servers/vulnerabilityaseessmenttest-6440/vulnerabilityAssessments/default"), - // Properties: &armsql.ServerVulnerabilityAssessmentProperties{ - // RecurringScans: &armsql.VulnerabilityAssessmentRecurringScansProperties{ - // EmailSubscriptionAdmins: to.Ptr(true), - // Emails: []*string{ - // to.Ptr("email1@mail.com"), - // to.Ptr("email2@mail.com")}, - // IsEnabled: to.Ptr(true), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerVulnerabilityAssessmentCreateStorageAccessKeyMin.json -func ExampleServerVulnerabilityAssessmentsClient_CreateOrUpdate_createAServersVulnerabilityAssessmentWithMinimalParametersWhenStorageAccountAccessKeyIsSpecified() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewServerVulnerabilityAssessmentsClient().CreateOrUpdate(ctx, "vulnerabilityaseessmenttest-4799", "vulnerabilityaseessmenttest-6440", armsql.VulnerabilityAssessmentNameDefault, armsql.ServerVulnerabilityAssessment{ - Properties: &armsql.ServerVulnerabilityAssessmentProperties{ - StorageAccountAccessKey: to.Ptr("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"), - StorageContainerPath: to.Ptr("https://myStorage.blob.core.windows.net/vulnerability-assessment/"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ServerVulnerabilityAssessment = armsql.ServerVulnerabilityAssessment{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.Sql/servers/vulnerabilityAssessments"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/vulnerabilityaseessmenttest-4799/providers/Microsoft.Sql/servers/vulnerabilityaseessmenttest-6440/vulnerabilityAssessments/default"), - // Properties: &armsql.ServerVulnerabilityAssessmentProperties{ - // RecurringScans: &armsql.VulnerabilityAssessmentRecurringScansProperties{ - // EmailSubscriptionAdmins: to.Ptr(false), - // Emails: []*string{ - // }, - // IsEnabled: to.Ptr(true), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerVulnerabilityAssessmentCreateContainerSasKeyMin.json -func ExampleServerVulnerabilityAssessmentsClient_CreateOrUpdate_createAServersVulnerabilityAssessmentWithMinimalParametersWhenStorageContainerSasKeyIsSpecified() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewServerVulnerabilityAssessmentsClient().CreateOrUpdate(ctx, "vulnerabilityaseessmenttest-4799", "vulnerabilityaseessmenttest-6440", armsql.VulnerabilityAssessmentNameDefault, armsql.ServerVulnerabilityAssessment{ - Properties: &armsql.ServerVulnerabilityAssessmentProperties{ - StorageContainerPath: to.Ptr("https://myStorage.blob.core.windows.net/vulnerability-assessment/"), - StorageContainerSasKey: to.Ptr("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ServerVulnerabilityAssessment = armsql.ServerVulnerabilityAssessment{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.Sql/servers/vulnerabilityAssessments"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/vulnerabilityaseessmenttest-4799/providers/Microsoft.Sql/servers/vulnerabilityaseessmenttest-6440/vulnerabilityAssessments/default"), - // Properties: &armsql.ServerVulnerabilityAssessmentProperties{ - // RecurringScans: &armsql.VulnerabilityAssessmentRecurringScansProperties{ - // EmailSubscriptionAdmins: to.Ptr(false), - // Emails: []*string{ - // }, - // IsEnabled: to.Ptr(true), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerVulnerabilityAssessmentDelete.json -func ExampleServerVulnerabilityAssessmentsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewServerVulnerabilityAssessmentsClient().Delete(ctx, "vulnerabilityaseessmenttest-4799", "vulnerabilityaseessmenttest-6440", armsql.VulnerabilityAssessmentNameDefault, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerVulnerabilityAssessmentListByServer.json -func ExampleServerVulnerabilityAssessmentsClient_NewListByServerPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewServerVulnerabilityAssessmentsClient().NewListByServerPager("vulnerabilityaseessmenttest-4799", "vulnerabilityaseessmenttest-6440", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ServerVulnerabilityAssessmentListResult = armsql.ServerVulnerabilityAssessmentListResult{ - // Value: []*armsql.ServerVulnerabilityAssessment{ - // { - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.Sql/servers/vulnerabilityAssessments"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/vulnerabilityaseessmenttest-4799/providers/Microsoft.Sql/servers/vulnerabilityaseessmenttest-6440/vulnerabilityAssessments/"), - // Properties: &armsql.ServerVulnerabilityAssessmentProperties{ - // RecurringScans: &armsql.VulnerabilityAssessmentRecurringScansProperties{ - // EmailSubscriptionAdmins: to.Ptr(true), - // Emails: []*string{ - // to.Ptr("email1@mail.com"), - // to.Ptr("email2@mail.com")}, - // IsEnabled: to.Ptr(true), - // }, - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/sql/armsql/serviceobjectives_client.go b/sdk/resourcemanager/sql/armsql/serviceobjectives_client.go deleted file mode 100644 index 8b02482df841..000000000000 --- a/sdk/resourcemanager/sql/armsql/serviceobjectives_client.go +++ /dev/null @@ -1,173 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsql - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "net/url" - "strings" -) - -// ServiceObjectivesClient contains the methods for the ServiceObjectives group. -// Don't use this type directly, use NewServiceObjectivesClient() instead. -type ServiceObjectivesClient struct { - internal *arm.Client - subscriptionID string -} - -// NewServiceObjectivesClient creates a new instance of ServiceObjectivesClient with the specified values. -// - subscriptionID - The subscription ID that identifies an Azure subscription. -// - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. -func NewServiceObjectivesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ServiceObjectivesClient, error) { - cl, err := arm.NewClient(moduleName+".ServiceObjectivesClient", moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &ServiceObjectivesClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// Get - Gets a database service objective. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2014-04-01 -// - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure -// Resource Manager API or the portal. -// - serverName - The name of the server. -// - serviceObjectiveName - The name of the service objective to retrieve. -// - options - ServiceObjectivesClientGetOptions contains the optional parameters for the ServiceObjectivesClient.Get method. -func (client *ServiceObjectivesClient) Get(ctx context.Context, resourceGroupName string, serverName string, serviceObjectiveName string, options *ServiceObjectivesClientGetOptions) (ServiceObjectivesClientGetResponse, error) { - req, err := client.getCreateRequest(ctx, resourceGroupName, serverName, serviceObjectiveName, options) - if err != nil { - return ServiceObjectivesClientGetResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ServiceObjectivesClientGetResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ServiceObjectivesClientGetResponse{}, runtime.NewResponseError(resp) - } - return client.getHandleResponse(resp) -} - -// getCreateRequest creates the Get request. -func (client *ServiceObjectivesClient) getCreateRequest(ctx context.Context, resourceGroupName string, serverName string, serviceObjectiveName string, options *ServiceObjectivesClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/serviceObjectives/{serviceObjectiveName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if serverName == "" { - return nil, errors.New("parameter serverName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{serverName}", url.PathEscape(serverName)) - if serviceObjectiveName == "" { - return nil, errors.New("parameter serviceObjectiveName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{serviceObjectiveName}", url.PathEscape(serviceObjectiveName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2014-04-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *ServiceObjectivesClient) getHandleResponse(resp *http.Response) (ServiceObjectivesClientGetResponse, error) { - result := ServiceObjectivesClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.ServiceObjective); err != nil { - return ServiceObjectivesClientGetResponse{}, err - } - return result, nil -} - -// NewListByServerPager - Returns database service objectives. -// -// Generated from API version 2014-04-01 -// - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure -// Resource Manager API or the portal. -// - serverName - The name of the server. -// - options - ServiceObjectivesClientListByServerOptions contains the optional parameters for the ServiceObjectivesClient.NewListByServerPager -// method. -func (client *ServiceObjectivesClient) NewListByServerPager(resourceGroupName string, serverName string, options *ServiceObjectivesClientListByServerOptions) *runtime.Pager[ServiceObjectivesClientListByServerResponse] { - return runtime.NewPager(runtime.PagingHandler[ServiceObjectivesClientListByServerResponse]{ - More: func(page ServiceObjectivesClientListByServerResponse) bool { - return false - }, - Fetcher: func(ctx context.Context, page *ServiceObjectivesClientListByServerResponse) (ServiceObjectivesClientListByServerResponse, error) { - req, err := client.listByServerCreateRequest(ctx, resourceGroupName, serverName, options) - if err != nil { - return ServiceObjectivesClientListByServerResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ServiceObjectivesClientListByServerResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ServiceObjectivesClientListByServerResponse{}, runtime.NewResponseError(resp) - } - return client.listByServerHandleResponse(resp) - }, - }) -} - -// listByServerCreateRequest creates the ListByServer request. -func (client *ServiceObjectivesClient) listByServerCreateRequest(ctx context.Context, resourceGroupName string, serverName string, options *ServiceObjectivesClientListByServerOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/serviceObjectives" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if serverName == "" { - return nil, errors.New("parameter serverName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{serverName}", url.PathEscape(serverName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2014-04-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listByServerHandleResponse handles the ListByServer response. -func (client *ServiceObjectivesClient) listByServerHandleResponse(resp *http.Response) (ServiceObjectivesClientListByServerResponse, error) { - result := ServiceObjectivesClientListByServerResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.ServiceObjectiveListResult); err != nil { - return ServiceObjectivesClientListByServerResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/sql/armsql/serviceobjectives_client_example_test.go b/sdk/resourcemanager/sql/armsql/serviceobjectives_client_example_test.go deleted file mode 100644 index 532aa8f25d13..000000000000 --- a/sdk/resourcemanager/sql/armsql/serviceobjectives_client_example_test.go +++ /dev/null @@ -1,605 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsql_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sql/armsql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/stable/2014-04-01/examples/ServiceObjectiveGet.json -func ExampleServiceObjectivesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewServiceObjectivesClient().Get(ctx, "group1", "sqlcrudtest", "29dd7459-4a7c-4e56-be22-f0adda49440d", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ServiceObjective = armsql.ServiceObjective{ - // Name: to.Ptr("29dd7459-4a7c-4e56-be22-f0adda49440d"), - // Type: to.Ptr("Microsoft.Sql/servers/serviceObjectives"), - // ID: to.Ptr("/subscriptions/b6a6e0c5-e79c-4c6d-a878-72eafbca4cf2/resourceGroups/QA/providers/Microsoft.Sql/servers/nafantest/serviceObjectives/29dd7459-4a7c-4e56-be22-f0adda49440d"), - // Properties: &armsql.ServiceObjectiveProperties{ - // Enabled: to.Ptr(false), - // IsDefault: to.Ptr(false), - // IsSystem: to.Ptr(true), - // ServiceObjectiveName: to.Ptr("System0"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/stable/2014-04-01/examples/ServiceObjectiveList.json -func ExampleServiceObjectivesClient_NewListByServerPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewServiceObjectivesClient().NewListByServerPager("group1", "sqlcrudtest", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ServiceObjectiveListResult = armsql.ServiceObjectiveListResult{ - // Value: []*armsql.ServiceObjective{ - // { - // Name: to.Ptr("26e021db-f1f9-4c98-84c6-92af8ef433d7"), - // Type: to.Ptr("Microsoft.Sql/servers/serviceObjectives"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/sqlcrudtest/serviceObjectives/26e021db-f1f9-4c98-84c6-92af8ef433d7"), - // Properties: &armsql.ServiceObjectiveProperties{ - // Enabled: to.Ptr(false), - // IsDefault: to.Ptr(false), - // IsSystem: to.Ptr(true), - // ServiceObjectiveName: to.Ptr("System"), - // }, - // }, - // { - // Name: to.Ptr("29dd7459-4a7c-4e56-be22-f0adda49440d"), - // Type: to.Ptr("Microsoft.Sql/servers/serviceObjectives"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/sqlcrudtest/serviceObjectives/29dd7459-4a7c-4e56-be22-f0adda49440d"), - // Properties: &armsql.ServiceObjectiveProperties{ - // Enabled: to.Ptr(false), - // IsDefault: to.Ptr(false), - // IsSystem: to.Ptr(true), - // ServiceObjectiveName: to.Ptr("System0"), - // }, - // }, - // { - // Name: to.Ptr("c99ac918-dbea-463f-a475-16ec020fdc12"), - // Type: to.Ptr("Microsoft.Sql/servers/serviceObjectives"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/sqlcrudtest/serviceObjectives/c99ac918-dbea-463f-a475-16ec020fdc12"), - // Properties: &armsql.ServiceObjectiveProperties{ - // Enabled: to.Ptr(false), - // IsDefault: to.Ptr(false), - // IsSystem: to.Ptr(true), - // ServiceObjectiveName: to.Ptr("System1"), - // }, - // }, - // { - // Name: to.Ptr("620323bf-2879-4807-b30d-c2e6d7b3b3aa"), - // Type: to.Ptr("Microsoft.Sql/servers/serviceObjectives"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/sqlcrudtest/serviceObjectives/620323bf-2879-4807-b30d-c2e6d7b3b3aa"), - // Properties: &armsql.ServiceObjectiveProperties{ - // Enabled: to.Ptr(false), - // IsDefault: to.Ptr(false), - // IsSystem: to.Ptr(true), - // ServiceObjectiveName: to.Ptr("System2"), - // }, - // }, - // { - // Name: to.Ptr("33d0db1f-6893-4210-99f9-463fb9b496a4"), - // Type: to.Ptr("Microsoft.Sql/servers/serviceObjectives"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/sqlcrudtest/serviceObjectives/33d0db1f-6893-4210-99f9-463fb9b496a4"), - // Properties: &armsql.ServiceObjectiveProperties{ - // Enabled: to.Ptr(false), - // IsDefault: to.Ptr(false), - // IsSystem: to.Ptr(true), - // ServiceObjectiveName: to.Ptr("System3"), - // }, - // }, - // { - // Name: to.Ptr("da24338c-a6c9-46c2-a4bf-4ac95b496ae4"), - // Type: to.Ptr("Microsoft.Sql/servers/serviceObjectives"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/sqlcrudtest/serviceObjectives/da24338c-a6c9-46c2-a4bf-4ac95b496ae4"), - // Properties: &armsql.ServiceObjectiveProperties{ - // Enabled: to.Ptr(false), - // IsDefault: to.Ptr(false), - // IsSystem: to.Ptr(true), - // ServiceObjectiveName: to.Ptr("System4"), - // }, - // }, - // { - // Name: to.Ptr("53f7fa1b-b0d0-43d6-bc29-c5f059fb36e9"), - // Type: to.Ptr("Microsoft.Sql/servers/serviceObjectives"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/sqlcrudtest/serviceObjectives/53f7fa1b-b0d0-43d6-bc29-c5f059fb36e9"), - // Properties: &armsql.ServiceObjectiveProperties{ - // Enabled: to.Ptr(false), - // IsDefault: to.Ptr(false), - // IsSystem: to.Ptr(true), - // ServiceObjectiveName: to.Ptr("System2L"), - // }, - // }, - // { - // Name: to.Ptr("e79cd55c-689f-48d9-bffa-0dd12c772248"), - // Type: to.Ptr("Microsoft.Sql/servers/serviceObjectives"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/sqlcrudtest/serviceObjectives/e79cd55c-689f-48d9-bffa-0dd12c772248"), - // Properties: &armsql.ServiceObjectiveProperties{ - // Enabled: to.Ptr(false), - // IsDefault: to.Ptr(false), - // IsSystem: to.Ptr(true), - // ServiceObjectiveName: to.Ptr("System3L"), - // }, - // }, - // { - // Name: to.Ptr("4b37bb6d-e004-47ac-8f7a-be56ac9fb490"), - // Type: to.Ptr("Microsoft.Sql/servers/serviceObjectives"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/sqlcrudtest/serviceObjectives/4b37bb6d-e004-47ac-8f7a-be56ac9fb490"), - // Properties: &armsql.ServiceObjectiveProperties{ - // Enabled: to.Ptr(false), - // IsDefault: to.Ptr(false), - // IsSystem: to.Ptr(true), - // ServiceObjectiveName: to.Ptr("System4L"), - // }, - // }, - // { - // Name: to.Ptr("6aa3bb3e-7f50-40d6-95ef-5497c30d99d8"), - // Type: to.Ptr("Microsoft.Sql/servers/serviceObjectives"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/sqlcrudtest/serviceObjectives/6aa3bb3e-7f50-40d6-95ef-5497c30d99d8"), - // Properties: &armsql.ServiceObjectiveProperties{ - // Enabled: to.Ptr(true), - // IsDefault: to.Ptr(true), - // IsSystem: to.Ptr(false), - // ServiceObjectiveName: to.Ptr("Free"), - // }, - // }, - // { - // Name: to.Ptr("dd6d99bb-f193-4ec1-86f2-43d3bccbc49c"), - // Type: to.Ptr("Microsoft.Sql/servers/serviceObjectives"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/sqlcrudtest/serviceObjectives/dd6d99bb-f193-4ec1-86f2-43d3bccbc49c"), - // Properties: &armsql.ServiceObjectiveProperties{ - // Enabled: to.Ptr(true), - // IsDefault: to.Ptr(true), - // IsSystem: to.Ptr(false), - // ServiceObjectiveName: to.Ptr("Basic"), - // }, - // }, - // { - // Name: to.Ptr("f1173c43-91bd-4aaa-973c-54e79e15235b"), - // Type: to.Ptr("Microsoft.Sql/servers/serviceObjectives"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/sqlcrudtest/serviceObjectives/f1173c43-91bd-4aaa-973c-54e79e15235b"), - // Properties: &armsql.ServiceObjectiveProperties{ - // Enabled: to.Ptr(true), - // IsDefault: to.Ptr(true), - // IsSystem: to.Ptr(false), - // ServiceObjectiveName: to.Ptr("S0"), - // }, - // }, - // { - // Name: to.Ptr("1b1ebd4d-d903-4baa-97f9-4ea675f5e928"), - // Type: to.Ptr("Microsoft.Sql/servers/serviceObjectives"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/sqlcrudtest/serviceObjectives/1b1ebd4d-d903-4baa-97f9-4ea675f5e928"), - // Properties: &armsql.ServiceObjectiveProperties{ - // Enabled: to.Ptr(true), - // IsDefault: to.Ptr(false), - // IsSystem: to.Ptr(false), - // ServiceObjectiveName: to.Ptr("S1"), - // }, - // }, - // { - // Name: to.Ptr("455330e1-00cd-488b-b5fa-177c226f28b7"), - // Type: to.Ptr("Microsoft.Sql/servers/serviceObjectives"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/sqlcrudtest/serviceObjectives/455330e1-00cd-488b-b5fa-177c226f28b7"), - // Properties: &armsql.ServiceObjectiveProperties{ - // Enabled: to.Ptr(true), - // IsDefault: to.Ptr(false), - // IsSystem: to.Ptr(false), - // ServiceObjectiveName: to.Ptr("S2"), - // }, - // }, - // { - // Name: to.Ptr("789681b8-ca10-4eb0-bdf2-e0b050601b40"), - // Type: to.Ptr("Microsoft.Sql/servers/serviceObjectives"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/sqlcrudtest/serviceObjectives/789681b8-ca10-4eb0-bdf2-e0b050601b40"), - // Properties: &armsql.ServiceObjectiveProperties{ - // Enabled: to.Ptr(true), - // IsDefault: to.Ptr(false), - // IsSystem: to.Ptr(false), - // ServiceObjectiveName: to.Ptr("S3"), - // }, - // }, - // { - // Name: to.Ptr("7203483a-c4fb-4304-9e9f-17c71c904f5d"), - // Type: to.Ptr("Microsoft.Sql/servers/serviceObjectives"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/sqlcrudtest/serviceObjectives/7203483a-c4fb-4304-9e9f-17c71c904f5d"), - // Properties: &armsql.ServiceObjectiveProperties{ - // Enabled: to.Ptr(true), - // IsDefault: to.Ptr(true), - // IsSystem: to.Ptr(false), - // ServiceObjectiveName: to.Ptr("P1"), - // }, - // }, - // { - // Name: to.Ptr("a7d1b92d-c987-4375-b54d-2b1d0e0f5bb0"), - // Type: to.Ptr("Microsoft.Sql/servers/serviceObjectives"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/sqlcrudtest/serviceObjectives/a7d1b92d-c987-4375-b54d-2b1d0e0f5bb0"), - // Properties: &armsql.ServiceObjectiveProperties{ - // Enabled: to.Ptr(true), - // IsDefault: to.Ptr(false), - // IsSystem: to.Ptr(false), - // ServiceObjectiveName: to.Ptr("P2"), - // }, - // }, - // { - // Name: to.Ptr("afe1eee1-1f12-4e5f-9ad6-2de9c12cb4dc"), - // Type: to.Ptr("Microsoft.Sql/servers/serviceObjectives"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/sqlcrudtest/serviceObjectives/afe1eee1-1f12-4e5f-9ad6-2de9c12cb4dc"), - // Properties: &armsql.ServiceObjectiveProperties{ - // Enabled: to.Ptr(true), - // IsDefault: to.Ptr(false), - // IsSystem: to.Ptr(false), - // ServiceObjectiveName: to.Ptr("P4"), - // }, - // }, - // { - // Name: to.Ptr("43940481-9191-475a-9dba-6b505615b9aa"), - // Type: to.Ptr("Microsoft.Sql/servers/serviceObjectives"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/sqlcrudtest/serviceObjectives/43940481-9191-475a-9dba-6b505615b9aa"), - // Properties: &armsql.ServiceObjectiveProperties{ - // Enabled: to.Ptr(true), - // IsDefault: to.Ptr(false), - // IsSystem: to.Ptr(false), - // ServiceObjectiveName: to.Ptr("P6"), - // }, - // }, - // { - // Name: to.Ptr("dd00d544-bbc0-4f61-ba60-cdce0c410288"), - // Type: to.Ptr("Microsoft.Sql/servers/serviceObjectives"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/sqlcrudtest/serviceObjectives/dd00d544-bbc0-4f61-ba60-cdce0c410288"), - // Properties: &armsql.ServiceObjectiveProperties{ - // Enabled: to.Ptr(true), - // IsDefault: to.Ptr(false), - // IsSystem: to.Ptr(false), - // ServiceObjectiveName: to.Ptr("P11"), - // }, - // }, - // { - // Name: to.Ptr("5bc86cca-9a96-4a94-90ef-bbdfcfbf2d71"), - // Type: to.Ptr("Microsoft.Sql/servers/serviceObjectives"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/sqlcrudtest/serviceObjectives/5bc86cca-9a96-4a94-90ef-bbdfcfbf2d71"), - // Properties: &armsql.ServiceObjectiveProperties{ - // Enabled: to.Ptr(true), - // IsDefault: to.Ptr(false), - // IsSystem: to.Ptr(false), - // ServiceObjectiveName: to.Ptr("P15"), - // }, - // }, - // { - // Name: to.Ptr("dfdc102c-ed02-4349-9756-e227f0e43bb8"), - // Type: to.Ptr("Microsoft.Sql/servers/serviceObjectives"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/sqlcrudtest/serviceObjectives/dfdc102c-ed02-4349-9756-e227f0e43bb8"), - // Properties: &armsql.ServiceObjectiveProperties{ - // Enabled: to.Ptr(true), - // IsDefault: to.Ptr(true), - // IsSystem: to.Ptr(false), - // ServiceObjectiveName: to.Ptr("PRS1"), - // }, - // }, - // { - // Name: to.Ptr("a089506e-b47a-4f42-8a32-cc19af4c86fb"), - // Type: to.Ptr("Microsoft.Sql/servers/serviceObjectives"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/sqlcrudtest/serviceObjectives/a089506e-b47a-4f42-8a32-cc19af4c86fb"), - // Properties: &armsql.ServiceObjectiveProperties{ - // Enabled: to.Ptr(true), - // IsDefault: to.Ptr(false), - // IsSystem: to.Ptr(false), - // ServiceObjectiveName: to.Ptr("PRS2"), - // }, - // }, - // { - // Name: to.Ptr("39cb8faf-cba8-4b1b-b580-1e1202f2a024"), - // Type: to.Ptr("Microsoft.Sql/servers/serviceObjectives"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/sqlcrudtest/serviceObjectives/39cb8faf-cba8-4b1b-b580-1e1202f2a024"), - // Properties: &armsql.ServiceObjectiveProperties{ - // Enabled: to.Ptr(true), - // IsDefault: to.Ptr(false), - // IsSystem: to.Ptr(false), - // ServiceObjectiveName: to.Ptr("PRS4"), - // }, - // }, - // { - // Name: to.Ptr("1e8da92e-efcd-4682-9140-bf6582120d1f"), - // Type: to.Ptr("Microsoft.Sql/servers/serviceObjectives"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/sqlcrudtest/serviceObjectives/1e8da92e-efcd-4682-9140-bf6582120d1f"), - // Properties: &armsql.ServiceObjectiveProperties{ - // Enabled: to.Ptr(true), - // IsDefault: to.Ptr(false), - // IsSystem: to.Ptr(false), - // ServiceObjectiveName: to.Ptr("PRS6"), - // }, - // }, - // { - // Name: to.Ptr("4e63cb0e-91b9-46fd-b05c-51fdd2367618"), - // Type: to.Ptr("Microsoft.Sql/servers/serviceObjectives"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/sqlcrudtest/serviceObjectives/4e63cb0e-91b9-46fd-b05c-51fdd2367618"), - // Properties: &armsql.ServiceObjectiveProperties{ - // Enabled: to.Ptr(true), - // IsDefault: to.Ptr(true), - // IsSystem: to.Ptr(false), - // ServiceObjectiveName: to.Ptr("DW100"), - // }, - // }, - // { - // Name: to.Ptr("99e78a92-d724-4e1b-857b-2be661f3d153"), - // Type: to.Ptr("Microsoft.Sql/servers/serviceObjectives"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/sqlcrudtest/serviceObjectives/99e78a92-d724-4e1b-857b-2be661f3d153"), - // Properties: &armsql.ServiceObjectiveProperties{ - // Enabled: to.Ptr(true), - // IsDefault: to.Ptr(false), - // IsSystem: to.Ptr(false), - // ServiceObjectiveName: to.Ptr("DW200"), - // }, - // }, - // { - // Name: to.Ptr("284f1aff-fee7-4d3b-a211-5b8ebdd28fea"), - // Type: to.Ptr("Microsoft.Sql/servers/serviceObjectives"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/sqlcrudtest/serviceObjectives/284f1aff-fee7-4d3b-a211-5b8ebdd28fea"), - // Properties: &armsql.ServiceObjectiveProperties{ - // Enabled: to.Ptr(true), - // IsDefault: to.Ptr(false), - // IsSystem: to.Ptr(false), - // ServiceObjectiveName: to.Ptr("DW300"), - // }, - // }, - // { - // Name: to.Ptr("3bdaeefe-8a9d-41d3-91c4-46ef896b19af"), - // Type: to.Ptr("Microsoft.Sql/servers/serviceObjectives"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/sqlcrudtest/serviceObjectives/3bdaeefe-8a9d-41d3-91c4-46ef896b19af"), - // Properties: &armsql.ServiceObjectiveProperties{ - // Enabled: to.Ptr(true), - // IsDefault: to.Ptr(false), - // IsSystem: to.Ptr(false), - // ServiceObjectiveName: to.Ptr("DW400"), - // }, - // }, - // { - // Name: to.Ptr("5f759b78-8ec0-4dfb-97cc-c1455a3b5b4d"), - // Type: to.Ptr("Microsoft.Sql/servers/serviceObjectives"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/sqlcrudtest/serviceObjectives/5f759b78-8ec0-4dfb-97cc-c1455a3b5b4d"), - // Properties: &armsql.ServiceObjectiveProperties{ - // Enabled: to.Ptr(true), - // IsDefault: to.Ptr(false), - // IsSystem: to.Ptr(false), - // ServiceObjectiveName: to.Ptr("DW500"), - // }, - // }, - // { - // Name: to.Ptr("efd65c5b-af7b-4389-9109-f6a69d6a3885"), - // Type: to.Ptr("Microsoft.Sql/servers/serviceObjectives"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/sqlcrudtest/serviceObjectives/efd65c5b-af7b-4389-9109-f6a69d6a3885"), - // Properties: &armsql.ServiceObjectiveProperties{ - // Enabled: to.Ptr(true), - // IsDefault: to.Ptr(false), - // IsSystem: to.Ptr(false), - // ServiceObjectiveName: to.Ptr("DW600"), - // }, - // }, - // { - // Name: to.Ptr("b89b9c6a-4ec2-4eb8-99db-6d2807e6aabb"), - // Type: to.Ptr("Microsoft.Sql/servers/serviceObjectives"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/sqlcrudtest/serviceObjectives/b89b9c6a-4ec2-4eb8-99db-6d2807e6aabb"), - // Properties: &armsql.ServiceObjectiveProperties{ - // Enabled: to.Ptr(true), - // IsDefault: to.Ptr(false), - // IsSystem: to.Ptr(false), - // ServiceObjectiveName: to.Ptr("DW1000"), - // }, - // }, - // { - // Name: to.Ptr("9a7a374e-b95c-4fd5-a68e-131d60796c47"), - // Type: to.Ptr("Microsoft.Sql/servers/serviceObjectives"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/sqlcrudtest/serviceObjectives/9a7a374e-b95c-4fd5-a68e-131d60796c47"), - // Properties: &armsql.ServiceObjectiveProperties{ - // Enabled: to.Ptr(true), - // IsDefault: to.Ptr(false), - // IsSystem: to.Ptr(false), - // ServiceObjectiveName: to.Ptr("DW1200"), - // }, - // }, - // { - // Name: to.Ptr("b930f58e-86b5-43e0-a2da-d8bf8769c557"), - // Type: to.Ptr("Microsoft.Sql/servers/serviceObjectives"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/sqlcrudtest/serviceObjectives/b930f58e-86b5-43e0-a2da-d8bf8769c557"), - // Properties: &armsql.ServiceObjectiveProperties{ - // Enabled: to.Ptr(true), - // IsDefault: to.Ptr(false), - // IsSystem: to.Ptr(false), - // ServiceObjectiveName: to.Ptr("DW1500"), - // }, - // }, - // { - // Name: to.Ptr("99165ede-a5ab-4b52-b317-e391d92ec370"), - // Type: to.Ptr("Microsoft.Sql/servers/serviceObjectives"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/sqlcrudtest/serviceObjectives/99165ede-a5ab-4b52-b317-e391d92ec370"), - // Properties: &armsql.ServiceObjectiveProperties{ - // Enabled: to.Ptr(true), - // IsDefault: to.Ptr(false), - // IsSystem: to.Ptr(false), - // ServiceObjectiveName: to.Ptr("DW2000"), - // }, - // }, - // { - // Name: to.Ptr("8e28c923-5cf2-43cb-bd25-28c8c69b30ff"), - // Type: to.Ptr("Microsoft.Sql/servers/serviceObjectives"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/sqlcrudtest/serviceObjectives/8e28c923-5cf2-43cb-bd25-28c8c69b30ff"), - // Properties: &armsql.ServiceObjectiveProperties{ - // Enabled: to.Ptr(true), - // IsDefault: to.Ptr(false), - // IsSystem: to.Ptr(false), - // ServiceObjectiveName: to.Ptr("DW3000"), - // }, - // }, - // { - // Name: to.Ptr("ee1df062-4f3c-42ad-91bf-58b2a7c351e4"), - // Type: to.Ptr("Microsoft.Sql/servers/serviceObjectives"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/sqlcrudtest/serviceObjectives/ee1df062-4f3c-42ad-91bf-58b2a7c351e4"), - // Properties: &armsql.ServiceObjectiveProperties{ - // Enabled: to.Ptr(true), - // IsDefault: to.Ptr(false), - // IsSystem: to.Ptr(false), - // ServiceObjectiveName: to.Ptr("DW6000"), - // }, - // }, - // { - // Name: to.Ptr("9cfc850f-d57f-4760-b5a6-bb640d268bf0"), - // Type: to.Ptr("Microsoft.Sql/servers/serviceObjectives"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/sqlcrudtest/serviceObjectives/9cfc850f-d57f-4760-b5a6-bb640d268bf0"), - // Properties: &armsql.ServiceObjectiveProperties{ - // Enabled: to.Ptr(true), - // IsDefault: to.Ptr(true), - // IsSystem: to.Ptr(false), - // ServiceObjectiveName: to.Ptr("DS100"), - // }, - // }, - // { - // Name: to.Ptr("053407ef-f01c-46f4-b829-96e01a14f449"), - // Type: to.Ptr("Microsoft.Sql/servers/serviceObjectives"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/sqlcrudtest/serviceObjectives/053407ef-f01c-46f4-b829-96e01a14f449"), - // Properties: &armsql.ServiceObjectiveProperties{ - // Enabled: to.Ptr(true), - // IsDefault: to.Ptr(false), - // IsSystem: to.Ptr(false), - // ServiceObjectiveName: to.Ptr("DS200"), - // }, - // }, - // { - // Name: to.Ptr("013a9e10-cafc-45a8-8fcf-93095655d2ce"), - // Type: to.Ptr("Microsoft.Sql/servers/serviceObjectives"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/sqlcrudtest/serviceObjectives/013a9e10-cafc-45a8-8fcf-93095655d2ce"), - // Properties: &armsql.ServiceObjectiveProperties{ - // Enabled: to.Ptr(true), - // IsDefault: to.Ptr(false), - // IsSystem: to.Ptr(false), - // ServiceObjectiveName: to.Ptr("DS300"), - // }, - // }, - // { - // Name: to.Ptr("79f61db4-8c10-46ba-a93a-d7d02dddd61c"), - // Type: to.Ptr("Microsoft.Sql/servers/serviceObjectives"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/sqlcrudtest/serviceObjectives/79f61db4-8c10-46ba-a93a-d7d02dddd61c"), - // Properties: &armsql.ServiceObjectiveProperties{ - // Enabled: to.Ptr(true), - // IsDefault: to.Ptr(false), - // IsSystem: to.Ptr(false), - // ServiceObjectiveName: to.Ptr("DS400"), - // }, - // }, - // { - // Name: to.Ptr("44eaac33-df00-4ef4-a2bb-f7ff87899eea"), - // Type: to.Ptr("Microsoft.Sql/servers/serviceObjectives"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/sqlcrudtest/serviceObjectives/44eaac33-df00-4ef4-a2bb-f7ff87899eea"), - // Properties: &armsql.ServiceObjectiveProperties{ - // Enabled: to.Ptr(true), - // IsDefault: to.Ptr(false), - // IsSystem: to.Ptr(false), - // ServiceObjectiveName: to.Ptr("DS500"), - // }, - // }, - // { - // Name: to.Ptr("f8e0f3a6-888b-459c-a9dd-d74d8b2b0e72"), - // Type: to.Ptr("Microsoft.Sql/servers/serviceObjectives"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/sqlcrudtest/serviceObjectives/f8e0f3a6-888b-459c-a9dd-d74d8b2b0e72"), - // Properties: &armsql.ServiceObjectiveProperties{ - // Enabled: to.Ptr(true), - // IsDefault: to.Ptr(false), - // IsSystem: to.Ptr(false), - // ServiceObjectiveName: to.Ptr("DS600"), - // }, - // }, - // { - // Name: to.Ptr("b9ed8f51-a414-42dc-8348-e4a1de25e12b"), - // Type: to.Ptr("Microsoft.Sql/servers/serviceObjectives"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/sqlcrudtest/serviceObjectives/b9ed8f51-a414-42dc-8348-e4a1de25e12b"), - // Properties: &armsql.ServiceObjectiveProperties{ - // Enabled: to.Ptr(true), - // IsDefault: to.Ptr(false), - // IsSystem: to.Ptr(false), - // ServiceObjectiveName: to.Ptr("DS1000"), - // }, - // }, - // { - // Name: to.Ptr("07479569-6d70-47a5-8db6-0af55d34f2c1"), - // Type: to.Ptr("Microsoft.Sql/servers/serviceObjectives"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/sqlcrudtest/serviceObjectives/07479569-6d70-47a5-8db6-0af55d34f2c1"), - // Properties: &armsql.ServiceObjectiveProperties{ - // Enabled: to.Ptr(true), - // IsDefault: to.Ptr(false), - // IsSystem: to.Ptr(false), - // ServiceObjectiveName: to.Ptr("DS1200"), - // }, - // }, - // { - // Name: to.Ptr("2d79baec-2879-46d5-9f5d-fb70eb004c4e"), - // Type: to.Ptr("Microsoft.Sql/servers/serviceObjectives"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/sqlcrudtest/serviceObjectives/2d79baec-2879-46d5-9f5d-fb70eb004c4e"), - // Properties: &armsql.ServiceObjectiveProperties{ - // Enabled: to.Ptr(true), - // IsDefault: to.Ptr(false), - // IsSystem: to.Ptr(false), - // ServiceObjectiveName: to.Ptr("DS1500"), - // }, - // }, - // { - // Name: to.Ptr("7fb5389f-6d15-4e0b-9540-fe5ecdfdbeee"), - // Type: to.Ptr("Microsoft.Sql/servers/serviceObjectives"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/sqlcrudtest/serviceObjectives/7fb5389f-6d15-4e0b-9540-fe5ecdfdbeee"), - // Properties: &armsql.ServiceObjectiveProperties{ - // Enabled: to.Ptr(true), - // IsDefault: to.Ptr(false), - // IsSystem: to.Ptr(false), - // ServiceObjectiveName: to.Ptr("DS2000"), - // }, - // }, - // { - // Name: to.Ptr("d1737d22-a8ea-4de7-9bd0-33395d2a7419"), - // Type: to.Ptr("Microsoft.Sql/servers/serviceObjectives"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/sqlcrudtest/serviceObjectives/d1737d22-a8ea-4de7-9bd0-33395d2a7419"), - // Properties: &armsql.ServiceObjectiveProperties{ - // Enabled: to.Ptr(true), - // IsDefault: to.Ptr(false), - // IsSystem: to.Ptr(false), - // ServiceObjectiveName: to.Ptr("ElasticPool"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/sql/armsql/startstopmanagedinstanceschedules_client.go b/sdk/resourcemanager/sql/armsql/startstopmanagedinstanceschedules_client.go new file mode 100644 index 000000000000..24fcdb7d87b3 --- /dev/null +++ b/sdk/resourcemanager/sql/armsql/startstopmanagedinstanceschedules_client.go @@ -0,0 +1,309 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armsql + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// StartStopManagedInstanceSchedulesClient contains the methods for the StartStopManagedInstanceSchedules group. +// Don't use this type directly, use NewStartStopManagedInstanceSchedulesClient() instead. +type StartStopManagedInstanceSchedulesClient struct { + internal *arm.Client + subscriptionID string +} + +// NewStartStopManagedInstanceSchedulesClient creates a new instance of StartStopManagedInstanceSchedulesClient with the specified values. +// - subscriptionID - The subscription ID that identifies an Azure subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewStartStopManagedInstanceSchedulesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*StartStopManagedInstanceSchedulesClient, error) { + cl, err := arm.NewClient(moduleName+".StartStopManagedInstanceSchedulesClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &StartStopManagedInstanceSchedulesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// CreateOrUpdate - Creates or updates the managed instance's Start/Stop schedule. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-11-01-preview +// - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure +// Resource Manager API or the portal. +// - managedInstanceName - The name of the managed instance. +// - startStopScheduleName - Name of the managed instance Start/Stop schedule. +// - parameters - The requested managed instance Start/Stop schedule. +// - options - StartStopManagedInstanceSchedulesClientCreateOrUpdateOptions contains the optional parameters for the StartStopManagedInstanceSchedulesClient.CreateOrUpdate +// method. +func (client *StartStopManagedInstanceSchedulesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, managedInstanceName string, startStopScheduleName StartStopScheduleName, parameters StartStopManagedInstanceSchedule, options *StartStopManagedInstanceSchedulesClientCreateOrUpdateOptions) (StartStopManagedInstanceSchedulesClientCreateOrUpdateResponse, error) { + var err error + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, managedInstanceName, startStopScheduleName, parameters, options) + if err != nil { + return StartStopManagedInstanceSchedulesClientCreateOrUpdateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return StartStopManagedInstanceSchedulesClientCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return StartStopManagedInstanceSchedulesClientCreateOrUpdateResponse{}, err + } + resp, err := client.createOrUpdateHandleResponse(httpResp) + return resp, err +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *StartStopManagedInstanceSchedulesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, managedInstanceName string, startStopScheduleName StartStopScheduleName, parameters StartStopManagedInstanceSchedule, options *StartStopManagedInstanceSchedulesClientCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/startStopSchedules/{startStopScheduleName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if managedInstanceName == "" { + return nil, errors.New("parameter managedInstanceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{managedInstanceName}", url.PathEscape(managedInstanceName)) + if startStopScheduleName == "" { + return nil, errors.New("parameter startStopScheduleName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{startStopScheduleName}", url.PathEscape(string(startStopScheduleName))) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// createOrUpdateHandleResponse handles the CreateOrUpdate response. +func (client *StartStopManagedInstanceSchedulesClient) createOrUpdateHandleResponse(resp *http.Response) (StartStopManagedInstanceSchedulesClientCreateOrUpdateResponse, error) { + result := StartStopManagedInstanceSchedulesClientCreateOrUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.StartStopManagedInstanceSchedule); err != nil { + return StartStopManagedInstanceSchedulesClientCreateOrUpdateResponse{}, err + } + return result, nil +} + +// Delete - Deletes the managed instance's Start/Stop schedule. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-11-01-preview +// - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure +// Resource Manager API or the portal. +// - managedInstanceName - The name of the managed instance. +// - startStopScheduleName - Name of the managed instance Start/Stop schedule. +// - options - StartStopManagedInstanceSchedulesClientDeleteOptions contains the optional parameters for the StartStopManagedInstanceSchedulesClient.Delete +// method. +func (client *StartStopManagedInstanceSchedulesClient) Delete(ctx context.Context, resourceGroupName string, managedInstanceName string, startStopScheduleName StartStopScheduleName, options *StartStopManagedInstanceSchedulesClientDeleteOptions) (StartStopManagedInstanceSchedulesClientDeleteResponse, error) { + var err error + req, err := client.deleteCreateRequest(ctx, resourceGroupName, managedInstanceName, startStopScheduleName, options) + if err != nil { + return StartStopManagedInstanceSchedulesClientDeleteResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return StartStopManagedInstanceSchedulesClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return StartStopManagedInstanceSchedulesClientDeleteResponse{}, err + } + return StartStopManagedInstanceSchedulesClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *StartStopManagedInstanceSchedulesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, managedInstanceName string, startStopScheduleName StartStopScheduleName, options *StartStopManagedInstanceSchedulesClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/startStopSchedules/{startStopScheduleName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if managedInstanceName == "" { + return nil, errors.New("parameter managedInstanceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{managedInstanceName}", url.PathEscape(managedInstanceName)) + if startStopScheduleName == "" { + return nil, errors.New("parameter startStopScheduleName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{startStopScheduleName}", url.PathEscape(string(startStopScheduleName))) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + return req, nil +} + +// Get - Gets the managed instance's Start/Stop schedule. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-11-01-preview +// - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure +// Resource Manager API or the portal. +// - managedInstanceName - The name of the managed instance. +// - startStopScheduleName - Name of the managed instance Start/Stop schedule. +// - options - StartStopManagedInstanceSchedulesClientGetOptions contains the optional parameters for the StartStopManagedInstanceSchedulesClient.Get +// method. +func (client *StartStopManagedInstanceSchedulesClient) Get(ctx context.Context, resourceGroupName string, managedInstanceName string, startStopScheduleName StartStopScheduleName, options *StartStopManagedInstanceSchedulesClientGetOptions) (StartStopManagedInstanceSchedulesClientGetResponse, error) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, managedInstanceName, startStopScheduleName, options) + if err != nil { + return StartStopManagedInstanceSchedulesClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return StartStopManagedInstanceSchedulesClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return StartStopManagedInstanceSchedulesClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *StartStopManagedInstanceSchedulesClient) getCreateRequest(ctx context.Context, resourceGroupName string, managedInstanceName string, startStopScheduleName StartStopScheduleName, options *StartStopManagedInstanceSchedulesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/startStopSchedules/{startStopScheduleName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if managedInstanceName == "" { + return nil, errors.New("parameter managedInstanceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{managedInstanceName}", url.PathEscape(managedInstanceName)) + if startStopScheduleName == "" { + return nil, errors.New("parameter startStopScheduleName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{startStopScheduleName}", url.PathEscape(string(startStopScheduleName))) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *StartStopManagedInstanceSchedulesClient) getHandleResponse(resp *http.Response) (StartStopManagedInstanceSchedulesClientGetResponse, error) { + result := StartStopManagedInstanceSchedulesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.StartStopManagedInstanceSchedule); err != nil { + return StartStopManagedInstanceSchedulesClientGetResponse{}, err + } + return result, nil +} + +// NewListByInstancePager - Lists the managed instance's Start/Stop schedules. +// +// Generated from API version 2022-11-01-preview +// - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure +// Resource Manager API or the portal. +// - managedInstanceName - The name of the managed instance. +// - options - StartStopManagedInstanceSchedulesClientListByInstanceOptions contains the optional parameters for the StartStopManagedInstanceSchedulesClient.NewListByInstancePager +// method. +func (client *StartStopManagedInstanceSchedulesClient) NewListByInstancePager(resourceGroupName string, managedInstanceName string, options *StartStopManagedInstanceSchedulesClientListByInstanceOptions) *runtime.Pager[StartStopManagedInstanceSchedulesClientListByInstanceResponse] { + return runtime.NewPager(runtime.PagingHandler[StartStopManagedInstanceSchedulesClientListByInstanceResponse]{ + More: func(page StartStopManagedInstanceSchedulesClientListByInstanceResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *StartStopManagedInstanceSchedulesClientListByInstanceResponse) (StartStopManagedInstanceSchedulesClientListByInstanceResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByInstanceCreateRequest(ctx, resourceGroupName, managedInstanceName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return StartStopManagedInstanceSchedulesClientListByInstanceResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return StartStopManagedInstanceSchedulesClientListByInstanceResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return StartStopManagedInstanceSchedulesClientListByInstanceResponse{}, runtime.NewResponseError(resp) + } + return client.listByInstanceHandleResponse(resp) + }, + }) +} + +// listByInstanceCreateRequest creates the ListByInstance request. +func (client *StartStopManagedInstanceSchedulesClient) listByInstanceCreateRequest(ctx context.Context, resourceGroupName string, managedInstanceName string, options *StartStopManagedInstanceSchedulesClientListByInstanceOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/startStopSchedules" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if managedInstanceName == "" { + return nil, errors.New("parameter managedInstanceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{managedInstanceName}", url.PathEscape(managedInstanceName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByInstanceHandleResponse handles the ListByInstance response. +func (client *StartStopManagedInstanceSchedulesClient) listByInstanceHandleResponse(resp *http.Response) (StartStopManagedInstanceSchedulesClientListByInstanceResponse, error) { + result := StartStopManagedInstanceSchedulesClientListByInstanceResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.StartStopManagedInstanceScheduleListResult); err != nil { + return StartStopManagedInstanceSchedulesClientListByInstanceResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/sql/armsql/subscriptionusages_client.go b/sdk/resourcemanager/sql/armsql/subscriptionusages_client.go index 352e774d3350..fc5894dd1a0d 100644 --- a/sdk/resourcemanager/sql/armsql/subscriptionusages_client.go +++ b/sdk/resourcemanager/sql/armsql/subscriptionusages_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armsql @@ -47,23 +46,26 @@ func NewSubscriptionUsagesClient(subscriptionID string, credential azcore.TokenC // Get - Gets a subscription usage metric. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - locationName - The name of the region where the resource is located. // - usageName - Name of usage metric to return. // - options - SubscriptionUsagesClientGetOptions contains the optional parameters for the SubscriptionUsagesClient.Get method. func (client *SubscriptionUsagesClient) Get(ctx context.Context, locationName string, usageName string, options *SubscriptionUsagesClientGetOptions) (SubscriptionUsagesClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, locationName, usageName, options) if err != nil { return SubscriptionUsagesClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return SubscriptionUsagesClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return SubscriptionUsagesClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return SubscriptionUsagesClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -86,7 +88,7 @@ func (client *SubscriptionUsagesClient) getCreateRequest(ctx context.Context, lo return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -103,7 +105,7 @@ func (client *SubscriptionUsagesClient) getHandleResponse(resp *http.Response) ( // NewListByLocationPager - Gets all subscription usage metrics in a given location. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - locationName - The name of the region where the resource is located. // - options - SubscriptionUsagesClientListByLocationOptions contains the optional parameters for the SubscriptionUsagesClient.NewListByLocationPager // method. @@ -151,7 +153,7 @@ func (client *SubscriptionUsagesClient) listByLocationCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/sql/armsql/subscriptionusages_client_example_test.go b/sdk/resourcemanager/sql/armsql/subscriptionusages_client_example_test.go deleted file mode 100644 index 3b7dae11ec0b..000000000000 --- a/sdk/resourcemanager/sql/armsql/subscriptionusages_client_example_test.go +++ /dev/null @@ -1,110 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsql_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sql/armsql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SubscriptionUsageListByLocation.json -func ExampleSubscriptionUsagesClient_NewListByLocationPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewSubscriptionUsagesClient().NewListByLocationPager("WestUS", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.SubscriptionUsageListResult = armsql.SubscriptionUsageListResult{ - // Value: []*armsql.SubscriptionUsage{ - // { - // Name: to.Ptr("ServerQuota"), - // Type: to.Ptr("Microsoft.Sql/locations/usages"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/providers/Microsoft.Sql/locations/Onebox/usages/ServerQuota"), - // Properties: &armsql.SubscriptionUsageProperties{ - // CurrentValue: to.Ptr[float64](1), - // DisplayName: to.Ptr("Regional Server Quota for West US"), - // Limit: to.Ptr[float64](20), - // Unit: to.Ptr("Count"), - // }, - // }, - // { - // Name: to.Ptr("SubscriptionFreeDatabaseCount"), - // Type: to.Ptr("Microsoft.Sql/locations/usages"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/providers/Microsoft.Sql/locations/Onebox/usages/SubscriptionFreeDatabaseCount"), - // Properties: &armsql.SubscriptionUsageProperties{ - // CurrentValue: to.Ptr[float64](0), - // DisplayName: to.Ptr("Free Database Count per Subscription for West US"), - // Limit: to.Ptr[float64](1), - // Unit: to.Ptr("Count"), - // }, - // }, - // { - // Name: to.Ptr("SubscriptionFreeDatabaseDaysLeft"), - // Type: to.Ptr("Microsoft.Sql/locations/usages"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/providers/Microsoft.Sql/locations/Onebox/usages/SubscriptionFreeDatabaseDaysLeft"), - // Properties: &armsql.SubscriptionUsageProperties{ - // CurrentValue: to.Ptr[float64](365), - // DisplayName: to.Ptr("Free to Basic Database Upgrade count-down in West US"), - // Limit: to.Ptr[float64](365), - // Unit: to.Ptr("Count"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SubscriptionUsageGet.json -func ExampleSubscriptionUsagesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewSubscriptionUsagesClient().Get(ctx, "WestUS", "ServerQuota", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.SubscriptionUsage = armsql.SubscriptionUsage{ - // Name: to.Ptr("ServerQuota"), - // Type: to.Ptr("Microsoft.Sql/locations/usages"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/providers/Microsoft.Sql/locations/Onebox/usages/ServerQuota"), - // Properties: &armsql.SubscriptionUsageProperties{ - // CurrentValue: to.Ptr[float64](1), - // DisplayName: to.Ptr("Regional Server Quota for West US"), - // Limit: to.Ptr[float64](20), - // Unit: to.Ptr("Count"), - // }, - // } -} diff --git a/sdk/resourcemanager/sql/armsql/synapselinkworkspaces_client.go b/sdk/resourcemanager/sql/armsql/synapselinkworkspaces_client.go new file mode 100644 index 000000000000..187d62345684 --- /dev/null +++ b/sdk/resourcemanager/sql/armsql/synapselinkworkspaces_client.go @@ -0,0 +1,120 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armsql + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// SynapseLinkWorkspacesClient contains the methods for the SynapseLinkWorkspaces group. +// Don't use this type directly, use NewSynapseLinkWorkspacesClient() instead. +type SynapseLinkWorkspacesClient struct { + internal *arm.Client + subscriptionID string +} + +// NewSynapseLinkWorkspacesClient creates a new instance of SynapseLinkWorkspacesClient with the specified values. +// - subscriptionID - The subscription ID that identifies an Azure subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewSynapseLinkWorkspacesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*SynapseLinkWorkspacesClient, error) { + cl, err := arm.NewClient(moduleName+".SynapseLinkWorkspacesClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &SynapseLinkWorkspacesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// NewListByDatabasePager - Gets all synapselink workspaces for a database. +// +// Generated from API version 2022-11-01-preview +// - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure +// Resource Manager API or the portal. +// - serverName - The name of the server. +// - databaseName - The name of the database. +// - options - SynapseLinkWorkspacesClientListByDatabaseOptions contains the optional parameters for the SynapseLinkWorkspacesClient.NewListByDatabasePager +// method. +func (client *SynapseLinkWorkspacesClient) NewListByDatabasePager(resourceGroupName string, serverName string, databaseName string, options *SynapseLinkWorkspacesClientListByDatabaseOptions) *runtime.Pager[SynapseLinkWorkspacesClientListByDatabaseResponse] { + return runtime.NewPager(runtime.PagingHandler[SynapseLinkWorkspacesClientListByDatabaseResponse]{ + More: func(page SynapseLinkWorkspacesClientListByDatabaseResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *SynapseLinkWorkspacesClientListByDatabaseResponse) (SynapseLinkWorkspacesClientListByDatabaseResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByDatabaseCreateRequest(ctx, resourceGroupName, serverName, databaseName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return SynapseLinkWorkspacesClientListByDatabaseResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return SynapseLinkWorkspacesClientListByDatabaseResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return SynapseLinkWorkspacesClientListByDatabaseResponse{}, runtime.NewResponseError(resp) + } + return client.listByDatabaseHandleResponse(resp) + }, + }) +} + +// listByDatabaseCreateRequest creates the ListByDatabase request. +func (client *SynapseLinkWorkspacesClient) listByDatabaseCreateRequest(ctx context.Context, resourceGroupName string, serverName string, databaseName string, options *SynapseLinkWorkspacesClientListByDatabaseOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/linkWorkspaces" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serverName == "" { + return nil, errors.New("parameter serverName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serverName}", url.PathEscape(serverName)) + if databaseName == "" { + return nil, errors.New("parameter databaseName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{databaseName}", url.PathEscape(databaseName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByDatabaseHandleResponse handles the ListByDatabase response. +func (client *SynapseLinkWorkspacesClient) listByDatabaseHandleResponse(resp *http.Response) (SynapseLinkWorkspacesClientListByDatabaseResponse, error) { + result := SynapseLinkWorkspacesClientListByDatabaseResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SynapseLinkWorkspaceListResult); err != nil { + return SynapseLinkWorkspacesClientListByDatabaseResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/sql/armsql/syncagents_client.go b/sdk/resourcemanager/sql/armsql/syncagents_client.go index 9343428a7478..88a6e9e8f21a 100644 --- a/sdk/resourcemanager/sql/armsql/syncagents_client.go +++ b/sdk/resourcemanager/sql/armsql/syncagents_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armsql @@ -47,7 +46,7 @@ func NewSyncAgentsClient(subscriptionID string, credential azcore.TokenCredentia // BeginCreateOrUpdate - Creates or updates a sync agent. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server on which the sync agent is hosted. @@ -61,7 +60,8 @@ func (client *SyncAgentsClient) BeginCreateOrUpdate(ctx context.Context, resourc if err != nil { return nil, err } - return runtime.NewPoller[SyncAgentsClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[SyncAgentsClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[SyncAgentsClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -70,20 +70,22 @@ func (client *SyncAgentsClient) BeginCreateOrUpdate(ctx context.Context, resourc // CreateOrUpdate - Creates or updates a sync agent. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview func (client *SyncAgentsClient) createOrUpdate(ctx context.Context, resourceGroupName string, serverName string, syncAgentName string, parameters SyncAgent, options *SyncAgentsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, serverName, syncAgentName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createOrUpdateCreateRequest creates the CreateOrUpdate request. @@ -110,16 +112,19 @@ func (client *SyncAgentsClient) createOrUpdateCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // BeginDelete - Deletes a sync agent. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server on which the sync agent is hosted. @@ -131,7 +136,8 @@ func (client *SyncAgentsClient) BeginDelete(ctx context.Context, resourceGroupNa if err != nil { return nil, err } - return runtime.NewPoller[SyncAgentsClientDeleteResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[SyncAgentsClientDeleteResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[SyncAgentsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -140,20 +146,22 @@ func (client *SyncAgentsClient) BeginDelete(ctx context.Context, resourceGroupNa // Delete - Deletes a sync agent. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview func (client *SyncAgentsClient) deleteOperation(ctx context.Context, resourceGroupName string, serverName string, syncAgentName string, options *SyncAgentsClientBeginDeleteOptions) (*http.Response, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, serverName, syncAgentName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteCreateRequest creates the Delete request. @@ -180,7 +188,7 @@ func (client *SyncAgentsClient) deleteCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -188,25 +196,28 @@ func (client *SyncAgentsClient) deleteCreateRequest(ctx context.Context, resourc // GenerateKey - Generates a sync agent key. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server on which the sync agent is hosted. // - syncAgentName - The name of the sync agent. // - options - SyncAgentsClientGenerateKeyOptions contains the optional parameters for the SyncAgentsClient.GenerateKey method. func (client *SyncAgentsClient) GenerateKey(ctx context.Context, resourceGroupName string, serverName string, syncAgentName string, options *SyncAgentsClientGenerateKeyOptions) (SyncAgentsClientGenerateKeyResponse, error) { + var err error req, err := client.generateKeyCreateRequest(ctx, resourceGroupName, serverName, syncAgentName, options) if err != nil { return SyncAgentsClientGenerateKeyResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return SyncAgentsClientGenerateKeyResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return SyncAgentsClientGenerateKeyResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return SyncAgentsClientGenerateKeyResponse{}, err } - return client.generateKeyHandleResponse(resp) + resp, err := client.generateKeyHandleResponse(httpResp) + return resp, err } // generateKeyCreateRequest creates the GenerateKey request. @@ -233,7 +244,7 @@ func (client *SyncAgentsClient) generateKeyCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -251,25 +262,28 @@ func (client *SyncAgentsClient) generateKeyHandleResponse(resp *http.Response) ( // Get - Gets a sync agent. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server on which the sync agent is hosted. // - syncAgentName - The name of the sync agent. // - options - SyncAgentsClientGetOptions contains the optional parameters for the SyncAgentsClient.Get method. func (client *SyncAgentsClient) Get(ctx context.Context, resourceGroupName string, serverName string, syncAgentName string, options *SyncAgentsClientGetOptions) (SyncAgentsClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, serverName, syncAgentName, options) if err != nil { return SyncAgentsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return SyncAgentsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return SyncAgentsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return SyncAgentsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -296,7 +310,7 @@ func (client *SyncAgentsClient) getCreateRequest(ctx context.Context, resourceGr return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -313,7 +327,7 @@ func (client *SyncAgentsClient) getHandleResponse(resp *http.Response) (SyncAgen // NewListByServerPager - Lists sync agents in a server. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server on which the sync agent is hosted. @@ -367,7 +381,7 @@ func (client *SyncAgentsClient) listByServerCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -384,7 +398,7 @@ func (client *SyncAgentsClient) listByServerHandleResponse(resp *http.Response) // NewListLinkedDatabasesPager - Lists databases linked to a sync agent. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server on which the sync agent is hosted. @@ -443,7 +457,7 @@ func (client *SyncAgentsClient) listLinkedDatabasesCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/sql/armsql/syncagents_client_example_test.go b/sdk/resourcemanager/sql/armsql/syncagents_client_example_test.go deleted file mode 100644 index 17bdae791bfc..000000000000 --- a/sdk/resourcemanager/sql/armsql/syncagents_client_example_test.go +++ /dev/null @@ -1,254 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsql_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sql/armsql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SyncAgentGet.json -func ExampleSyncAgentsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewSyncAgentsClient().Get(ctx, "syncagentcrud-65440", "syncagentcrud-8475", "syncagentcrud-3187", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.SyncAgent = armsql.SyncAgent{ - // Name: to.Ptr("syncagent"), - // Type: to.Ptr("Microsoft.Sql/servers/syncAgents"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-Onebox/providers/Microsoft.Sql/servers/syncagentcrud-8475/syncAgents/syncagentcrud-3187"), - // Properties: &armsql.SyncAgentProperties{ - // ExpiryTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "9999-12-31T23:59:59.9999999Z"); return t}()), - // IsUpToDate: to.Ptr(true), - // State: to.Ptr(armsql.SyncAgentStateNeverConnected), - // SyncDatabaseID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-Onebox/providers/Microsoft.Sql/servers/syncagentcrud-8475/databases/sync"), - // Version: to.Ptr("4.2.0.0"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SyncAgentCreate.json -func ExampleSyncAgentsClient_BeginCreateOrUpdate_createANewSyncAgent() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSyncAgentsClient().BeginCreateOrUpdate(ctx, "syncagentcrud-65440", "syncagentcrud-8475", "syncagentcrud-3187", armsql.SyncAgent{ - Properties: &armsql.SyncAgentProperties{ - SyncDatabaseID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-Onebox/providers/Microsoft.Sql/servers/syncagentcrud-8475/databases/sync"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.SyncAgent = armsql.SyncAgent{ - // Name: to.Ptr("syncagent"), - // Type: to.Ptr("Microsoft.Sql/servers/syncAgents"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-Onebox/providers/Microsoft.Sql/servers/syncagentcrud-8475/syncAgents/syncagentcrud-3187"), - // Properties: &armsql.SyncAgentProperties{ - // ExpiryTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "9999-12-31T23:59:59.9999999Z"); return t}()), - // IsUpToDate: to.Ptr(true), - // State: to.Ptr(armsql.SyncAgentStateNeverConnected), - // SyncDatabaseID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-Onebox/providers/Microsoft.Sql/servers/syncagentcrud-8475/databases/sync"), - // Version: to.Ptr("4.2.0.0"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SyncAgentUpdate.json -func ExampleSyncAgentsClient_BeginCreateOrUpdate_updateASyncAgent() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSyncAgentsClient().BeginCreateOrUpdate(ctx, "syncagentcrud-65440", "syncagentcrud-8475", "syncagentcrud-3187", armsql.SyncAgent{ - Properties: &armsql.SyncAgentProperties{ - SyncDatabaseID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-Onebox/providers/Microsoft.Sql/servers/syncagentcrud-8475/databases/sync"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.SyncAgent = armsql.SyncAgent{ - // Name: to.Ptr("syncagent"), - // Type: to.Ptr("Microsoft.Sql/servers/syncAgents"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-Onebox/providers/Microsoft.Sql/servers/syncagentcrud-8475/syncAgents/syncagentcrud-3187"), - // Properties: &armsql.SyncAgentProperties{ - // ExpiryTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "9999-12-31T23:59:59.9999999Z"); return t}()), - // IsUpToDate: to.Ptr(true), - // State: to.Ptr(armsql.SyncAgentStateNeverConnected), - // SyncDatabaseID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-Onebox/providers/Microsoft.Sql/servers/syncagentcrud-8475/databases/sync"), - // Version: to.Ptr("4.2.0.0"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SyncAgentDelete.json -func ExampleSyncAgentsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSyncAgentsClient().BeginDelete(ctx, "syncagentcrud-65440", "syncagentcrud-8475", "syncagentcrud-3187", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SyncAgentListByServer.json -func ExampleSyncAgentsClient_NewListByServerPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewSyncAgentsClient().NewListByServerPager("syncagentcrud-65440", "syncagentcrud-8475", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.SyncAgentListResult = armsql.SyncAgentListResult{ - // Value: []*armsql.SyncAgent{ - // { - // Name: to.Ptr("syncagent"), - // Type: to.Ptr("Microsoft.Sql/servers/syncAgents"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-Onebox/providers/Microsoft.Sql/servers/syncagentcrud-8475/syncAgents/syncagentcrud-3187"), - // Properties: &armsql.SyncAgentProperties{ - // ExpiryTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "9999-12-31T23:59:59.9999999Z"); return t}()), - // IsUpToDate: to.Ptr(true), - // State: to.Ptr(armsql.SyncAgentStateNeverConnected), - // SyncDatabaseID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-Onebox/providers/Microsoft.Sql/servers/syncagentcrud-8475/databases/sync"), - // Version: to.Ptr("4.2.0.0"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SyncAgentGenerateKey.json -func ExampleSyncAgentsClient_GenerateKey() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewSyncAgentsClient().GenerateKey(ctx, "syncagentcrud-65440", "syncagentcrud-8475", "syncagentcrud-3187", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.SyncAgentKeyProperties = armsql.SyncAgentKeyProperties{ - // SyncAgentKey: to.Ptr("865f9998-6dae-4214-bbb1-4796b7c76ca0:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX=:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX="), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SyncAgentGetLinkedDatabases.json -func ExampleSyncAgentsClient_NewListLinkedDatabasesPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewSyncAgentsClient().NewListLinkedDatabasesPager("syncagentcrud-65440", "syncagentcrud-8475", "syncagentcrud-3187", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.SyncAgentLinkedDatabaseListResult = armsql.SyncAgentLinkedDatabaseListResult{ - // Value: []*armsql.SyncAgentLinkedDatabase{ - // { - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-Onebox/providers/Microsoft.Sql/servers/syncagentcrud-8475/syncAgents/syncagentcrud-3187/linkedDatabases/55555555-6666-7777-8888-999999999999"), - // Properties: &armsql.SyncAgentLinkedDatabaseProperties{ - // Description: to.Ptr(""), - // DatabaseID: to.Ptr("55555555-6666-7777-8888-999999999999"), - // DatabaseName: to.Ptr("DummySqlServerDb"), - // DatabaseType: to.Ptr(armsql.SyncMemberDbTypeSQLServerDatabase), - // ServerName: to.Ptr("DummySqlServer"), - // UserName: to.Ptr("DummyUser"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/sql/armsql/syncgroups_client.go b/sdk/resourcemanager/sql/armsql/syncgroups_client.go index 58c567bc1286..6bf508be2c1d 100644 --- a/sdk/resourcemanager/sql/armsql/syncgroups_client.go +++ b/sdk/resourcemanager/sql/armsql/syncgroups_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armsql @@ -47,7 +46,7 @@ func NewSyncGroupsClient(subscriptionID string, credential azcore.TokenCredentia // CancelSync - Cancels a sync group synchronization. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -55,16 +54,18 @@ func NewSyncGroupsClient(subscriptionID string, credential azcore.TokenCredentia // - syncGroupName - The name of the sync group. // - options - SyncGroupsClientCancelSyncOptions contains the optional parameters for the SyncGroupsClient.CancelSync method. func (client *SyncGroupsClient) CancelSync(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string, options *SyncGroupsClientCancelSyncOptions) (SyncGroupsClientCancelSyncResponse, error) { + var err error req, err := client.cancelSyncCreateRequest(ctx, resourceGroupName, serverName, databaseName, syncGroupName, options) if err != nil { return SyncGroupsClientCancelSyncResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return SyncGroupsClientCancelSyncResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return SyncGroupsClientCancelSyncResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return SyncGroupsClientCancelSyncResponse{}, err } return SyncGroupsClientCancelSyncResponse{}, nil } @@ -97,7 +98,7 @@ func (client *SyncGroupsClient) cancelSyncCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -105,7 +106,7 @@ func (client *SyncGroupsClient) cancelSyncCreateRequest(ctx context.Context, res // BeginCreateOrUpdate - Creates or updates a sync group. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -120,7 +121,8 @@ func (client *SyncGroupsClient) BeginCreateOrUpdate(ctx context.Context, resourc if err != nil { return nil, err } - return runtime.NewPoller[SyncGroupsClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[SyncGroupsClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[SyncGroupsClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -129,20 +131,22 @@ func (client *SyncGroupsClient) BeginCreateOrUpdate(ctx context.Context, resourc // CreateOrUpdate - Creates or updates a sync group. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview func (client *SyncGroupsClient) createOrUpdate(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string, parameters SyncGroup, options *SyncGroupsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, serverName, databaseName, syncGroupName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createOrUpdateCreateRequest creates the CreateOrUpdate request. @@ -173,16 +177,19 @@ func (client *SyncGroupsClient) createOrUpdateCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // BeginDelete - Deletes a sync group. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -195,7 +202,8 @@ func (client *SyncGroupsClient) BeginDelete(ctx context.Context, resourceGroupNa if err != nil { return nil, err } - return runtime.NewPoller[SyncGroupsClientDeleteResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[SyncGroupsClientDeleteResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[SyncGroupsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -204,20 +212,22 @@ func (client *SyncGroupsClient) BeginDelete(ctx context.Context, resourceGroupNa // Delete - Deletes a sync group. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview func (client *SyncGroupsClient) deleteOperation(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string, options *SyncGroupsClientBeginDeleteOptions) (*http.Response, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, serverName, databaseName, syncGroupName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteCreateRequest creates the Delete request. @@ -248,7 +258,7 @@ func (client *SyncGroupsClient) deleteCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -256,7 +266,7 @@ func (client *SyncGroupsClient) deleteCreateRequest(ctx context.Context, resourc // Get - Gets a sync group. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -264,18 +274,21 @@ func (client *SyncGroupsClient) deleteCreateRequest(ctx context.Context, resourc // - syncGroupName - The name of the sync group. // - options - SyncGroupsClientGetOptions contains the optional parameters for the SyncGroupsClient.Get method. func (client *SyncGroupsClient) Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string, options *SyncGroupsClientGetOptions) (SyncGroupsClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, serverName, databaseName, syncGroupName, options) if err != nil { return SyncGroupsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return SyncGroupsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return SyncGroupsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return SyncGroupsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -306,7 +319,7 @@ func (client *SyncGroupsClient) getCreateRequest(ctx context.Context, resourceGr return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -323,7 +336,7 @@ func (client *SyncGroupsClient) getHandleResponse(resp *http.Response) (SyncGrou // NewListByDatabasePager - Lists sync groups under a hub database. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -382,7 +395,7 @@ func (client *SyncGroupsClient) listByDatabaseCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -399,7 +412,7 @@ func (client *SyncGroupsClient) listByDatabaseHandleResponse(resp *http.Response // NewListHubSchemasPager - Gets a collection of hub database schemas. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -463,7 +476,7 @@ func (client *SyncGroupsClient) listHubSchemasCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -480,7 +493,7 @@ func (client *SyncGroupsClient) listHubSchemasHandleResponse(resp *http.Response // NewListLogsPager - Gets a collection of sync group logs. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -552,7 +565,7 @@ func (client *SyncGroupsClient) listLogsCreateRequest(ctx context.Context, resou if options != nil && options.ContinuationToken != nil { reqQP.Set("continuationToken", *options.ContinuationToken) } - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -569,7 +582,7 @@ func (client *SyncGroupsClient) listLogsHandleResponse(resp *http.Response) (Syn // NewListSyncDatabaseIDsPager - Gets a collection of sync database ids. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - locationName - The name of the region where the resource is located. // - options - SyncGroupsClientListSyncDatabaseIDsOptions contains the optional parameters for the SyncGroupsClient.NewListSyncDatabaseIDsPager // method. @@ -617,7 +630,7 @@ func (client *SyncGroupsClient) listSyncDatabaseIDsCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -635,7 +648,7 @@ func (client *SyncGroupsClient) listSyncDatabaseIDsHandleResponse(resp *http.Res // BeginRefreshHubSchema - Refreshes a hub database schema. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -649,7 +662,8 @@ func (client *SyncGroupsClient) BeginRefreshHubSchema(ctx context.Context, resou if err != nil { return nil, err } - return runtime.NewPoller[SyncGroupsClientRefreshHubSchemaResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[SyncGroupsClientRefreshHubSchemaResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[SyncGroupsClientRefreshHubSchemaResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -658,20 +672,22 @@ func (client *SyncGroupsClient) BeginRefreshHubSchema(ctx context.Context, resou // RefreshHubSchema - Refreshes a hub database schema. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview func (client *SyncGroupsClient) refreshHubSchema(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string, options *SyncGroupsClientBeginRefreshHubSchemaOptions) (*http.Response, error) { + var err error req, err := client.refreshHubSchemaCreateRequest(ctx, resourceGroupName, serverName, databaseName, syncGroupName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // refreshHubSchemaCreateRequest creates the RefreshHubSchema request. @@ -702,7 +718,7 @@ func (client *SyncGroupsClient) refreshHubSchemaCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -710,7 +726,7 @@ func (client *SyncGroupsClient) refreshHubSchemaCreateRequest(ctx context.Contex // TriggerSync - Triggers a sync group synchronization. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -718,16 +734,18 @@ func (client *SyncGroupsClient) refreshHubSchemaCreateRequest(ctx context.Contex // - syncGroupName - The name of the sync group. // - options - SyncGroupsClientTriggerSyncOptions contains the optional parameters for the SyncGroupsClient.TriggerSync method. func (client *SyncGroupsClient) TriggerSync(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string, options *SyncGroupsClientTriggerSyncOptions) (SyncGroupsClientTriggerSyncResponse, error) { + var err error req, err := client.triggerSyncCreateRequest(ctx, resourceGroupName, serverName, databaseName, syncGroupName, options) if err != nil { return SyncGroupsClientTriggerSyncResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return SyncGroupsClientTriggerSyncResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return SyncGroupsClientTriggerSyncResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return SyncGroupsClientTriggerSyncResponse{}, err } return SyncGroupsClientTriggerSyncResponse{}, nil } @@ -760,7 +778,7 @@ func (client *SyncGroupsClient) triggerSyncCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -768,7 +786,7 @@ func (client *SyncGroupsClient) triggerSyncCreateRequest(ctx context.Context, re // BeginUpdate - Updates a sync group. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -782,7 +800,8 @@ func (client *SyncGroupsClient) BeginUpdate(ctx context.Context, resourceGroupNa if err != nil { return nil, err } - return runtime.NewPoller[SyncGroupsClientUpdateResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[SyncGroupsClientUpdateResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[SyncGroupsClientUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -791,20 +810,22 @@ func (client *SyncGroupsClient) BeginUpdate(ctx context.Context, resourceGroupNa // Update - Updates a sync group. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview func (client *SyncGroupsClient) update(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string, parameters SyncGroup, options *SyncGroupsClientBeginUpdateOptions) (*http.Response, error) { + var err error req, err := client.updateCreateRequest(ctx, resourceGroupName, serverName, databaseName, syncGroupName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // updateCreateRequest creates the Update request. @@ -835,8 +856,11 @@ func (client *SyncGroupsClient) updateCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } diff --git a/sdk/resourcemanager/sql/armsql/syncgroups_client_example_test.go b/sdk/resourcemanager/sql/armsql/syncgroups_client_example_test.go deleted file mode 100644 index cf0d6ae1e39f..000000000000 --- a/sdk/resourcemanager/sql/armsql/syncgroups_client_example_test.go +++ /dev/null @@ -1,460 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsql_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sql/armsql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SyncGroupGetSyncDatabaseId.json -func ExampleSyncGroupsClient_NewListSyncDatabaseIDsPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewSyncGroupsClient().NewListSyncDatabaseIDsPager("westus", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.SyncDatabaseIDListResult = armsql.SyncDatabaseIDListResult{ - // Value: []*armsql.SyncDatabaseIDProperties{ - // { - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/syncgroupcrud-3521/providers/Microsoft.Sql/servers/syncgroupcrud-8475/databases/syncgroupcrud-4328"), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SyncGroupRefreshHubSchema.json -func ExampleSyncGroupsClient_BeginRefreshHubSchema() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSyncGroupsClient().BeginRefreshHubSchema(ctx, "syncgroupcrud-65440", "syncgroupcrud-8475", "syncgroupcrud-4328", "syncgroupcrud-3187", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SyncGroupGetHubSchema.json -func ExampleSyncGroupsClient_NewListHubSchemasPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewSyncGroupsClient().NewListHubSchemasPager("syncgroupcrud-65440", "syncgroupcrud-8475", "syncgroupcrud-4328", "syncgroupcrud-3187", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.SyncFullSchemaPropertiesListResult = armsql.SyncFullSchemaPropertiesListResult{ - // Value: []*armsql.SyncFullSchemaProperties{ - // { - // LastUpdateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-05-30T07:16:08.21Z"); return t}()), - // Tables: []*armsql.SyncFullSchemaTable{ - // { - // Name: to.Ptr("dbo.myTable"), - // Columns: []*armsql.SyncFullSchemaTableColumn{ - // { - // Name: to.Ptr("intField"), - // DataSize: to.Ptr("4"), - // DataType: to.Ptr("int"), - // HasError: to.Ptr(false), - // IsPrimaryKey: to.Ptr(false), - // QuotedName: to.Ptr("[intField]"), - // }, - // { - // Name: to.Ptr("charField"), - // DataSize: to.Ptr("100"), - // DataType: to.Ptr("nvarchar"), - // HasError: to.Ptr(false), - // IsPrimaryKey: to.Ptr(false), - // QuotedName: to.Ptr("[charField]"), - // }}, - // ErrorID: to.Ptr("Schema_TableHasNoPrimaryKey"), - // HasError: to.Ptr(true), - // QuotedName: to.Ptr("[dbo].[myTable]"), - // }}, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SyncGroupGetLog.json -func ExampleSyncGroupsClient_NewListLogsPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewSyncGroupsClient().NewListLogsPager("syncgroupcrud-65440", "syncgroupcrud-8475", "syncgroupcrud-4328", "syncgroupcrud-3187", "2017-01-01T00:00:00", "2017-12-31T00:00:00", armsql.SyncGroupsTypeAll, &armsql.SyncGroupsClientListLogsOptions{ContinuationToken: nil}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.SyncGroupLogListResult = armsql.SyncGroupLogListResult{ - // Value: []*armsql.SyncGroupLogProperties{ - // { - // Type: to.Ptr(armsql.SyncGroupLogTypeSuccess), - // OperationStatus: to.Ptr("SchemaRefreshSuccess"), - // Source: to.Ptr("syncgroupcrud-8475.database.windows.net/hub"), - // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-05-30T07:16:08.25Z"); return t}()), - // TracingID: to.Ptr("c0480c8e-6269-424e-9404-b00efce0ebae"), - // Details: to.Ptr("Schema information obtained successfully."), - // }, - // { - // Type: to.Ptr(armsql.SyncGroupLogTypeError), - // OperationStatus: to.Ptr("SchemaRefreshFailure"), - // Source: to.Ptr("syncgroupcrud-8475.database.windows.net/member"), - // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-05-30T07:03:37.5733333Z"); return t}()), - // TracingID: to.Ptr("cd3aa28c-0c31-471f-8a77-f1b21c908cbd"), - // Details: to.Ptr("Getting schema information for the database failed with the exception \"Failed to connect to server .\nInner exception: SqlException Error Code: -2146232060 - SqlError Number:53, Message: A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server) \nInner exception: The network path was not found\n For more information, provide tracing ID ‘cd3aa28c-0c31-471f-8a77-f1b21c908cbd’ to customer support.\""), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SyncGroupCancelSync.json -func ExampleSyncGroupsClient_CancelSync() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewSyncGroupsClient().CancelSync(ctx, "syncgroupcrud-65440", "syncgroupcrud-8475", "syncgroupcrud-4328", "syncgroupcrud-3187", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SyncGroupTriggerSync.json -func ExampleSyncGroupsClient_TriggerSync() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewSyncGroupsClient().TriggerSync(ctx, "syncgroupcrud-65440", "syncgroupcrud-8475", "syncgroupcrud-4328", "syncgroupcrud-3187", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SyncGroupGet.json -func ExampleSyncGroupsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewSyncGroupsClient().Get(ctx, "syncgroupcrud-65440", "syncgroupcrud-8475", "syncgroupcrud-4328", "syncgroupcrud-3187", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.SyncGroup = armsql.SyncGroup{ - // Name: to.Ptr("syncgroupcrud-3187"), - // Type: to.Ptr("Microsoft.Sql/servers/databases/syncGroups"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/syncgroupcrud-3521/providers/Microsoft.Sql/servers/syncgroupcrud-8475/databases/syncgroupcrud-4328/syncGroups/syncgroupcrud-3187"), - // Properties: &armsql.SyncGroupProperties{ - // ConflictResolutionPolicy: to.Ptr(armsql.SyncConflictResolutionPolicyHubWin), - // HubDatabaseUserName: to.Ptr("hubUser"), - // Interval: to.Ptr[int32](-1), - // LastSyncTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "0001-01-01T08:00:00Z"); return t}()), - // PrivateEndpointName: to.Ptr("PE_67FDBBD6-B2D8-4014-9CC6-C68ABBCFD481_syncgroupcrud-3187"), - // SyncDatabaseID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/syncgroupcrud-3521/providers/Microsoft.Sql/servers/syncgroupcrud-8475/databases/syncgroupcrud-4328"), - // SyncState: to.Ptr(armsql.SyncGroupStateNotReady), - // UsePrivateLinkConnection: to.Ptr(true), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SyncGroupCreate.json -func ExampleSyncGroupsClient_BeginCreateOrUpdate_createASyncGroup() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSyncGroupsClient().BeginCreateOrUpdate(ctx, "syncgroupcrud-65440", "syncgroupcrud-8475", "syncgroupcrud-4328", "syncgroupcrud-3187", armsql.SyncGroup{ - Properties: &armsql.SyncGroupProperties{ - ConflictResolutionPolicy: to.Ptr(armsql.SyncConflictResolutionPolicyHubWin), - HubDatabaseUserName: to.Ptr("hubUser"), - Interval: to.Ptr[int32](-1), - SyncDatabaseID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/syncgroupcrud-3521/providers/Microsoft.Sql/servers/syncgroupcrud-8475/databases/syncgroupcrud-4328"), - UsePrivateLinkConnection: to.Ptr(true), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.SyncGroup = armsql.SyncGroup{ - // Name: to.Ptr("syncgroupcrud-3187"), - // Type: to.Ptr("Microsoft.Sql/servers/databases/syncGroups"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/syncgroupcrud-3521/providers/Microsoft.Sql/servers/syncgroupcrud-8475/databases/syncgroupcrud-4328/syncGroups/syncgroupcrud-3187"), - // Properties: &armsql.SyncGroupProperties{ - // ConflictResolutionPolicy: to.Ptr(armsql.SyncConflictResolutionPolicyHubWin), - // HubDatabaseUserName: to.Ptr("hubUser"), - // Interval: to.Ptr[int32](-1), - // LastSyncTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "0001-01-01T08:00:00Z"); return t}()), - // PrivateEndpointName: to.Ptr("PE_67FDBBD6-B2D8-4014-9CC6-C68ABBCFD481_syncgroupcrud-8475"), - // SyncDatabaseID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/syncgroupcrud-3521/providers/Microsoft.Sql/servers/syncgroupcrud-8475/databases/syncgroupcrud-4328"), - // SyncState: to.Ptr(armsql.SyncGroupStateNotReady), - // UsePrivateLinkConnection: to.Ptr(true), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SyncGroupUpdate.json -func ExampleSyncGroupsClient_BeginCreateOrUpdate_updateASyncGroup() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSyncGroupsClient().BeginCreateOrUpdate(ctx, "syncgroupcrud-65440", "syncgroupcrud-8475", "syncgroupcrud-4328", "syncgroupcrud-3187", armsql.SyncGroup{ - Properties: &armsql.SyncGroupProperties{ - ConflictResolutionPolicy: to.Ptr(armsql.SyncConflictResolutionPolicyHubWin), - HubDatabaseUserName: to.Ptr("hubUser"), - Interval: to.Ptr[int32](-1), - SyncDatabaseID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/syncgroupcrud-3521/providers/Microsoft.Sql/servers/syncgroupcrud-8475/databases/syncgroupcrud-4328"), - UsePrivateLinkConnection: to.Ptr(true), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.SyncGroup = armsql.SyncGroup{ - // Name: to.Ptr("syncgroupcrud-3187"), - // Type: to.Ptr("Microsoft.Sql/servers/databases/syncGroups"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/syncgroupcrud-3521/providers/Microsoft.Sql/servers/syncgroupcrud-8475/databases/syncgroupcrud-4328/syncGroups/syncgroupcrud-3187"), - // Properties: &armsql.SyncGroupProperties{ - // ConflictResolutionPolicy: to.Ptr(armsql.SyncConflictResolutionPolicyHubWin), - // HubDatabaseUserName: to.Ptr("hubUser"), - // Interval: to.Ptr[int32](-1), - // LastSyncTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "0001-01-01T08:00:00Z"); return t}()), - // PrivateEndpointName: to.Ptr("PE_67FDBBD6-B2D8-4014-9CC6-C68ABBCFD481_syncgroupcrud-3187"), - // SyncDatabaseID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/syncgroupcrud-3521/providers/Microsoft.Sql/servers/syncgroupcrud-8475/databases/syncgroupcrud-4328"), - // SyncState: to.Ptr(armsql.SyncGroupStateNotReady), - // UsePrivateLinkConnection: to.Ptr(true), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SyncGroupDelete.json -func ExampleSyncGroupsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSyncGroupsClient().BeginDelete(ctx, "syncgroupcrud-65440", "syncgroupcrud-8475", "syncgroupcrud-4328", "syncgroupcrud-3187", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SyncGroupPatch.json -func ExampleSyncGroupsClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSyncGroupsClient().BeginUpdate(ctx, "syncgroupcrud-65440", "syncgroupcrud-8475", "syncgroupcrud-4328", "syncgroupcrud-3187", armsql.SyncGroup{ - Properties: &armsql.SyncGroupProperties{ - ConflictResolutionPolicy: to.Ptr(armsql.SyncConflictResolutionPolicyHubWin), - HubDatabasePassword: to.Ptr("hubPassword"), - HubDatabaseUserName: to.Ptr("hubUser"), - Interval: to.Ptr[int32](-1), - SyncDatabaseID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/syncgroupcrud-3521/providers/Microsoft.Sql/servers/syncgroupcrud-8475/databases/syncgroupcrud-4328"), - UsePrivateLinkConnection: to.Ptr(true), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.SyncGroup = armsql.SyncGroup{ - // Name: to.Ptr("syncgroup"), - // Type: to.Ptr("Microsoft.Sql/servers/databases/syncGroups"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/syncgroupcrud-3521/providers/Microsoft.Sql/servers/syncgroupcrud-8475/databases/syncgroupcrud-4328/syncGroups/syncgroupcrud-3187"), - // Properties: &armsql.SyncGroupProperties{ - // ConflictResolutionPolicy: to.Ptr(armsql.SyncConflictResolutionPolicyHubWin), - // HubDatabaseUserName: to.Ptr("hubUser"), - // Interval: to.Ptr[int32](-1), - // LastSyncTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "0001-01-01T08:00:00Z"); return t}()), - // PrivateEndpointName: to.Ptr("PE_67FDBBD6-B2D8-4014-9CC6-C68ABBCFD481_syncgroupcrud-3187"), - // SyncDatabaseID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/syncgroupcrud-3521/providers/Microsoft.Sql/servers/syncgroupcrud-8475/databases/syncgroupcrud-4328"), - // SyncState: to.Ptr(armsql.SyncGroupStateNotReady), - // UsePrivateLinkConnection: to.Ptr(true), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SyncGroupListByDatabase.json -func ExampleSyncGroupsClient_NewListByDatabasePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewSyncGroupsClient().NewListByDatabasePager("syncgroupcrud-65440", "syncgroupcrud-8475", "syncgroupcrud-4328", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.SyncGroupListResult = armsql.SyncGroupListResult{ - // Value: []*armsql.SyncGroup{ - // { - // Name: to.Ptr("syncgroupcrud-3187"), - // Type: to.Ptr("Microsoft.Sql/servers/databases/syncGroups"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/syncgroupcrud-3521/providers/Microsoft.Sql/servers/syncgroupcrud-8475/databases/syncgroupcrud-4328/syncGroups/syncgroupcrud-3187"), - // Properties: &armsql.SyncGroupProperties{ - // ConflictResolutionPolicy: to.Ptr(armsql.SyncConflictResolutionPolicyHubWin), - // HubDatabaseUserName: to.Ptr("hubUser"), - // Interval: to.Ptr[int32](-1), - // LastSyncTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "0001-01-01T08:00:00Z"); return t}()), - // PrivateEndpointName: to.Ptr("PE_67FDBBD6-B2D8-4014-9CC6-C68ABBCFD481_syncgroupcrud-3187"), - // SyncDatabaseID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/syncgroupcrud-3521/providers/Microsoft.Sql/servers/syncgroupcrud-8475/databases/syncgroupcrud-4328"), - // SyncState: to.Ptr(armsql.SyncGroupStateNotReady), - // UsePrivateLinkConnection: to.Ptr(true), - // }, - // }, - // { - // Name: to.Ptr("syncgroupcrud-5374"), - // Type: to.Ptr("Microsoft.Sql/servers/databases/syncGroups"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/syncgroupcrud-3521/providers/Microsoft.Sql/servers/syncgroupcrud-8475/databases/syncgroupcrud-4328/syncGroups/syncgroupcrud-5374"), - // Properties: &armsql.SyncGroupProperties{ - // ConflictResolutionPolicy: to.Ptr(armsql.SyncConflictResolutionPolicyHubWin), - // HubDatabaseUserName: to.Ptr("hubUser"), - // Interval: to.Ptr[int32](-1), - // LastSyncTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "0001-01-01T08:00:00Z"); return t}()), - // PrivateEndpointName: to.Ptr("PE_67FDBBD6-B2D8-4014-9CC6-C68ABBCFD481_syncgroupcrud-5374"), - // SyncDatabaseID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/syncgroupcrud-3521/providers/Microsoft.Sql/servers/syncgroupcrud-8475/databases/syncgroupcrud-4328"), - // SyncState: to.Ptr(armsql.SyncGroupStateNotReady), - // UsePrivateLinkConnection: to.Ptr(true), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/sql/armsql/syncmembers_client.go b/sdk/resourcemanager/sql/armsql/syncmembers_client.go index 8b65f9494d67..de03d33a8bf6 100644 --- a/sdk/resourcemanager/sql/armsql/syncmembers_client.go +++ b/sdk/resourcemanager/sql/armsql/syncmembers_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armsql @@ -47,7 +46,7 @@ func NewSyncMembersClient(subscriptionID string, credential azcore.TokenCredenti // BeginCreateOrUpdate - Creates or updates a sync member. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -63,7 +62,8 @@ func (client *SyncMembersClient) BeginCreateOrUpdate(ctx context.Context, resour if err != nil { return nil, err } - return runtime.NewPoller[SyncMembersClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[SyncMembersClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[SyncMembersClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -72,20 +72,22 @@ func (client *SyncMembersClient) BeginCreateOrUpdate(ctx context.Context, resour // CreateOrUpdate - Creates or updates a sync member. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview func (client *SyncMembersClient) createOrUpdate(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string, syncMemberName string, parameters SyncMember, options *SyncMembersClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createOrUpdateCreateRequest creates the CreateOrUpdate request. @@ -120,16 +122,19 @@ func (client *SyncMembersClient) createOrUpdateCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // BeginDelete - Deletes a sync member. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -143,7 +148,8 @@ func (client *SyncMembersClient) BeginDelete(ctx context.Context, resourceGroupN if err != nil { return nil, err } - return runtime.NewPoller[SyncMembersClientDeleteResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[SyncMembersClientDeleteResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[SyncMembersClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -152,20 +158,22 @@ func (client *SyncMembersClient) BeginDelete(ctx context.Context, resourceGroupN // Delete - Deletes a sync member. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview func (client *SyncMembersClient) deleteOperation(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string, syncMemberName string, options *SyncMembersClientBeginDeleteOptions) (*http.Response, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteCreateRequest creates the Delete request. @@ -200,7 +208,7 @@ func (client *SyncMembersClient) deleteCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -208,7 +216,7 @@ func (client *SyncMembersClient) deleteCreateRequest(ctx context.Context, resour // Get - Gets a sync member. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -217,18 +225,21 @@ func (client *SyncMembersClient) deleteCreateRequest(ctx context.Context, resour // - syncMemberName - The name of the sync member. // - options - SyncMembersClientGetOptions contains the optional parameters for the SyncMembersClient.Get method. func (client *SyncMembersClient) Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string, syncMemberName string, options *SyncMembersClientGetOptions) (SyncMembersClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName, options) if err != nil { return SyncMembersClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return SyncMembersClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return SyncMembersClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return SyncMembersClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -263,7 +274,7 @@ func (client *SyncMembersClient) getCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -280,7 +291,7 @@ func (client *SyncMembersClient) getHandleResponse(resp *http.Response) (SyncMem // NewListBySyncGroupPager - Lists sync members in the given sync group. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -344,7 +355,7 @@ func (client *SyncMembersClient) listBySyncGroupCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -361,7 +372,7 @@ func (client *SyncMembersClient) listBySyncGroupHandleResponse(resp *http.Respon // NewListMemberSchemasPager - Gets a sync member database schema. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -430,7 +441,7 @@ func (client *SyncMembersClient) listMemberSchemasCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -448,7 +459,7 @@ func (client *SyncMembersClient) listMemberSchemasHandleResponse(resp *http.Resp // BeginRefreshMemberSchema - Refreshes a sync member database schema. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -463,7 +474,8 @@ func (client *SyncMembersClient) BeginRefreshMemberSchema(ctx context.Context, r if err != nil { return nil, err } - return runtime.NewPoller[SyncMembersClientRefreshMemberSchemaResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[SyncMembersClientRefreshMemberSchemaResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[SyncMembersClientRefreshMemberSchemaResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -472,20 +484,22 @@ func (client *SyncMembersClient) BeginRefreshMemberSchema(ctx context.Context, r // RefreshMemberSchema - Refreshes a sync member database schema. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview func (client *SyncMembersClient) refreshMemberSchema(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string, syncMemberName string, options *SyncMembersClientBeginRefreshMemberSchemaOptions) (*http.Response, error) { + var err error req, err := client.refreshMemberSchemaCreateRequest(ctx, resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // refreshMemberSchemaCreateRequest creates the RefreshMemberSchema request. @@ -520,7 +534,7 @@ func (client *SyncMembersClient) refreshMemberSchemaCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -528,7 +542,7 @@ func (client *SyncMembersClient) refreshMemberSchemaCreateRequest(ctx context.Co // BeginUpdate - Updates an existing sync member. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -543,7 +557,8 @@ func (client *SyncMembersClient) BeginUpdate(ctx context.Context, resourceGroupN if err != nil { return nil, err } - return runtime.NewPoller[SyncMembersClientUpdateResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[SyncMembersClientUpdateResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[SyncMembersClientUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -552,20 +567,22 @@ func (client *SyncMembersClient) BeginUpdate(ctx context.Context, resourceGroupN // Update - Updates an existing sync member. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview func (client *SyncMembersClient) update(ctx context.Context, resourceGroupName string, serverName string, databaseName string, syncGroupName string, syncMemberName string, parameters SyncMember, options *SyncMembersClientBeginUpdateOptions) (*http.Response, error) { + var err error req, err := client.updateCreateRequest(ctx, resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // updateCreateRequest creates the Update request. @@ -600,8 +617,11 @@ func (client *SyncMembersClient) updateCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } diff --git a/sdk/resourcemanager/sql/armsql/syncmembers_client_example_test.go b/sdk/resourcemanager/sql/armsql/syncmembers_client_example_test.go deleted file mode 100644 index 32f78f3accfe..000000000000 --- a/sdk/resourcemanager/sql/armsql/syncmembers_client_example_test.go +++ /dev/null @@ -1,346 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsql_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sql/armsql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SyncMemberGet.json -func ExampleSyncMembersClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewSyncMembersClient().Get(ctx, "syncgroupcrud-65440", "syncgroupcrud-8475", "syncgroupcrud-4328", "syncgroupcrud-3187", "syncmembercrud-4879", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.SyncMember = armsql.SyncMember{ - // Name: to.Ptr("syncmembercrud-4879"), - // Type: to.Ptr("Microsoft.Sql/servers/databases/syncGroups/syncMembers"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/syncgroupcrud-65440/providers/Microsoft.Sql/servers/syncgroupcrud-8475/databases/syncgroupcrud-4328/syncGroups/syncgroupcrud-3187/syncMembers/syncmembercrud-4879"), - // Properties: &armsql.SyncMemberProperties{ - // DatabaseName: to.Ptr("syncgroupcrud-7421"), - // DatabaseType: to.Ptr(armsql.SyncMemberDbTypeAzureSQLDatabase), - // PrivateEndpointName: to.Ptr("PE_67FDBBD6-B2D8-4014-9CC6-C68ABBCFD481_syncmembercrud-4879"), - // ServerName: to.Ptr("syncgroupcrud-3379.database.windows.net"), - // SyncDirection: to.Ptr(armsql.SyncDirectionBidirectional), - // SyncMemberAzureDatabaseResourceID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/syncgroupcrud-65440/providers/Microsoft.Sql/servers/syncgroupcrud-8475/databases/syncgroupcrud-4328"), - // SyncState: to.Ptr(armsql.SyncMemberStateUnProvisioned), - // UsePrivateLinkConnection: to.Ptr(true), - // UserName: to.Ptr("myUser"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SyncMemberCreate.json -func ExampleSyncMembersClient_BeginCreateOrUpdate_createANewSyncMember() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSyncMembersClient().BeginCreateOrUpdate(ctx, "syncgroupcrud-65440", "syncgroupcrud-8475", "syncgroupcrud-4328", "syncgroupcrud-3187", "syncmembercrud-4879", armsql.SyncMember{ - Properties: &armsql.SyncMemberProperties{ - DatabaseName: to.Ptr("syncgroupcrud-7421"), - DatabaseType: to.Ptr(armsql.SyncMemberDbTypeAzureSQLDatabase), - ServerName: to.Ptr("syncgroupcrud-3379.database.windows.net"), - SyncDirection: to.Ptr(armsql.SyncDirectionBidirectional), - SyncMemberAzureDatabaseResourceID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/syncgroupcrud-65440/providers/Microsoft.Sql/servers/syncgroupcrud-8475/databases/syncgroupcrud-4328"), - UsePrivateLinkConnection: to.Ptr(true), - UserName: to.Ptr("myUser"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.SyncMember = armsql.SyncMember{ - // Name: to.Ptr("syncmembercrud-4879"), - // Type: to.Ptr("Microsoft.Sql/servers/databases/syncGroups/syncMembers"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/syncgroupcrud-65440/providers/Microsoft.Sql/servers/syncgroupcrud-8475/databases/syncgroupcrud-4328/syncGroups/syncgroupcrud-3187/syncMembers/syncmembercrud-4879"), - // Properties: &armsql.SyncMemberProperties{ - // DatabaseName: to.Ptr("syncgroupcrud-7421"), - // DatabaseType: to.Ptr(armsql.SyncMemberDbTypeAzureSQLDatabase), - // PrivateEndpointName: to.Ptr("PE_67FDBBD6-B2D8-4014-9CC6-C68ABBCFD481_syncmembercrud-4879"), - // ServerName: to.Ptr("syncgroupcrud-3379.database.windows.net"), - // SyncDirection: to.Ptr(armsql.SyncDirectionBidirectional), - // SyncMemberAzureDatabaseResourceID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/syncgroupcrud-65440/providers/Microsoft.Sql/servers/syncgroupcrud-8475/databases/syncgroupcrud-4328"), - // SyncState: to.Ptr(armsql.SyncMemberStateUnProvisioned), - // UsePrivateLinkConnection: to.Ptr(true), - // UserName: to.Ptr("myUser"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SyncMemberUpdate.json -func ExampleSyncMembersClient_BeginCreateOrUpdate_updateASyncMember() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSyncMembersClient().BeginCreateOrUpdate(ctx, "syncgroupcrud-65440", "syncgroupcrud-8475", "syncgroupcrud-4328", "syncgroupcrud-3187", "syncmembercrud-4879", armsql.SyncMember{ - Properties: &armsql.SyncMemberProperties{ - DatabaseName: to.Ptr("syncgroupcrud-7421"), - DatabaseType: to.Ptr(armsql.SyncMemberDbTypeAzureSQLDatabase), - ServerName: to.Ptr("syncgroupcrud-3379.database.windows.net"), - SyncDirection: to.Ptr(armsql.SyncDirectionBidirectional), - SyncMemberAzureDatabaseResourceID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/syncgroupcrud-65440/providers/Microsoft.Sql/servers/syncgroupcrud-8475/databases/syncgroupcrud-4328"), - UsePrivateLinkConnection: to.Ptr(true), - UserName: to.Ptr("myUser"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.SyncMember = armsql.SyncMember{ - // Name: to.Ptr("syncmembercrud-4879"), - // Type: to.Ptr("Microsoft.Sql/servers/databases/syncGroups/syncMembers"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/syncgroupcrud-65440/providers/Microsoft.Sql/servers/syncgroupcrud-8475/databases/syncgroupcrud-4328/syncGroups/syncgroupcrud-3187/syncMembers/syncmembercrud-4879"), - // Properties: &armsql.SyncMemberProperties{ - // DatabaseName: to.Ptr("syncgroupcrud-7421"), - // DatabaseType: to.Ptr(armsql.SyncMemberDbTypeAzureSQLDatabase), - // PrivateEndpointName: to.Ptr("PE_67FDBBD6-B2D8-4014-9CC6-C68ABBCFD481_syncmembercrud-4879"), - // ServerName: to.Ptr("syncgroupcrud-3379.database.windows.net"), - // SyncDirection: to.Ptr(armsql.SyncDirectionBidirectional), - // SyncMemberAzureDatabaseResourceID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/syncgroupcrud-65440/providers/Microsoft.Sql/servers/syncgroupcrud-8475/databases/syncgroupcrud-4328"), - // SyncState: to.Ptr(armsql.SyncMemberStateUnProvisioned), - // UsePrivateLinkConnection: to.Ptr(true), - // UserName: to.Ptr("myUser"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SyncMemberDelete.json -func ExampleSyncMembersClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSyncMembersClient().BeginDelete(ctx, "syncgroupcrud-65440", "syncgroupcrud-8475", "syncgroupcrud-4328", "syncgroupcrud-3187", "syncgroupcrud-4879", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SyncMemberPatch.json -func ExampleSyncMembersClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSyncMembersClient().BeginUpdate(ctx, "syncgroupcrud-65440", "syncgroupcrud-8475", "syncgroupcrud-4328", "syncgroupcrud-3187", "syncmembercrud-4879", armsql.SyncMember{ - Properties: &armsql.SyncMemberProperties{ - DatabaseName: to.Ptr("syncgroupcrud-7421"), - DatabaseType: to.Ptr(armsql.SyncMemberDbTypeAzureSQLDatabase), - ServerName: to.Ptr("syncgroupcrud-3379.database.windows.net"), - SyncDirection: to.Ptr(armsql.SyncDirectionBidirectional), - SyncMemberAzureDatabaseResourceID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/syncgroupcrud-65440/providers/Microsoft.Sql/servers/syncgroupcrud-8475/databases/syncgroupcrud-4328"), - UsePrivateLinkConnection: to.Ptr(true), - UserName: to.Ptr("myUser"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.SyncMember = armsql.SyncMember{ - // Name: to.Ptr("syncmembercrud-4879"), - // Type: to.Ptr("Microsoft.Sql/servers/databases/syncGroups/syncMembers"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/syncgroupcrud-65440/providers/Microsoft.Sql/servers/syncgroupcrud-8475/databases/syncgroupcrud-4328/syncGroups/syncgroupcrud-3187/syncMembers/syncmembercrud-4879"), - // Properties: &armsql.SyncMemberProperties{ - // DatabaseName: to.Ptr("syncgroupcrud-7421"), - // DatabaseType: to.Ptr(armsql.SyncMemberDbTypeAzureSQLDatabase), - // PrivateEndpointName: to.Ptr("PE_67FDBBD6-B2D8-4014-9CC6-C68ABBCFD481_syncmembercrud-4879"), - // ServerName: to.Ptr("syncgroupcrud-3379.database.windows.net"), - // SyncDirection: to.Ptr(armsql.SyncDirectionBidirectional), - // SyncMemberAzureDatabaseResourceID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/syncgroupcrud-65440/providers/Microsoft.Sql/servers/syncgroupcrud-8475/databases/syncgroupcrud-4328"), - // SyncState: to.Ptr(armsql.SyncMemberStateUnProvisioned), - // UsePrivateLinkConnection: to.Ptr(true), - // UserName: to.Ptr("myUser"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SyncMemberListBySyncGroup.json -func ExampleSyncMembersClient_NewListBySyncGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewSyncMembersClient().NewListBySyncGroupPager("syncgroupcrud-65440", "syncgroupcrud-8475", "syncgroupcrud-4328", "syncgroupcrud-3187", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.SyncMemberListResult = armsql.SyncMemberListResult{ - // Value: []*armsql.SyncMember{ - // { - // Name: to.Ptr("syncmembercrud-4879"), - // Type: to.Ptr("Microsoft.Sql/servers/databases/syncGroups/syncMembers"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/syncgroupcrud-65440/providers/Microsoft.Sql/servers/syncgroupcrud-8475/databases/syncgroupcrud-4328/syncGroups/syncgroupcrud-3187/syncMembers/syncmembercrud-4879"), - // Properties: &armsql.SyncMemberProperties{ - // DatabaseName: to.Ptr("syncgroupcrud-7421"), - // DatabaseType: to.Ptr(armsql.SyncMemberDbTypeAzureSQLDatabase), - // PrivateEndpointName: to.Ptr("PE_67FDBBD6-B2D8-4014-9CC6-C68ABBCFD481_syncmembercrud-4879"), - // ServerName: to.Ptr("syncgroupcrud-3379.database.windows.net"), - // SyncDirection: to.Ptr(armsql.SyncDirectionBidirectional), - // SyncMemberAzureDatabaseResourceID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/syncgroupcrud-65440/providers/Microsoft.Sql/servers/syncgroupcrud-8475/databases/syncgroupcrud-4328"), - // SyncState: to.Ptr(armsql.SyncMemberStateUnProvisioned), - // UsePrivateLinkConnection: to.Ptr(true), - // UserName: to.Ptr("myUser"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SyncMemberGetSchema.json -func ExampleSyncMembersClient_NewListMemberSchemasPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewSyncMembersClient().NewListMemberSchemasPager("syncgroupcrud-65440", "syncgroupcrud-8475", "syncgroupcrud-4328", "syncgroupcrud-3187", "syncgroupcrud-4879", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.SyncFullSchemaPropertiesListResult = armsql.SyncFullSchemaPropertiesListResult{ - // Value: []*armsql.SyncFullSchemaProperties{ - // { - // LastUpdateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-05-30T07:16:08.21Z"); return t}()), - // Tables: []*armsql.SyncFullSchemaTable{ - // { - // Name: to.Ptr("dbo.myTable"), - // Columns: []*armsql.SyncFullSchemaTableColumn{ - // { - // Name: to.Ptr("intField"), - // DataSize: to.Ptr("4"), - // DataType: to.Ptr("int"), - // HasError: to.Ptr(false), - // IsPrimaryKey: to.Ptr(false), - // QuotedName: to.Ptr("[intField]"), - // }, - // { - // Name: to.Ptr("charField"), - // DataSize: to.Ptr("100"), - // DataType: to.Ptr("nvarchar"), - // HasError: to.Ptr(false), - // IsPrimaryKey: to.Ptr(false), - // QuotedName: to.Ptr("[charField]"), - // }}, - // ErrorID: to.Ptr("Schema_TableHasNoPrimaryKey"), - // HasError: to.Ptr(true), - // QuotedName: to.Ptr("[dbo].[myTable]"), - // }}, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SyncMemberRefreshSchema.json -func ExampleSyncMembersClient_BeginRefreshMemberSchema() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSyncMembersClient().BeginRefreshMemberSchema(ctx, "syncgroupcrud-65440", "syncgroupcrud-8475", "syncgroupcrud-4328", "syncgroupcrud-3187", "syncgroupcrud-4879", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} diff --git a/sdk/resourcemanager/sql/armsql/tdecertificates_client.go b/sdk/resourcemanager/sql/armsql/tdecertificates_client.go index 2a0c45c4c221..15dd4565635f 100644 --- a/sdk/resourcemanager/sql/armsql/tdecertificates_client.go +++ b/sdk/resourcemanager/sql/armsql/tdecertificates_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armsql @@ -47,7 +46,7 @@ func NewTdeCertificatesClient(subscriptionID string, credential azcore.TokenCred // BeginCreate - Creates a TDE certificate for a given server. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -60,7 +59,8 @@ func (client *TdeCertificatesClient) BeginCreate(ctx context.Context, resourceGr if err != nil { return nil, err } - return runtime.NewPoller[TdeCertificatesClientCreateResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[TdeCertificatesClientCreateResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[TdeCertificatesClientCreateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -69,20 +69,22 @@ func (client *TdeCertificatesClient) BeginCreate(ctx context.Context, resourceGr // Create - Creates a TDE certificate for a given server. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview func (client *TdeCertificatesClient) create(ctx context.Context, resourceGroupName string, serverName string, parameters TdeCertificate, options *TdeCertificatesClientBeginCreateOptions) (*http.Response, error) { + var err error req, err := client.createCreateRequest(ctx, resourceGroupName, serverName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createCreateRequest creates the Create request. @@ -105,7 +107,10 @@ func (client *TdeCertificatesClient) createCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } diff --git a/sdk/resourcemanager/sql/armsql/tdecertificates_client_example_test.go b/sdk/resourcemanager/sql/armsql/tdecertificates_client_example_test.go deleted file mode 100644 index 552abf2f4ccf..000000000000 --- a/sdk/resourcemanager/sql/armsql/tdecertificates_client_example_test.go +++ /dev/null @@ -1,44 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsql_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sql/armsql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SqlTdeCertificateCreate.json -func ExampleTdeCertificatesClient_BeginCreate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewTdeCertificatesClient().BeginCreate(ctx, "testtdecert", "testtdecert", armsql.TdeCertificate{ - Properties: &armsql.TdeCertificateProperties{ - PrivateBlob: to.Ptr("MIIXXXXXXXX"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} diff --git a/sdk/resourcemanager/sql/armsql/time_rfc3339.go b/sdk/resourcemanager/sql/armsql/time_rfc3339.go index 65cedb7496c1..8361df297f10 100644 --- a/sdk/resourcemanager/sql/armsql/time_rfc3339.go +++ b/sdk/resourcemanager/sql/armsql/time_rfc3339.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armsql diff --git a/sdk/resourcemanager/sql/armsql/timezones_client.go b/sdk/resourcemanager/sql/armsql/timezones_client.go index 2baabf47a468..cc8654ebd897 100644 --- a/sdk/resourcemanager/sql/armsql/timezones_client.go +++ b/sdk/resourcemanager/sql/armsql/timezones_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armsql @@ -47,21 +46,24 @@ func NewTimeZonesClient(subscriptionID string, credential azcore.TokenCredential // Get - Gets a managed instance time zone. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - options - TimeZonesClientGetOptions contains the optional parameters for the TimeZonesClient.Get method. func (client *TimeZonesClient) Get(ctx context.Context, locationName string, timeZoneID string, options *TimeZonesClientGetOptions) (TimeZonesClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, locationName, timeZoneID, options) if err != nil { return TimeZonesClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return TimeZonesClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return TimeZonesClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return TimeZonesClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -84,7 +86,7 @@ func (client *TimeZonesClient) getCreateRequest(ctx context.Context, locationNam return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -101,7 +103,7 @@ func (client *TimeZonesClient) getHandleResponse(resp *http.Response) (TimeZones // NewListByLocationPager - Gets a list of managed instance time zones by location. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - options - TimeZonesClientListByLocationOptions contains the optional parameters for the TimeZonesClient.NewListByLocationPager // method. func (client *TimeZonesClient) NewListByLocationPager(locationName string, options *TimeZonesClientListByLocationOptions) *runtime.Pager[TimeZonesClientListByLocationResponse] { @@ -148,7 +150,7 @@ func (client *TimeZonesClient) listByLocationCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/sql/armsql/timezones_client_example_test.go b/sdk/resourcemanager/sql/armsql/timezones_client_example_test.go deleted file mode 100644 index 42a3610b511e..000000000000 --- a/sdk/resourcemanager/sql/armsql/timezones_client_example_test.go +++ /dev/null @@ -1,1326 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsql_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sql/armsql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceTimeZoneListByLocation.json -func ExampleTimeZonesClient_NewListByLocationPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewTimeZonesClient().NewListByLocationPager("canadaeast", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.TimeZoneListResult = armsql.TimeZoneListResult{ - // Value: []*armsql.TimeZone{ - // { - // Name: to.Ptr("Afghanistan Standard Time"), - // Type: to.Ptr("Microsoft.Sql/locations/timeZones"), - // ID: to.Ptr("/subscriptions/37d5e605-6142-4d79-b564-28b6dbfeec0f/providers/Microsoft.Sql/locations/onebox/timeZones/Afghanistan Standard Time"), - // Properties: &armsql.TimeZoneProperties{ - // DisplayName: to.Ptr("(UTC+04:30) Kabul"), - // TimeZoneID: to.Ptr("Afghanistan Standard Time"), - // }, - // }, - // { - // Name: to.Ptr("Alaskan Standard Time"), - // Type: to.Ptr("Microsoft.Sql/locations/timeZones"), - // ID: to.Ptr("/subscriptions/37d5e605-6142-4d79-b564-28b6dbfeec0f/providers/Microsoft.Sql/locations/onebox/timeZones/Alaskan Standard Time"), - // Properties: &armsql.TimeZoneProperties{ - // DisplayName: to.Ptr("(UTC-09:00) Alaska"), - // TimeZoneID: to.Ptr("Alaskan Standard Time"), - // }, - // }, - // { - // Name: to.Ptr("Aleutian Standard Time"), - // Type: to.Ptr("Microsoft.Sql/locations/timeZones"), - // ID: to.Ptr("/subscriptions/37d5e605-6142-4d79-b564-28b6dbfeec0f/providers/Microsoft.Sql/locations/onebox/timeZones/Aleutian Standard Time"), - // Properties: &armsql.TimeZoneProperties{ - // DisplayName: to.Ptr("(UTC-10:00) Aleutian Islands"), - // TimeZoneID: to.Ptr("Aleutian Standard Time"), - // }, - // }, - // { - // Name: to.Ptr("Altai Standard Time"), - // Type: to.Ptr("Microsoft.Sql/locations/timeZones"), - // ID: to.Ptr("/subscriptions/37d5e605-6142-4d79-b564-28b6dbfeec0f/providers/Microsoft.Sql/locations/onebox/timeZones/Altai Standard Time"), - // Properties: &armsql.TimeZoneProperties{ - // DisplayName: to.Ptr("(UTC+07:00) Barnaul, Gorno-Altaysk"), - // TimeZoneID: to.Ptr("Altai Standard Time"), - // }, - // }, - // { - // Name: to.Ptr("Arab Standard Time"), - // Type: to.Ptr("Microsoft.Sql/locations/timeZones"), - // ID: to.Ptr("/subscriptions/37d5e605-6142-4d79-b564-28b6dbfeec0f/providers/Microsoft.Sql/locations/onebox/timeZones/Arab Standard Time"), - // Properties: &armsql.TimeZoneProperties{ - // DisplayName: to.Ptr("(UTC+03:00) Kuwait, Riyadh"), - // TimeZoneID: to.Ptr("Arab Standard Time"), - // }, - // }, - // { - // Name: to.Ptr("Arabian Standard Time"), - // Type: to.Ptr("Microsoft.Sql/locations/timeZones"), - // ID: to.Ptr("/subscriptions/37d5e605-6142-4d79-b564-28b6dbfeec0f/providers/Microsoft.Sql/locations/onebox/timeZones/Arabian Standard Time"), - // Properties: &armsql.TimeZoneProperties{ - // DisplayName: to.Ptr("(UTC+04:00) Abu Dhabi, Muscat"), - // TimeZoneID: to.Ptr("Arabian Standard Time"), - // }, - // }, - // { - // Name: to.Ptr("Arabic Standard Time"), - // Type: to.Ptr("Microsoft.Sql/locations/timeZones"), - // ID: to.Ptr("/subscriptions/37d5e605-6142-4d79-b564-28b6dbfeec0f/providers/Microsoft.Sql/locations/onebox/timeZones/Arabic Standard Time"), - // Properties: &armsql.TimeZoneProperties{ - // DisplayName: to.Ptr("(UTC+03:00) Baghdad"), - // TimeZoneID: to.Ptr("Arabic Standard Time"), - // }, - // }, - // { - // Name: to.Ptr("Argentina Standard Time"), - // Type: to.Ptr("Microsoft.Sql/locations/timeZones"), - // ID: to.Ptr("/subscriptions/37d5e605-6142-4d79-b564-28b6dbfeec0f/providers/Microsoft.Sql/locations/onebox/timeZones/Argentina Standard Time"), - // Properties: &armsql.TimeZoneProperties{ - // DisplayName: to.Ptr("(UTC-03:00) City of Buenos Aires"), - // TimeZoneID: to.Ptr("Argentina Standard Time"), - // }, - // }, - // { - // Name: to.Ptr("Astrakhan Standard Time"), - // Type: to.Ptr("Microsoft.Sql/locations/timeZones"), - // ID: to.Ptr("/subscriptions/37d5e605-6142-4d79-b564-28b6dbfeec0f/providers/Microsoft.Sql/locations/onebox/timeZones/Astrakhan Standard Time"), - // Properties: &armsql.TimeZoneProperties{ - // DisplayName: to.Ptr("(UTC+04:00) Astrakhan, Ulyanovsk"), - // TimeZoneID: to.Ptr("Astrakhan Standard Time"), - // }, - // }, - // { - // Name: to.Ptr("Atlantic Standard Time"), - // Type: to.Ptr("Microsoft.Sql/locations/timeZones"), - // ID: to.Ptr("/subscriptions/37d5e605-6142-4d79-b564-28b6dbfeec0f/providers/Microsoft.Sql/locations/onebox/timeZones/Atlantic Standard Time"), - // Properties: &armsql.TimeZoneProperties{ - // DisplayName: to.Ptr("(UTC-04:00) Atlantic Time (Canada)"), - // TimeZoneID: to.Ptr("Atlantic Standard Time"), - // }, - // }, - // { - // Name: to.Ptr("AUS Central Standard Time"), - // Type: to.Ptr("Microsoft.Sql/locations/timeZones"), - // ID: to.Ptr("/subscriptions/37d5e605-6142-4d79-b564-28b6dbfeec0f/providers/Microsoft.Sql/locations/onebox/timeZones/AUS Central Standard Time"), - // Properties: &armsql.TimeZoneProperties{ - // DisplayName: to.Ptr("(UTC+09:30) Darwin"), - // TimeZoneID: to.Ptr("AUS Central Standard Time"), - // }, - // }, - // { - // Name: to.Ptr("Aus Central W. Standard Time"), - // Type: to.Ptr("Microsoft.Sql/locations/timeZones"), - // ID: to.Ptr("/subscriptions/37d5e605-6142-4d79-b564-28b6dbfeec0f/providers/Microsoft.Sql/locations/onebox/timeZones/Aus Central W. Standard Time"), - // Properties: &armsql.TimeZoneProperties{ - // DisplayName: to.Ptr("(UTC+08:45) Eucla"), - // TimeZoneID: to.Ptr("Aus Central W. Standard Time"), - // }, - // }, - // { - // Name: to.Ptr("AUS Eastern Standard Time"), - // Type: to.Ptr("Microsoft.Sql/locations/timeZones"), - // ID: to.Ptr("/subscriptions/37d5e605-6142-4d79-b564-28b6dbfeec0f/providers/Microsoft.Sql/locations/onebox/timeZones/AUS Eastern Standard Time"), - // Properties: &armsql.TimeZoneProperties{ - // DisplayName: to.Ptr("(UTC+10:00) Canberra, Melbourne, Sydney"), - // TimeZoneID: to.Ptr("AUS Eastern Standard Time"), - // }, - // }, - // { - // Name: to.Ptr("Azerbaijan Standard Time"), - // Type: to.Ptr("Microsoft.Sql/locations/timeZones"), - // ID: to.Ptr("/subscriptions/37d5e605-6142-4d79-b564-28b6dbfeec0f/providers/Microsoft.Sql/locations/onebox/timeZones/Azerbaijan Standard Time"), - // Properties: &armsql.TimeZoneProperties{ - // DisplayName: to.Ptr("(UTC+04:00) Baku"), - // TimeZoneID: to.Ptr("Azerbaijan Standard Time"), - // }, - // }, - // { - // Name: to.Ptr("Azores Standard Time"), - // Type: to.Ptr("Microsoft.Sql/locations/timeZones"), - // ID: to.Ptr("/subscriptions/37d5e605-6142-4d79-b564-28b6dbfeec0f/providers/Microsoft.Sql/locations/onebox/timeZones/Azores Standard Time"), - // Properties: &armsql.TimeZoneProperties{ - // DisplayName: to.Ptr("(UTC-01:00) Azores"), - // TimeZoneID: to.Ptr("Azores Standard Time"), - // }, - // }, - // { - // Name: to.Ptr("Bahia Standard Time"), - // Type: to.Ptr("Microsoft.Sql/locations/timeZones"), - // ID: to.Ptr("/subscriptions/37d5e605-6142-4d79-b564-28b6dbfeec0f/providers/Microsoft.Sql/locations/onebox/timeZones/Bahia Standard Time"), - // Properties: &armsql.TimeZoneProperties{ - // DisplayName: to.Ptr("(UTC-03:00) Salvador"), - // TimeZoneID: to.Ptr("Bahia Standard Time"), - // }, - // }, - // { - // Name: to.Ptr("Bangladesh Standard Time"), - // Type: to.Ptr("Microsoft.Sql/locations/timeZones"), - // ID: to.Ptr("/subscriptions/37d5e605-6142-4d79-b564-28b6dbfeec0f/providers/Microsoft.Sql/locations/onebox/timeZones/Bangladesh Standard Time"), - // Properties: &armsql.TimeZoneProperties{ - // DisplayName: to.Ptr("(UTC+06:00) Dhaka"), - // TimeZoneID: to.Ptr("Bangladesh Standard Time"), - // }, - // }, - // { - // Name: to.Ptr("Belarus Standard Time"), - // Type: to.Ptr("Microsoft.Sql/locations/timeZones"), - // ID: to.Ptr("/subscriptions/37d5e605-6142-4d79-b564-28b6dbfeec0f/providers/Microsoft.Sql/locations/onebox/timeZones/Belarus Standard Time"), - // Properties: &armsql.TimeZoneProperties{ - // DisplayName: to.Ptr("(UTC+03:00) Minsk"), - // TimeZoneID: to.Ptr("Belarus Standard Time"), - // }, - // }, - // { - // Name: to.Ptr("Bougainville Standard Time"), - // Type: to.Ptr("Microsoft.Sql/locations/timeZones"), - // ID: to.Ptr("/subscriptions/37d5e605-6142-4d79-b564-28b6dbfeec0f/providers/Microsoft.Sql/locations/onebox/timeZones/Bougainville Standard Time"), - // Properties: &armsql.TimeZoneProperties{ - // DisplayName: to.Ptr("(UTC+11:00) Bougainville Island"), - // TimeZoneID: to.Ptr("Bougainville Standard Time"), - // }, - // }, - // { - // Name: to.Ptr("Canada Central Standard Time"), - // Type: to.Ptr("Microsoft.Sql/locations/timeZones"), - // ID: to.Ptr("/subscriptions/37d5e605-6142-4d79-b564-28b6dbfeec0f/providers/Microsoft.Sql/locations/onebox/timeZones/Canada Central Standard Time"), - // Properties: &armsql.TimeZoneProperties{ - // DisplayName: to.Ptr("(UTC-06:00) Saskatchewan"), - // TimeZoneID: to.Ptr("Canada Central Standard Time"), - // }, - // }, - // { - // Name: to.Ptr("Cape Verde Standard Time"), - // Type: to.Ptr("Microsoft.Sql/locations/timeZones"), - // ID: to.Ptr("/subscriptions/37d5e605-6142-4d79-b564-28b6dbfeec0f/providers/Microsoft.Sql/locations/onebox/timeZones/Cape Verde Standard Time"), - // Properties: &armsql.TimeZoneProperties{ - // DisplayName: to.Ptr("(UTC-01:00) Cabo Verde Is."), - // TimeZoneID: to.Ptr("Cape Verde Standard Time"), - // }, - // }, - // { - // Name: to.Ptr("Caucasus Standard Time"), - // Type: to.Ptr("Microsoft.Sql/locations/timeZones"), - // ID: to.Ptr("/subscriptions/37d5e605-6142-4d79-b564-28b6dbfeec0f/providers/Microsoft.Sql/locations/onebox/timeZones/Caucasus Standard Time"), - // Properties: &armsql.TimeZoneProperties{ - // DisplayName: to.Ptr("(UTC+04:00) Yerevan"), - // TimeZoneID: to.Ptr("Caucasus Standard Time"), - // }, - // }, - // { - // Name: to.Ptr("Cen. Australia Standard Time"), - // Type: to.Ptr("Microsoft.Sql/locations/timeZones"), - // ID: to.Ptr("/subscriptions/37d5e605-6142-4d79-b564-28b6dbfeec0f/providers/Microsoft.Sql/locations/onebox/timeZones/Cen. Australia Standard Time"), - // Properties: &armsql.TimeZoneProperties{ - // DisplayName: to.Ptr("(UTC+09:30) Adelaide"), - // TimeZoneID: to.Ptr("Cen. Australia Standard Time"), - // }, - // }, - // { - // Name: to.Ptr("Central America Standard Time"), - // Type: to.Ptr("Microsoft.Sql/locations/timeZones"), - // ID: to.Ptr("/subscriptions/37d5e605-6142-4d79-b564-28b6dbfeec0f/providers/Microsoft.Sql/locations/onebox/timeZones/Central America Standard Time"), - // Properties: &armsql.TimeZoneProperties{ - // DisplayName: to.Ptr("(UTC-06:00) Central America"), - // TimeZoneID: to.Ptr("Central America Standard Time"), - // }, - // }, - // { - // Name: to.Ptr("Central Asia Standard Time"), - // Type: to.Ptr("Microsoft.Sql/locations/timeZones"), - // ID: to.Ptr("/subscriptions/37d5e605-6142-4d79-b564-28b6dbfeec0f/providers/Microsoft.Sql/locations/onebox/timeZones/Central Asia Standard Time"), - // Properties: &armsql.TimeZoneProperties{ - // DisplayName: to.Ptr("(UTC+06:00) Astana"), - // TimeZoneID: to.Ptr("Central Asia Standard Time"), - // }, - // }, - // { - // Name: to.Ptr("Central Brazilian Standard Time"), - // Type: to.Ptr("Microsoft.Sql/locations/timeZones"), - // ID: to.Ptr("/subscriptions/37d5e605-6142-4d79-b564-28b6dbfeec0f/providers/Microsoft.Sql/locations/onebox/timeZones/Central Brazilian Standard Time"), - // Properties: &armsql.TimeZoneProperties{ - // DisplayName: to.Ptr("(UTC-04:00) Cuiaba"), - // TimeZoneID: to.Ptr("Central Brazilian Standard Time"), - // }, - // }, - // { - // Name: to.Ptr("Central Europe Standard Time"), - // Type: to.Ptr("Microsoft.Sql/locations/timeZones"), - // ID: to.Ptr("/subscriptions/37d5e605-6142-4d79-b564-28b6dbfeec0f/providers/Microsoft.Sql/locations/onebox/timeZones/Central Europe Standard Time"), - // Properties: &armsql.TimeZoneProperties{ - // DisplayName: to.Ptr("(UTC+01:00) Belgrade, Bratislava, Budapest, Ljubljana, Prague"), - // TimeZoneID: to.Ptr("Central Europe Standard Time"), - // }, - // }, - // { - // Name: to.Ptr("Central European Standard Time"), - // Type: to.Ptr("Microsoft.Sql/locations/timeZones"), - // ID: to.Ptr("/subscriptions/37d5e605-6142-4d79-b564-28b6dbfeec0f/providers/Microsoft.Sql/locations/onebox/timeZones/Central European Standard Time"), - // Properties: &armsql.TimeZoneProperties{ - // DisplayName: to.Ptr("(UTC+01:00) Sarajevo, Skopje, Warsaw, Zagreb"), - // TimeZoneID: to.Ptr("Central European Standard Time"), - // }, - // }, - // { - // Name: to.Ptr("Central Pacific Standard Time"), - // Type: to.Ptr("Microsoft.Sql/locations/timeZones"), - // ID: to.Ptr("/subscriptions/37d5e605-6142-4d79-b564-28b6dbfeec0f/providers/Microsoft.Sql/locations/onebox/timeZones/Central Pacific Standard Time"), - // Properties: &armsql.TimeZoneProperties{ - // DisplayName: to.Ptr("(UTC+11:00) Solomon Is., New Caledonia"), - // TimeZoneID: to.Ptr("Central Pacific Standard Time"), - // }, - // }, - // { - // Name: to.Ptr("Central Standard Time"), - // Type: to.Ptr("Microsoft.Sql/locations/timeZones"), - // ID: to.Ptr("/subscriptions/37d5e605-6142-4d79-b564-28b6dbfeec0f/providers/Microsoft.Sql/locations/onebox/timeZones/Central Standard Time"), - // Properties: &armsql.TimeZoneProperties{ - // DisplayName: to.Ptr("(UTC-06:00) Central Time (US & Canada)"), - // TimeZoneID: to.Ptr("Central Standard Time"), - // }, - // }, - // { - // Name: to.Ptr("Central Standard Time (Mexico)"), - // Type: to.Ptr("Microsoft.Sql/locations/timeZones"), - // ID: to.Ptr("/subscriptions/37d5e605-6142-4d79-b564-28b6dbfeec0f/providers/Microsoft.Sql/locations/onebox/timeZones/Central Standard Time (Mexico)"), - // Properties: &armsql.TimeZoneProperties{ - // DisplayName: to.Ptr("(UTC-06:00) Guadalajara, Mexico City, Monterrey"), - // TimeZoneID: to.Ptr("Central Standard Time (Mexico)"), - // }, - // }, - // { - // Name: to.Ptr("Chatham Islands Standard Time"), - // Type: to.Ptr("Microsoft.Sql/locations/timeZones"), - // ID: to.Ptr("/subscriptions/37d5e605-6142-4d79-b564-28b6dbfeec0f/providers/Microsoft.Sql/locations/onebox/timeZones/Chatham Islands Standard Time"), - // Properties: &armsql.TimeZoneProperties{ - // DisplayName: to.Ptr("(UTC+12:45) Chatham Islands"), - // TimeZoneID: to.Ptr("Chatham Islands Standard Time"), - // }, - // }, - // { - // Name: to.Ptr("China Standard Time"), - // Type: to.Ptr("Microsoft.Sql/locations/timeZones"), - // ID: to.Ptr("/subscriptions/37d5e605-6142-4d79-b564-28b6dbfeec0f/providers/Microsoft.Sql/locations/onebox/timeZones/China Standard Time"), - // Properties: &armsql.TimeZoneProperties{ - // DisplayName: to.Ptr("(UTC+08:00) Beijing, Chongqing, Hong Kong, Urumqi"), - // TimeZoneID: to.Ptr("China Standard Time"), - // }, - // }, - // { - // Name: to.Ptr("Cuba Standard Time"), - // Type: to.Ptr("Microsoft.Sql/locations/timeZones"), - // ID: to.Ptr("/subscriptions/37d5e605-6142-4d79-b564-28b6dbfeec0f/providers/Microsoft.Sql/locations/onebox/timeZones/Cuba Standard Time"), - // Properties: &armsql.TimeZoneProperties{ - // DisplayName: to.Ptr("(UTC-05:00) Havana"), - // TimeZoneID: to.Ptr("Cuba Standard Time"), - // }, - // }, - // { - // Name: to.Ptr("Dateline Standard Time"), - // Type: to.Ptr("Microsoft.Sql/locations/timeZones"), - // ID: to.Ptr("/subscriptions/37d5e605-6142-4d79-b564-28b6dbfeec0f/providers/Microsoft.Sql/locations/onebox/timeZones/Dateline Standard Time"), - // Properties: &armsql.TimeZoneProperties{ - // DisplayName: to.Ptr("(UTC-12:00) International Date Line West"), - // TimeZoneID: to.Ptr("Dateline Standard Time"), - // }, - // }, - // { - // Name: to.Ptr("E. Africa Standard Time"), - // Type: to.Ptr("Microsoft.Sql/locations/timeZones"), - // ID: to.Ptr("/subscriptions/37d5e605-6142-4d79-b564-28b6dbfeec0f/providers/Microsoft.Sql/locations/onebox/timeZones/E. Africa Standard Time"), - // Properties: &armsql.TimeZoneProperties{ - // DisplayName: to.Ptr("(UTC+03:00) Nairobi"), - // TimeZoneID: to.Ptr("E. Africa Standard Time"), - // }, - // }, - // { - // Name: to.Ptr("E. Australia Standard Time"), - // Type: to.Ptr("Microsoft.Sql/locations/timeZones"), - // ID: to.Ptr("/subscriptions/37d5e605-6142-4d79-b564-28b6dbfeec0f/providers/Microsoft.Sql/locations/onebox/timeZones/E. Australia Standard Time"), - // Properties: &armsql.TimeZoneProperties{ - // DisplayName: to.Ptr("(UTC+10:00) Brisbane"), - // TimeZoneID: to.Ptr("E. Australia Standard Time"), - // }, - // }, - // { - // Name: to.Ptr("E. Europe Standard Time"), - // Type: to.Ptr("Microsoft.Sql/locations/timeZones"), - // ID: to.Ptr("/subscriptions/37d5e605-6142-4d79-b564-28b6dbfeec0f/providers/Microsoft.Sql/locations/onebox/timeZones/E. Europe Standard Time"), - // Properties: &armsql.TimeZoneProperties{ - // DisplayName: to.Ptr("(UTC+02:00) Chisinau"), - // TimeZoneID: to.Ptr("E. Europe Standard Time"), - // }, - // }, - // { - // Name: to.Ptr("E. South America Standard Time"), - // Type: to.Ptr("Microsoft.Sql/locations/timeZones"), - // ID: to.Ptr("/subscriptions/37d5e605-6142-4d79-b564-28b6dbfeec0f/providers/Microsoft.Sql/locations/onebox/timeZones/E. South America Standard Time"), - // Properties: &armsql.TimeZoneProperties{ - // DisplayName: to.Ptr("(UTC-03:00) Brasilia"), - // TimeZoneID: to.Ptr("E. South America Standard Time"), - // }, - // }, - // { - // Name: to.Ptr("Easter Island Standard Time"), - // Type: to.Ptr("Microsoft.Sql/locations/timeZones"), - // ID: to.Ptr("/subscriptions/37d5e605-6142-4d79-b564-28b6dbfeec0f/providers/Microsoft.Sql/locations/onebox/timeZones/Easter Island Standard Time"), - // Properties: &armsql.TimeZoneProperties{ - // DisplayName: to.Ptr("(UTC-06:00) Easter Island"), - // TimeZoneID: to.Ptr("Easter Island Standard Time"), - // }, - // }, - // { - // Name: to.Ptr("Eastern Standard Time"), - // Type: to.Ptr("Microsoft.Sql/locations/timeZones"), - // ID: to.Ptr("/subscriptions/37d5e605-6142-4d79-b564-28b6dbfeec0f/providers/Microsoft.Sql/locations/onebox/timeZones/Eastern Standard Time"), - // Properties: &armsql.TimeZoneProperties{ - // DisplayName: to.Ptr("(UTC-05:00) Eastern Time (US & Canada)"), - // TimeZoneID: to.Ptr("Eastern Standard Time"), - // }, - // }, - // { - // Name: to.Ptr("Eastern Standard Time (Mexico)"), - // Type: to.Ptr("Microsoft.Sql/locations/timeZones"), - // ID: to.Ptr("/subscriptions/37d5e605-6142-4d79-b564-28b6dbfeec0f/providers/Microsoft.Sql/locations/onebox/timeZones/Eastern Standard Time (Mexico)"), - // Properties: &armsql.TimeZoneProperties{ - // DisplayName: to.Ptr("(UTC-05:00) Chetumal"), - // TimeZoneID: to.Ptr("Eastern Standard Time (Mexico)"), - // }, - // }, - // { - // Name: to.Ptr("Egypt Standard Time"), - // Type: to.Ptr("Microsoft.Sql/locations/timeZones"), - // ID: to.Ptr("/subscriptions/37d5e605-6142-4d79-b564-28b6dbfeec0f/providers/Microsoft.Sql/locations/onebox/timeZones/Egypt Standard Time"), - // Properties: &armsql.TimeZoneProperties{ - // DisplayName: to.Ptr("(UTC+02:00) Cairo"), - // TimeZoneID: to.Ptr("Egypt Standard Time"), - // }, - // }, - // { - // Name: to.Ptr("Ekaterinburg Standard Time"), - // Type: to.Ptr("Microsoft.Sql/locations/timeZones"), - // ID: to.Ptr("/subscriptions/37d5e605-6142-4d79-b564-28b6dbfeec0f/providers/Microsoft.Sql/locations/onebox/timeZones/Ekaterinburg Standard Time"), - // Properties: &armsql.TimeZoneProperties{ - // DisplayName: to.Ptr("(UTC+05:00) Ekaterinburg"), - // TimeZoneID: to.Ptr("Ekaterinburg Standard Time"), - // }, - // }, - // { - // Name: to.Ptr("Fiji Standard Time"), - // Type: to.Ptr("Microsoft.Sql/locations/timeZones"), - // ID: to.Ptr("/subscriptions/37d5e605-6142-4d79-b564-28b6dbfeec0f/providers/Microsoft.Sql/locations/onebox/timeZones/Fiji Standard Time"), - // Properties: &armsql.TimeZoneProperties{ - // DisplayName: to.Ptr("(UTC+12:00) Fiji"), - // TimeZoneID: to.Ptr("Fiji Standard Time"), - // }, - // }, - // { - // Name: to.Ptr("FLE Standard Time"), - // Type: to.Ptr("Microsoft.Sql/locations/timeZones"), - // ID: to.Ptr("/subscriptions/37d5e605-6142-4d79-b564-28b6dbfeec0f/providers/Microsoft.Sql/locations/onebox/timeZones/FLE Standard Time"), - // Properties: &armsql.TimeZoneProperties{ - // DisplayName: to.Ptr("(UTC+02:00) Helsinki, Kyiv, Riga, Sofia, Tallinn, Vilnius"), - // TimeZoneID: to.Ptr("FLE Standard Time"), - // }, - // }, - // { - // Name: to.Ptr("Georgian Standard Time"), - // Type: to.Ptr("Microsoft.Sql/locations/timeZones"), - // ID: to.Ptr("/subscriptions/37d5e605-6142-4d79-b564-28b6dbfeec0f/providers/Microsoft.Sql/locations/onebox/timeZones/Georgian Standard Time"), - // Properties: &armsql.TimeZoneProperties{ - // DisplayName: to.Ptr("(UTC+04:00) Tbilisi"), - // TimeZoneID: to.Ptr("Georgian Standard Time"), - // }, - // }, - // { - // Name: to.Ptr("GMT Standard Time"), - // Type: to.Ptr("Microsoft.Sql/locations/timeZones"), - // ID: to.Ptr("/subscriptions/37d5e605-6142-4d79-b564-28b6dbfeec0f/providers/Microsoft.Sql/locations/onebox/timeZones/GMT Standard Time"), - // Properties: &armsql.TimeZoneProperties{ - // DisplayName: to.Ptr("(UTC+00:00) Dublin, Edinburgh, Lisbon, London"), - // TimeZoneID: to.Ptr("GMT Standard Time"), - // }, - // }, - // { - // Name: to.Ptr("Greenland Standard Time"), - // Type: to.Ptr("Microsoft.Sql/locations/timeZones"), - // ID: to.Ptr("/subscriptions/37d5e605-6142-4d79-b564-28b6dbfeec0f/providers/Microsoft.Sql/locations/onebox/timeZones/Greenland Standard Time"), - // Properties: &armsql.TimeZoneProperties{ - // DisplayName: to.Ptr("(UTC-03:00) Greenland"), - // TimeZoneID: to.Ptr("Greenland Standard Time"), - // }, - // }, - // { - // Name: to.Ptr("Greenwich Standard Time"), - // Type: to.Ptr("Microsoft.Sql/locations/timeZones"), - // ID: to.Ptr("/subscriptions/37d5e605-6142-4d79-b564-28b6dbfeec0f/providers/Microsoft.Sql/locations/onebox/timeZones/Greenwich Standard Time"), - // Properties: &armsql.TimeZoneProperties{ - // DisplayName: to.Ptr("(UTC+00:00) Monrovia, Reykjavik"), - // TimeZoneID: to.Ptr("Greenwich Standard Time"), - // }, - // }, - // { - // Name: to.Ptr("GTB Standard Time"), - // Type: to.Ptr("Microsoft.Sql/locations/timeZones"), - // ID: to.Ptr("/subscriptions/37d5e605-6142-4d79-b564-28b6dbfeec0f/providers/Microsoft.Sql/locations/onebox/timeZones/GTB Standard Time"), - // Properties: &armsql.TimeZoneProperties{ - // DisplayName: to.Ptr("(UTC+02:00) Athens, Bucharest"), - // TimeZoneID: to.Ptr("GTB Standard Time"), - // }, - // }, - // { - // Name: to.Ptr("Haiti Standard Time"), - // Type: to.Ptr("Microsoft.Sql/locations/timeZones"), - // ID: to.Ptr("/subscriptions/37d5e605-6142-4d79-b564-28b6dbfeec0f/providers/Microsoft.Sql/locations/onebox/timeZones/Haiti Standard Time"), - // Properties: &armsql.TimeZoneProperties{ - // DisplayName: to.Ptr("(UTC-05:00) Haiti"), - // TimeZoneID: to.Ptr("Haiti Standard Time"), - // }, - // }, - // { - // Name: to.Ptr("Hawaiian Standard Time"), - // Type: to.Ptr("Microsoft.Sql/locations/timeZones"), - // ID: to.Ptr("/subscriptions/37d5e605-6142-4d79-b564-28b6dbfeec0f/providers/Microsoft.Sql/locations/onebox/timeZones/Hawaiian Standard Time"), - // Properties: &armsql.TimeZoneProperties{ - // DisplayName: to.Ptr("(UTC-10:00) Hawaii"), - // TimeZoneID: to.Ptr("Hawaiian Standard Time"), - // }, - // }, - // { - // Name: to.Ptr("India Standard Time"), - // Type: to.Ptr("Microsoft.Sql/locations/timeZones"), - // ID: to.Ptr("/subscriptions/37d5e605-6142-4d79-b564-28b6dbfeec0f/providers/Microsoft.Sql/locations/onebox/timeZones/India Standard Time"), - // Properties: &armsql.TimeZoneProperties{ - // DisplayName: to.Ptr("(UTC+05:30) Chennai, Kolkata, Mumbai, New Delhi"), - // TimeZoneID: to.Ptr("India Standard Time"), - // }, - // }, - // { - // Name: to.Ptr("Iran Standard Time"), - // Type: to.Ptr("Microsoft.Sql/locations/timeZones"), - // ID: to.Ptr("/subscriptions/37d5e605-6142-4d79-b564-28b6dbfeec0f/providers/Microsoft.Sql/locations/onebox/timeZones/Iran Standard Time"), - // Properties: &armsql.TimeZoneProperties{ - // DisplayName: to.Ptr("(UTC+03:30) Tehran"), - // TimeZoneID: to.Ptr("Iran Standard Time"), - // }, - // }, - // { - // Name: to.Ptr("Israel Standard Time"), - // Type: to.Ptr("Microsoft.Sql/locations/timeZones"), - // ID: to.Ptr("/subscriptions/37d5e605-6142-4d79-b564-28b6dbfeec0f/providers/Microsoft.Sql/locations/onebox/timeZones/Israel Standard Time"), - // Properties: &armsql.TimeZoneProperties{ - // DisplayName: to.Ptr("(UTC+02:00) Jerusalem"), - // TimeZoneID: to.Ptr("Israel Standard Time"), - // }, - // }, - // { - // Name: to.Ptr("Jordan Standard Time"), - // Type: to.Ptr("Microsoft.Sql/locations/timeZones"), - // ID: to.Ptr("/subscriptions/37d5e605-6142-4d79-b564-28b6dbfeec0f/providers/Microsoft.Sql/locations/onebox/timeZones/Jordan Standard Time"), - // Properties: &armsql.TimeZoneProperties{ - // DisplayName: to.Ptr("(UTC+02:00) Amman"), - // TimeZoneID: to.Ptr("Jordan Standard Time"), - // }, - // }, - // { - // Name: to.Ptr("Kaliningrad Standard Time"), - // Type: to.Ptr("Microsoft.Sql/locations/timeZones"), - // ID: to.Ptr("/subscriptions/37d5e605-6142-4d79-b564-28b6dbfeec0f/providers/Microsoft.Sql/locations/onebox/timeZones/Kaliningrad Standard Time"), - // Properties: &armsql.TimeZoneProperties{ - // DisplayName: to.Ptr("(UTC+02:00) Kaliningrad"), - // TimeZoneID: to.Ptr("Kaliningrad Standard Time"), - // }, - // }, - // { - // Name: to.Ptr("Kamchatka Standard Time"), - // Type: to.Ptr("Microsoft.Sql/locations/timeZones"), - // ID: to.Ptr("/subscriptions/37d5e605-6142-4d79-b564-28b6dbfeec0f/providers/Microsoft.Sql/locations/onebox/timeZones/Kamchatka Standard Time"), - // Properties: &armsql.TimeZoneProperties{ - // DisplayName: to.Ptr("(UTC+12:00) Petropavlovsk-Kamchatsky - Old"), - // TimeZoneID: to.Ptr("Kamchatka Standard Time"), - // }, - // }, - // { - // Name: to.Ptr("Korea Standard Time"), - // Type: to.Ptr("Microsoft.Sql/locations/timeZones"), - // ID: to.Ptr("/subscriptions/37d5e605-6142-4d79-b564-28b6dbfeec0f/providers/Microsoft.Sql/locations/onebox/timeZones/Korea Standard Time"), - // Properties: &armsql.TimeZoneProperties{ - // DisplayName: to.Ptr("(UTC+09:00) Seoul"), - // TimeZoneID: to.Ptr("Korea Standard Time"), - // }, - // }, - // { - // Name: to.Ptr("Libya Standard Time"), - // Type: to.Ptr("Microsoft.Sql/locations/timeZones"), - // ID: to.Ptr("/subscriptions/37d5e605-6142-4d79-b564-28b6dbfeec0f/providers/Microsoft.Sql/locations/onebox/timeZones/Libya Standard Time"), - // Properties: &armsql.TimeZoneProperties{ - // DisplayName: to.Ptr("(UTC+02:00) Tripoli"), - // TimeZoneID: to.Ptr("Libya Standard Time"), - // }, - // }, - // { - // Name: to.Ptr("Line Islands Standard Time"), - // Type: to.Ptr("Microsoft.Sql/locations/timeZones"), - // ID: to.Ptr("/subscriptions/37d5e605-6142-4d79-b564-28b6dbfeec0f/providers/Microsoft.Sql/locations/onebox/timeZones/Line Islands Standard Time"), - // Properties: &armsql.TimeZoneProperties{ - // DisplayName: to.Ptr("(UTC+14:00) Kiritimati Island"), - // TimeZoneID: to.Ptr("Line Islands Standard Time"), - // }, - // }, - // { - // Name: to.Ptr("Lord Howe Standard Time"), - // Type: to.Ptr("Microsoft.Sql/locations/timeZones"), - // ID: to.Ptr("/subscriptions/37d5e605-6142-4d79-b564-28b6dbfeec0f/providers/Microsoft.Sql/locations/onebox/timeZones/Lord Howe Standard Time"), - // Properties: &armsql.TimeZoneProperties{ - // DisplayName: to.Ptr("(UTC+10:30) Lord Howe Island"), - // TimeZoneID: to.Ptr("Lord Howe Standard Time"), - // }, - // }, - // { - // Name: to.Ptr("Magadan Standard Time"), - // Type: to.Ptr("Microsoft.Sql/locations/timeZones"), - // ID: to.Ptr("/subscriptions/37d5e605-6142-4d79-b564-28b6dbfeec0f/providers/Microsoft.Sql/locations/onebox/timeZones/Magadan Standard Time"), - // Properties: &armsql.TimeZoneProperties{ - // DisplayName: to.Ptr("(UTC+11:00) Magadan"), - // TimeZoneID: to.Ptr("Magadan Standard Time"), - // }, - // }, - // { - // Name: to.Ptr("Magallanes Standard Time"), - // Type: to.Ptr("Microsoft.Sql/locations/timeZones"), - // ID: to.Ptr("/subscriptions/37d5e605-6142-4d79-b564-28b6dbfeec0f/providers/Microsoft.Sql/locations/onebox/timeZones/Magallanes Standard Time"), - // Properties: &armsql.TimeZoneProperties{ - // DisplayName: to.Ptr("(UTC-03:00) Punta Arenas"), - // TimeZoneID: to.Ptr("Magallanes Standard Time"), - // }, - // }, - // { - // Name: to.Ptr("Marquesas Standard Time"), - // Type: to.Ptr("Microsoft.Sql/locations/timeZones"), - // ID: to.Ptr("/subscriptions/37d5e605-6142-4d79-b564-28b6dbfeec0f/providers/Microsoft.Sql/locations/onebox/timeZones/Marquesas Standard Time"), - // Properties: &armsql.TimeZoneProperties{ - // DisplayName: to.Ptr("(UTC-09:30) Marquesas Islands"), - // TimeZoneID: to.Ptr("Marquesas Standard Time"), - // }, - // }, - // { - // Name: to.Ptr("Mauritius Standard Time"), - // Type: to.Ptr("Microsoft.Sql/locations/timeZones"), - // ID: to.Ptr("/subscriptions/37d5e605-6142-4d79-b564-28b6dbfeec0f/providers/Microsoft.Sql/locations/onebox/timeZones/Mauritius Standard Time"), - // Properties: &armsql.TimeZoneProperties{ - // DisplayName: to.Ptr("(UTC+04:00) Port Louis"), - // TimeZoneID: to.Ptr("Mauritius Standard Time"), - // }, - // }, - // { - // Name: to.Ptr("Mid-Atlantic Standard Time"), - // Type: to.Ptr("Microsoft.Sql/locations/timeZones"), - // ID: to.Ptr("/subscriptions/37d5e605-6142-4d79-b564-28b6dbfeec0f/providers/Microsoft.Sql/locations/onebox/timeZones/Mid-Atlantic Standard Time"), - // Properties: &armsql.TimeZoneProperties{ - // DisplayName: to.Ptr("(UTC-02:00) Mid-Atlantic - Old"), - // TimeZoneID: to.Ptr("Mid-Atlantic Standard Time"), - // }, - // }, - // { - // Name: to.Ptr("Middle East Standard Time"), - // Type: to.Ptr("Microsoft.Sql/locations/timeZones"), - // ID: to.Ptr("/subscriptions/37d5e605-6142-4d79-b564-28b6dbfeec0f/providers/Microsoft.Sql/locations/onebox/timeZones/Middle East Standard Time"), - // Properties: &armsql.TimeZoneProperties{ - // DisplayName: to.Ptr("(UTC+02:00) Beirut"), - // TimeZoneID: to.Ptr("Middle East Standard Time"), - // }, - // }, - // { - // Name: to.Ptr("Montevideo Standard Time"), - // Type: to.Ptr("Microsoft.Sql/locations/timeZones"), - // ID: to.Ptr("/subscriptions/37d5e605-6142-4d79-b564-28b6dbfeec0f/providers/Microsoft.Sql/locations/onebox/timeZones/Montevideo Standard Time"), - // Properties: &armsql.TimeZoneProperties{ - // DisplayName: to.Ptr("(UTC-03:00) Montevideo"), - // TimeZoneID: to.Ptr("Montevideo Standard Time"), - // }, - // }, - // { - // Name: to.Ptr("Morocco Standard Time"), - // Type: to.Ptr("Microsoft.Sql/locations/timeZones"), - // ID: to.Ptr("/subscriptions/37d5e605-6142-4d79-b564-28b6dbfeec0f/providers/Microsoft.Sql/locations/onebox/timeZones/Morocco Standard Time"), - // Properties: &armsql.TimeZoneProperties{ - // DisplayName: to.Ptr("(UTC+01:00) Casablanca"), - // TimeZoneID: to.Ptr("Morocco Standard Time"), - // }, - // }, - // { - // Name: to.Ptr("Mountain Standard Time"), - // Type: to.Ptr("Microsoft.Sql/locations/timeZones"), - // ID: to.Ptr("/subscriptions/37d5e605-6142-4d79-b564-28b6dbfeec0f/providers/Microsoft.Sql/locations/onebox/timeZones/Mountain Standard Time"), - // Properties: &armsql.TimeZoneProperties{ - // DisplayName: to.Ptr("(UTC-07:00) Mountain Time (US & Canada)"), - // TimeZoneID: to.Ptr("Mountain Standard Time"), - // }, - // }, - // { - // Name: to.Ptr("Mountain Standard Time (Mexico)"), - // Type: to.Ptr("Microsoft.Sql/locations/timeZones"), - // ID: to.Ptr("/subscriptions/37d5e605-6142-4d79-b564-28b6dbfeec0f/providers/Microsoft.Sql/locations/onebox/timeZones/Mountain Standard Time (Mexico)"), - // Properties: &armsql.TimeZoneProperties{ - // DisplayName: to.Ptr("(UTC-07:00) Chihuahua, La Paz, Mazatlan"), - // TimeZoneID: to.Ptr("Mountain Standard Time (Mexico)"), - // }, - // }, - // { - // Name: to.Ptr("Myanmar Standard Time"), - // Type: to.Ptr("Microsoft.Sql/locations/timeZones"), - // ID: to.Ptr("/subscriptions/37d5e605-6142-4d79-b564-28b6dbfeec0f/providers/Microsoft.Sql/locations/onebox/timeZones/Myanmar Standard Time"), - // Properties: &armsql.TimeZoneProperties{ - // DisplayName: to.Ptr("(UTC+06:30) Yangon (Rangoon)"), - // TimeZoneID: to.Ptr("Myanmar Standard Time"), - // }, - // }, - // { - // Name: to.Ptr("N. Central Asia Standard Time"), - // Type: to.Ptr("Microsoft.Sql/locations/timeZones"), - // ID: to.Ptr("/subscriptions/37d5e605-6142-4d79-b564-28b6dbfeec0f/providers/Microsoft.Sql/locations/onebox/timeZones/N. Central Asia Standard Time"), - // Properties: &armsql.TimeZoneProperties{ - // DisplayName: to.Ptr("(UTC+07:00) Novosibirsk"), - // TimeZoneID: to.Ptr("N. Central Asia Standard Time"), - // }, - // }, - // { - // Name: to.Ptr("Namibia Standard Time"), - // Type: to.Ptr("Microsoft.Sql/locations/timeZones"), - // ID: to.Ptr("/subscriptions/37d5e605-6142-4d79-b564-28b6dbfeec0f/providers/Microsoft.Sql/locations/onebox/timeZones/Namibia Standard Time"), - // Properties: &armsql.TimeZoneProperties{ - // DisplayName: to.Ptr("(UTC+02:00) Windhoek"), - // TimeZoneID: to.Ptr("Namibia Standard Time"), - // }, - // }, - // { - // Name: to.Ptr("Nepal Standard Time"), - // Type: to.Ptr("Microsoft.Sql/locations/timeZones"), - // ID: to.Ptr("/subscriptions/37d5e605-6142-4d79-b564-28b6dbfeec0f/providers/Microsoft.Sql/locations/onebox/timeZones/Nepal Standard Time"), - // Properties: &armsql.TimeZoneProperties{ - // DisplayName: to.Ptr("(UTC+05:45) Kathmandu"), - // TimeZoneID: to.Ptr("Nepal Standard Time"), - // }, - // }, - // { - // Name: to.Ptr("New Zealand Standard Time"), - // Type: to.Ptr("Microsoft.Sql/locations/timeZones"), - // ID: to.Ptr("/subscriptions/37d5e605-6142-4d79-b564-28b6dbfeec0f/providers/Microsoft.Sql/locations/onebox/timeZones/New Zealand Standard Time"), - // Properties: &armsql.TimeZoneProperties{ - // DisplayName: to.Ptr("(UTC+12:00) Auckland, Wellington"), - // TimeZoneID: to.Ptr("New Zealand Standard Time"), - // }, - // }, - // { - // Name: to.Ptr("Newfoundland Standard Time"), - // Type: to.Ptr("Microsoft.Sql/locations/timeZones"), - // ID: to.Ptr("/subscriptions/37d5e605-6142-4d79-b564-28b6dbfeec0f/providers/Microsoft.Sql/locations/onebox/timeZones/Newfoundland Standard Time"), - // Properties: &armsql.TimeZoneProperties{ - // DisplayName: to.Ptr("(UTC-03:30) Newfoundland"), - // TimeZoneID: to.Ptr("Newfoundland Standard Time"), - // }, - // }, - // { - // Name: to.Ptr("Norfolk Standard Time"), - // Type: to.Ptr("Microsoft.Sql/locations/timeZones"), - // ID: to.Ptr("/subscriptions/37d5e605-6142-4d79-b564-28b6dbfeec0f/providers/Microsoft.Sql/locations/onebox/timeZones/Norfolk Standard Time"), - // Properties: &armsql.TimeZoneProperties{ - // DisplayName: to.Ptr("(UTC+11:00) Norfolk Island"), - // TimeZoneID: to.Ptr("Norfolk Standard Time"), - // }, - // }, - // { - // Name: to.Ptr("North Asia East Standard Time"), - // Type: to.Ptr("Microsoft.Sql/locations/timeZones"), - // ID: to.Ptr("/subscriptions/37d5e605-6142-4d79-b564-28b6dbfeec0f/providers/Microsoft.Sql/locations/onebox/timeZones/North Asia East Standard Time"), - // Properties: &armsql.TimeZoneProperties{ - // DisplayName: to.Ptr("(UTC+08:00) Irkutsk"), - // TimeZoneID: to.Ptr("North Asia East Standard Time"), - // }, - // }, - // { - // Name: to.Ptr("North Asia Standard Time"), - // Type: to.Ptr("Microsoft.Sql/locations/timeZones"), - // ID: to.Ptr("/subscriptions/37d5e605-6142-4d79-b564-28b6dbfeec0f/providers/Microsoft.Sql/locations/onebox/timeZones/North Asia Standard Time"), - // Properties: &armsql.TimeZoneProperties{ - // DisplayName: to.Ptr("(UTC+07:00) Krasnoyarsk"), - // TimeZoneID: to.Ptr("North Asia Standard Time"), - // }, - // }, - // { - // Name: to.Ptr("North Korea Standard Time"), - // Type: to.Ptr("Microsoft.Sql/locations/timeZones"), - // ID: to.Ptr("/subscriptions/37d5e605-6142-4d79-b564-28b6dbfeec0f/providers/Microsoft.Sql/locations/onebox/timeZones/North Korea Standard Time"), - // Properties: &armsql.TimeZoneProperties{ - // DisplayName: to.Ptr("(UTC+09:00) Pyongyang"), - // TimeZoneID: to.Ptr("North Korea Standard Time"), - // }, - // }, - // { - // Name: to.Ptr("Omsk Standard Time"), - // Type: to.Ptr("Microsoft.Sql/locations/timeZones"), - // ID: to.Ptr("/subscriptions/37d5e605-6142-4d79-b564-28b6dbfeec0f/providers/Microsoft.Sql/locations/onebox/timeZones/Omsk Standard Time"), - // Properties: &armsql.TimeZoneProperties{ - // DisplayName: to.Ptr("(UTC+06:00) Omsk"), - // TimeZoneID: to.Ptr("Omsk Standard Time"), - // }, - // }, - // { - // Name: to.Ptr("Pacific SA Standard Time"), - // Type: to.Ptr("Microsoft.Sql/locations/timeZones"), - // ID: to.Ptr("/subscriptions/37d5e605-6142-4d79-b564-28b6dbfeec0f/providers/Microsoft.Sql/locations/onebox/timeZones/Pacific SA Standard Time"), - // Properties: &armsql.TimeZoneProperties{ - // DisplayName: to.Ptr("(UTC-04:00) Santiago"), - // TimeZoneID: to.Ptr("Pacific SA Standard Time"), - // }, - // }, - // { - // Name: to.Ptr("Pacific Standard Time"), - // Type: to.Ptr("Microsoft.Sql/locations/timeZones"), - // ID: to.Ptr("/subscriptions/37d5e605-6142-4d79-b564-28b6dbfeec0f/providers/Microsoft.Sql/locations/onebox/timeZones/Pacific Standard Time"), - // Properties: &armsql.TimeZoneProperties{ - // DisplayName: to.Ptr("(UTC-08:00) Pacific Time (US & Canada)"), - // TimeZoneID: to.Ptr("Pacific Standard Time"), - // }, - // }, - // { - // Name: to.Ptr("Pacific Standard Time (Mexico)"), - // Type: to.Ptr("Microsoft.Sql/locations/timeZones"), - // ID: to.Ptr("/subscriptions/37d5e605-6142-4d79-b564-28b6dbfeec0f/providers/Microsoft.Sql/locations/onebox/timeZones/Pacific Standard Time (Mexico)"), - // Properties: &armsql.TimeZoneProperties{ - // DisplayName: to.Ptr("(UTC-08:00) Baja California"), - // TimeZoneID: to.Ptr("Pacific Standard Time (Mexico)"), - // }, - // }, - // { - // Name: to.Ptr("Pakistan Standard Time"), - // Type: to.Ptr("Microsoft.Sql/locations/timeZones"), - // ID: to.Ptr("/subscriptions/37d5e605-6142-4d79-b564-28b6dbfeec0f/providers/Microsoft.Sql/locations/onebox/timeZones/Pakistan Standard Time"), - // Properties: &armsql.TimeZoneProperties{ - // DisplayName: to.Ptr("(UTC+05:00) Islamabad, Karachi"), - // TimeZoneID: to.Ptr("Pakistan Standard Time"), - // }, - // }, - // { - // Name: to.Ptr("Paraguay Standard Time"), - // Type: to.Ptr("Microsoft.Sql/locations/timeZones"), - // ID: to.Ptr("/subscriptions/37d5e605-6142-4d79-b564-28b6dbfeec0f/providers/Microsoft.Sql/locations/onebox/timeZones/Paraguay Standard Time"), - // Properties: &armsql.TimeZoneProperties{ - // DisplayName: to.Ptr("(UTC-04:00) Asuncion"), - // TimeZoneID: to.Ptr("Paraguay Standard Time"), - // }, - // }, - // { - // Name: to.Ptr("Qyzylorda Standard Time"), - // Type: to.Ptr("Microsoft.Sql/locations/timeZones"), - // ID: to.Ptr("/subscriptions/37d5e605-6142-4d79-b564-28b6dbfeec0f/providers/Microsoft.Sql/locations/onebox/timeZones/Qyzylorda Standard Time"), - // Properties: &armsql.TimeZoneProperties{ - // DisplayName: to.Ptr("(UTC+05:00) Qyzylorda"), - // TimeZoneID: to.Ptr("Qyzylorda Standard Time"), - // }, - // }, - // { - // Name: to.Ptr("Romance Standard Time"), - // Type: to.Ptr("Microsoft.Sql/locations/timeZones"), - // ID: to.Ptr("/subscriptions/37d5e605-6142-4d79-b564-28b6dbfeec0f/providers/Microsoft.Sql/locations/onebox/timeZones/Romance Standard Time"), - // Properties: &armsql.TimeZoneProperties{ - // DisplayName: to.Ptr("(UTC+01:00) Brussels, Copenhagen, Madrid, Paris"), - // TimeZoneID: to.Ptr("Romance Standard Time"), - // }, - // }, - // { - // Name: to.Ptr("Russia Time Zone 10"), - // Type: to.Ptr("Microsoft.Sql/locations/timeZones"), - // ID: to.Ptr("/subscriptions/37d5e605-6142-4d79-b564-28b6dbfeec0f/providers/Microsoft.Sql/locations/onebox/timeZones/Russia Time Zone 10"), - // Properties: &armsql.TimeZoneProperties{ - // DisplayName: to.Ptr("(UTC+11:00) Chokurdakh"), - // TimeZoneID: to.Ptr("Russia Time Zone 10"), - // }, - // }, - // { - // Name: to.Ptr("Russia Time Zone 11"), - // Type: to.Ptr("Microsoft.Sql/locations/timeZones"), - // ID: to.Ptr("/subscriptions/37d5e605-6142-4d79-b564-28b6dbfeec0f/providers/Microsoft.Sql/locations/onebox/timeZones/Russia Time Zone 11"), - // Properties: &armsql.TimeZoneProperties{ - // DisplayName: to.Ptr("(UTC+12:00) Anadyr, Petropavlovsk-Kamchatsky"), - // TimeZoneID: to.Ptr("Russia Time Zone 11"), - // }, - // }, - // { - // Name: to.Ptr("Russia Time Zone 3"), - // Type: to.Ptr("Microsoft.Sql/locations/timeZones"), - // ID: to.Ptr("/subscriptions/37d5e605-6142-4d79-b564-28b6dbfeec0f/providers/Microsoft.Sql/locations/onebox/timeZones/Russia Time Zone 3"), - // Properties: &armsql.TimeZoneProperties{ - // DisplayName: to.Ptr("(UTC+04:00) Izhevsk, Samara"), - // TimeZoneID: to.Ptr("Russia Time Zone 3"), - // }, - // }, - // { - // Name: to.Ptr("Russian Standard Time"), - // Type: to.Ptr("Microsoft.Sql/locations/timeZones"), - // ID: to.Ptr("/subscriptions/37d5e605-6142-4d79-b564-28b6dbfeec0f/providers/Microsoft.Sql/locations/onebox/timeZones/Russian Standard Time"), - // Properties: &armsql.TimeZoneProperties{ - // DisplayName: to.Ptr("(UTC+03:00) Moscow, St. Petersburg"), - // TimeZoneID: to.Ptr("Russian Standard Time"), - // }, - // }, - // { - // Name: to.Ptr("SA Eastern Standard Time"), - // Type: to.Ptr("Microsoft.Sql/locations/timeZones"), - // ID: to.Ptr("/subscriptions/37d5e605-6142-4d79-b564-28b6dbfeec0f/providers/Microsoft.Sql/locations/onebox/timeZones/SA Eastern Standard Time"), - // Properties: &armsql.TimeZoneProperties{ - // DisplayName: to.Ptr("(UTC-03:00) Cayenne, Fortaleza"), - // TimeZoneID: to.Ptr("SA Eastern Standard Time"), - // }, - // }, - // { - // Name: to.Ptr("SA Pacific Standard Time"), - // Type: to.Ptr("Microsoft.Sql/locations/timeZones"), - // ID: to.Ptr("/subscriptions/37d5e605-6142-4d79-b564-28b6dbfeec0f/providers/Microsoft.Sql/locations/onebox/timeZones/SA Pacific Standard Time"), - // Properties: &armsql.TimeZoneProperties{ - // DisplayName: to.Ptr("(UTC-05:00) Bogota, Lima, Quito, Rio Branco"), - // TimeZoneID: to.Ptr("SA Pacific Standard Time"), - // }, - // }, - // { - // Name: to.Ptr("SA Western Standard Time"), - // Type: to.Ptr("Microsoft.Sql/locations/timeZones"), - // ID: to.Ptr("/subscriptions/37d5e605-6142-4d79-b564-28b6dbfeec0f/providers/Microsoft.Sql/locations/onebox/timeZones/SA Western Standard Time"), - // Properties: &armsql.TimeZoneProperties{ - // DisplayName: to.Ptr("(UTC-04:00) Georgetown, La Paz, Manaus, San Juan"), - // TimeZoneID: to.Ptr("SA Western Standard Time"), - // }, - // }, - // { - // Name: to.Ptr("Saint Pierre Standard Time"), - // Type: to.Ptr("Microsoft.Sql/locations/timeZones"), - // ID: to.Ptr("/subscriptions/37d5e605-6142-4d79-b564-28b6dbfeec0f/providers/Microsoft.Sql/locations/onebox/timeZones/Saint Pierre Standard Time"), - // Properties: &armsql.TimeZoneProperties{ - // DisplayName: to.Ptr("(UTC-03:00) Saint Pierre and Miquelon"), - // TimeZoneID: to.Ptr("Saint Pierre Standard Time"), - // }, - // }, - // { - // Name: to.Ptr("Sakhalin Standard Time"), - // Type: to.Ptr("Microsoft.Sql/locations/timeZones"), - // ID: to.Ptr("/subscriptions/37d5e605-6142-4d79-b564-28b6dbfeec0f/providers/Microsoft.Sql/locations/onebox/timeZones/Sakhalin Standard Time"), - // Properties: &armsql.TimeZoneProperties{ - // DisplayName: to.Ptr("(UTC+11:00) Sakhalin"), - // TimeZoneID: to.Ptr("Sakhalin Standard Time"), - // }, - // }, - // { - // Name: to.Ptr("Samoa Standard Time"), - // Type: to.Ptr("Microsoft.Sql/locations/timeZones"), - // ID: to.Ptr("/subscriptions/37d5e605-6142-4d79-b564-28b6dbfeec0f/providers/Microsoft.Sql/locations/onebox/timeZones/Samoa Standard Time"), - // Properties: &armsql.TimeZoneProperties{ - // DisplayName: to.Ptr("(UTC+13:00) Samoa"), - // TimeZoneID: to.Ptr("Samoa Standard Time"), - // }, - // }, - // { - // Name: to.Ptr("Sao Tome Standard Time"), - // Type: to.Ptr("Microsoft.Sql/locations/timeZones"), - // ID: to.Ptr("/subscriptions/37d5e605-6142-4d79-b564-28b6dbfeec0f/providers/Microsoft.Sql/locations/onebox/timeZones/Sao Tome Standard Time"), - // Properties: &armsql.TimeZoneProperties{ - // DisplayName: to.Ptr("(UTC+00:00) Sao Tome"), - // TimeZoneID: to.Ptr("Sao Tome Standard Time"), - // }, - // }, - // { - // Name: to.Ptr("Saratov Standard Time"), - // Type: to.Ptr("Microsoft.Sql/locations/timeZones"), - // ID: to.Ptr("/subscriptions/37d5e605-6142-4d79-b564-28b6dbfeec0f/providers/Microsoft.Sql/locations/onebox/timeZones/Saratov Standard Time"), - // Properties: &armsql.TimeZoneProperties{ - // DisplayName: to.Ptr("(UTC+04:00) Saratov"), - // TimeZoneID: to.Ptr("Saratov Standard Time"), - // }, - // }, - // { - // Name: to.Ptr("SE Asia Standard Time"), - // Type: to.Ptr("Microsoft.Sql/locations/timeZones"), - // ID: to.Ptr("/subscriptions/37d5e605-6142-4d79-b564-28b6dbfeec0f/providers/Microsoft.Sql/locations/onebox/timeZones/SE Asia Standard Time"), - // Properties: &armsql.TimeZoneProperties{ - // DisplayName: to.Ptr("(UTC+07:00) Bangkok, Hanoi, Jakarta"), - // TimeZoneID: to.Ptr("SE Asia Standard Time"), - // }, - // }, - // { - // Name: to.Ptr("Singapore Standard Time"), - // Type: to.Ptr("Microsoft.Sql/locations/timeZones"), - // ID: to.Ptr("/subscriptions/37d5e605-6142-4d79-b564-28b6dbfeec0f/providers/Microsoft.Sql/locations/onebox/timeZones/Singapore Standard Time"), - // Properties: &armsql.TimeZoneProperties{ - // DisplayName: to.Ptr("(UTC+08:00) Kuala Lumpur, Singapore"), - // TimeZoneID: to.Ptr("Singapore Standard Time"), - // }, - // }, - // { - // Name: to.Ptr("South Africa Standard Time"), - // Type: to.Ptr("Microsoft.Sql/locations/timeZones"), - // ID: to.Ptr("/subscriptions/37d5e605-6142-4d79-b564-28b6dbfeec0f/providers/Microsoft.Sql/locations/onebox/timeZones/South Africa Standard Time"), - // Properties: &armsql.TimeZoneProperties{ - // DisplayName: to.Ptr("(UTC+02:00) Harare, Pretoria"), - // TimeZoneID: to.Ptr("South Africa Standard Time"), - // }, - // }, - // { - // Name: to.Ptr("Sri Lanka Standard Time"), - // Type: to.Ptr("Microsoft.Sql/locations/timeZones"), - // ID: to.Ptr("/subscriptions/37d5e605-6142-4d79-b564-28b6dbfeec0f/providers/Microsoft.Sql/locations/onebox/timeZones/Sri Lanka Standard Time"), - // Properties: &armsql.TimeZoneProperties{ - // DisplayName: to.Ptr("(UTC+05:30) Sri Jayawardenepura"), - // TimeZoneID: to.Ptr("Sri Lanka Standard Time"), - // }, - // }, - // { - // Name: to.Ptr("Sudan Standard Time"), - // Type: to.Ptr("Microsoft.Sql/locations/timeZones"), - // ID: to.Ptr("/subscriptions/37d5e605-6142-4d79-b564-28b6dbfeec0f/providers/Microsoft.Sql/locations/onebox/timeZones/Sudan Standard Time"), - // Properties: &armsql.TimeZoneProperties{ - // DisplayName: to.Ptr("(UTC+02:00) Khartoum"), - // TimeZoneID: to.Ptr("Sudan Standard Time"), - // }, - // }, - // { - // Name: to.Ptr("Syria Standard Time"), - // Type: to.Ptr("Microsoft.Sql/locations/timeZones"), - // ID: to.Ptr("/subscriptions/37d5e605-6142-4d79-b564-28b6dbfeec0f/providers/Microsoft.Sql/locations/onebox/timeZones/Syria Standard Time"), - // Properties: &armsql.TimeZoneProperties{ - // DisplayName: to.Ptr("(UTC+02:00) Damascus"), - // TimeZoneID: to.Ptr("Syria Standard Time"), - // }, - // }, - // { - // Name: to.Ptr("Taipei Standard Time"), - // Type: to.Ptr("Microsoft.Sql/locations/timeZones"), - // ID: to.Ptr("/subscriptions/37d5e605-6142-4d79-b564-28b6dbfeec0f/providers/Microsoft.Sql/locations/onebox/timeZones/Taipei Standard Time"), - // Properties: &armsql.TimeZoneProperties{ - // DisplayName: to.Ptr("(UTC+08:00) Taipei"), - // TimeZoneID: to.Ptr("Taipei Standard Time"), - // }, - // }, - // { - // Name: to.Ptr("Tasmania Standard Time"), - // Type: to.Ptr("Microsoft.Sql/locations/timeZones"), - // ID: to.Ptr("/subscriptions/37d5e605-6142-4d79-b564-28b6dbfeec0f/providers/Microsoft.Sql/locations/onebox/timeZones/Tasmania Standard Time"), - // Properties: &armsql.TimeZoneProperties{ - // DisplayName: to.Ptr("(UTC+10:00) Hobart"), - // TimeZoneID: to.Ptr("Tasmania Standard Time"), - // }, - // }, - // { - // Name: to.Ptr("Tocantins Standard Time"), - // Type: to.Ptr("Microsoft.Sql/locations/timeZones"), - // ID: to.Ptr("/subscriptions/37d5e605-6142-4d79-b564-28b6dbfeec0f/providers/Microsoft.Sql/locations/onebox/timeZones/Tocantins Standard Time"), - // Properties: &armsql.TimeZoneProperties{ - // DisplayName: to.Ptr("(UTC-03:00) Araguaina"), - // TimeZoneID: to.Ptr("Tocantins Standard Time"), - // }, - // }, - // { - // Name: to.Ptr("Tokyo Standard Time"), - // Type: to.Ptr("Microsoft.Sql/locations/timeZones"), - // ID: to.Ptr("/subscriptions/37d5e605-6142-4d79-b564-28b6dbfeec0f/providers/Microsoft.Sql/locations/onebox/timeZones/Tokyo Standard Time"), - // Properties: &armsql.TimeZoneProperties{ - // DisplayName: to.Ptr("(UTC+09:00) Osaka, Sapporo, Tokyo"), - // TimeZoneID: to.Ptr("Tokyo Standard Time"), - // }, - // }, - // { - // Name: to.Ptr("Tomsk Standard Time"), - // Type: to.Ptr("Microsoft.Sql/locations/timeZones"), - // ID: to.Ptr("/subscriptions/37d5e605-6142-4d79-b564-28b6dbfeec0f/providers/Microsoft.Sql/locations/onebox/timeZones/Tomsk Standard Time"), - // Properties: &armsql.TimeZoneProperties{ - // DisplayName: to.Ptr("(UTC+07:00) Tomsk"), - // TimeZoneID: to.Ptr("Tomsk Standard Time"), - // }, - // }, - // { - // Name: to.Ptr("Tonga Standard Time"), - // Type: to.Ptr("Microsoft.Sql/locations/timeZones"), - // ID: to.Ptr("/subscriptions/37d5e605-6142-4d79-b564-28b6dbfeec0f/providers/Microsoft.Sql/locations/onebox/timeZones/Tonga Standard Time"), - // Properties: &armsql.TimeZoneProperties{ - // DisplayName: to.Ptr("(UTC+13:00) Nuku'alofa"), - // TimeZoneID: to.Ptr("Tonga Standard Time"), - // }, - // }, - // { - // Name: to.Ptr("Transbaikal Standard Time"), - // Type: to.Ptr("Microsoft.Sql/locations/timeZones"), - // ID: to.Ptr("/subscriptions/37d5e605-6142-4d79-b564-28b6dbfeec0f/providers/Microsoft.Sql/locations/onebox/timeZones/Transbaikal Standard Time"), - // Properties: &armsql.TimeZoneProperties{ - // DisplayName: to.Ptr("(UTC+09:00) Chita"), - // TimeZoneID: to.Ptr("Transbaikal Standard Time"), - // }, - // }, - // { - // Name: to.Ptr("Turkey Standard Time"), - // Type: to.Ptr("Microsoft.Sql/locations/timeZones"), - // ID: to.Ptr("/subscriptions/37d5e605-6142-4d79-b564-28b6dbfeec0f/providers/Microsoft.Sql/locations/onebox/timeZones/Turkey Standard Time"), - // Properties: &armsql.TimeZoneProperties{ - // DisplayName: to.Ptr("(UTC+03:00) Istanbul"), - // TimeZoneID: to.Ptr("Turkey Standard Time"), - // }, - // }, - // { - // Name: to.Ptr("Turks And Caicos Standard Time"), - // Type: to.Ptr("Microsoft.Sql/locations/timeZones"), - // ID: to.Ptr("/subscriptions/37d5e605-6142-4d79-b564-28b6dbfeec0f/providers/Microsoft.Sql/locations/onebox/timeZones/Turks And Caicos Standard Time"), - // Properties: &armsql.TimeZoneProperties{ - // DisplayName: to.Ptr("(UTC-05:00) Turks and Caicos"), - // TimeZoneID: to.Ptr("Turks And Caicos Standard Time"), - // }, - // }, - // { - // Name: to.Ptr("Ulaanbaatar Standard Time"), - // Type: to.Ptr("Microsoft.Sql/locations/timeZones"), - // ID: to.Ptr("/subscriptions/37d5e605-6142-4d79-b564-28b6dbfeec0f/providers/Microsoft.Sql/locations/onebox/timeZones/Ulaanbaatar Standard Time"), - // Properties: &armsql.TimeZoneProperties{ - // DisplayName: to.Ptr("(UTC+08:00) Ulaanbaatar"), - // TimeZoneID: to.Ptr("Ulaanbaatar Standard Time"), - // }, - // }, - // { - // Name: to.Ptr("US Eastern Standard Time"), - // Type: to.Ptr("Microsoft.Sql/locations/timeZones"), - // ID: to.Ptr("/subscriptions/37d5e605-6142-4d79-b564-28b6dbfeec0f/providers/Microsoft.Sql/locations/onebox/timeZones/US Eastern Standard Time"), - // Properties: &armsql.TimeZoneProperties{ - // DisplayName: to.Ptr("(UTC-05:00) Indiana (East)"), - // TimeZoneID: to.Ptr("US Eastern Standard Time"), - // }, - // }, - // { - // Name: to.Ptr("US Mountain Standard Time"), - // Type: to.Ptr("Microsoft.Sql/locations/timeZones"), - // ID: to.Ptr("/subscriptions/37d5e605-6142-4d79-b564-28b6dbfeec0f/providers/Microsoft.Sql/locations/onebox/timeZones/US Mountain Standard Time"), - // Properties: &armsql.TimeZoneProperties{ - // DisplayName: to.Ptr("(UTC-07:00) Arizona"), - // TimeZoneID: to.Ptr("US Mountain Standard Time"), - // }, - // }, - // { - // Name: to.Ptr("UTC"), - // Type: to.Ptr("Microsoft.Sql/locations/timeZones"), - // ID: to.Ptr("/subscriptions/37d5e605-6142-4d79-b564-28b6dbfeec0f/providers/Microsoft.Sql/locations/onebox/timeZones/UTC"), - // Properties: &armsql.TimeZoneProperties{ - // DisplayName: to.Ptr("(UTC) Coordinated Universal Time"), - // TimeZoneID: to.Ptr("UTC"), - // }, - // }, - // { - // Name: to.Ptr("UTC+12"), - // Type: to.Ptr("Microsoft.Sql/locations/timeZones"), - // ID: to.Ptr("/subscriptions/37d5e605-6142-4d79-b564-28b6dbfeec0f/providers/Microsoft.Sql/locations/onebox/timeZones/UTC+12"), - // Properties: &armsql.TimeZoneProperties{ - // DisplayName: to.Ptr("(UTC+12:00) Coordinated Universal Time+12"), - // TimeZoneID: to.Ptr("UTC+12"), - // }, - // }, - // { - // Name: to.Ptr("UTC+13"), - // Type: to.Ptr("Microsoft.Sql/locations/timeZones"), - // ID: to.Ptr("/subscriptions/37d5e605-6142-4d79-b564-28b6dbfeec0f/providers/Microsoft.Sql/locations/onebox/timeZones/UTC+13"), - // Properties: &armsql.TimeZoneProperties{ - // DisplayName: to.Ptr("(UTC+13:00) Coordinated Universal Time+13"), - // TimeZoneID: to.Ptr("UTC+13"), - // }, - // }, - // { - // Name: to.Ptr("UTC-02"), - // Type: to.Ptr("Microsoft.Sql/locations/timeZones"), - // ID: to.Ptr("/subscriptions/37d5e605-6142-4d79-b564-28b6dbfeec0f/providers/Microsoft.Sql/locations/onebox/timeZones/UTC-02"), - // Properties: &armsql.TimeZoneProperties{ - // DisplayName: to.Ptr("(UTC-02:00) Coordinated Universal Time-02"), - // TimeZoneID: to.Ptr("UTC-02"), - // }, - // }, - // { - // Name: to.Ptr("UTC-08"), - // Type: to.Ptr("Microsoft.Sql/locations/timeZones"), - // ID: to.Ptr("/subscriptions/37d5e605-6142-4d79-b564-28b6dbfeec0f/providers/Microsoft.Sql/locations/onebox/timeZones/UTC-08"), - // Properties: &armsql.TimeZoneProperties{ - // DisplayName: to.Ptr("(UTC-08:00) Coordinated Universal Time-08"), - // TimeZoneID: to.Ptr("UTC-08"), - // }, - // }, - // { - // Name: to.Ptr("UTC-09"), - // Type: to.Ptr("Microsoft.Sql/locations/timeZones"), - // ID: to.Ptr("/subscriptions/37d5e605-6142-4d79-b564-28b6dbfeec0f/providers/Microsoft.Sql/locations/onebox/timeZones/UTC-09"), - // Properties: &armsql.TimeZoneProperties{ - // DisplayName: to.Ptr("(UTC-09:00) Coordinated Universal Time-09"), - // TimeZoneID: to.Ptr("UTC-09"), - // }, - // }, - // { - // Name: to.Ptr("UTC-11"), - // Type: to.Ptr("Microsoft.Sql/locations/timeZones"), - // ID: to.Ptr("/subscriptions/37d5e605-6142-4d79-b564-28b6dbfeec0f/providers/Microsoft.Sql/locations/onebox/timeZones/UTC-11"), - // Properties: &armsql.TimeZoneProperties{ - // DisplayName: to.Ptr("(UTC-11:00) Coordinated Universal Time-11"), - // TimeZoneID: to.Ptr("UTC-11"), - // }, - // }, - // { - // Name: to.Ptr("Venezuela Standard Time"), - // Type: to.Ptr("Microsoft.Sql/locations/timeZones"), - // ID: to.Ptr("/subscriptions/37d5e605-6142-4d79-b564-28b6dbfeec0f/providers/Microsoft.Sql/locations/onebox/timeZones/Venezuela Standard Time"), - // Properties: &armsql.TimeZoneProperties{ - // DisplayName: to.Ptr("(UTC-04:00) Caracas"), - // TimeZoneID: to.Ptr("Venezuela Standard Time"), - // }, - // }, - // { - // Name: to.Ptr("Vladivostok Standard Time"), - // Type: to.Ptr("Microsoft.Sql/locations/timeZones"), - // ID: to.Ptr("/subscriptions/37d5e605-6142-4d79-b564-28b6dbfeec0f/providers/Microsoft.Sql/locations/onebox/timeZones/Vladivostok Standard Time"), - // Properties: &armsql.TimeZoneProperties{ - // DisplayName: to.Ptr("(UTC+10:00) Vladivostok"), - // TimeZoneID: to.Ptr("Vladivostok Standard Time"), - // }, - // }, - // { - // Name: to.Ptr("Volgograd Standard Time"), - // Type: to.Ptr("Microsoft.Sql/locations/timeZones"), - // ID: to.Ptr("/subscriptions/37d5e605-6142-4d79-b564-28b6dbfeec0f/providers/Microsoft.Sql/locations/onebox/timeZones/Volgograd Standard Time"), - // Properties: &armsql.TimeZoneProperties{ - // DisplayName: to.Ptr("(UTC+04:00) Volgograd"), - // TimeZoneID: to.Ptr("Volgograd Standard Time"), - // }, - // }, - // { - // Name: to.Ptr("W. Australia Standard Time"), - // Type: to.Ptr("Microsoft.Sql/locations/timeZones"), - // ID: to.Ptr("/subscriptions/37d5e605-6142-4d79-b564-28b6dbfeec0f/providers/Microsoft.Sql/locations/onebox/timeZones/W. Australia Standard Time"), - // Properties: &armsql.TimeZoneProperties{ - // DisplayName: to.Ptr("(UTC+08:00) Perth"), - // TimeZoneID: to.Ptr("W. Australia Standard Time"), - // }, - // }, - // { - // Name: to.Ptr("W. Central Africa Standard Time"), - // Type: to.Ptr("Microsoft.Sql/locations/timeZones"), - // ID: to.Ptr("/subscriptions/37d5e605-6142-4d79-b564-28b6dbfeec0f/providers/Microsoft.Sql/locations/onebox/timeZones/W. Central Africa Standard Time"), - // Properties: &armsql.TimeZoneProperties{ - // DisplayName: to.Ptr("(UTC+01:00) West Central Africa"), - // TimeZoneID: to.Ptr("W. Central Africa Standard Time"), - // }, - // }, - // { - // Name: to.Ptr("W. Europe Standard Time"), - // Type: to.Ptr("Microsoft.Sql/locations/timeZones"), - // ID: to.Ptr("/subscriptions/37d5e605-6142-4d79-b564-28b6dbfeec0f/providers/Microsoft.Sql/locations/onebox/timeZones/W. Europe Standard Time"), - // Properties: &armsql.TimeZoneProperties{ - // DisplayName: to.Ptr("(UTC+01:00) Amsterdam, Berlin, Bern, Rome, Stockholm, Vienna"), - // TimeZoneID: to.Ptr("W. Europe Standard Time"), - // }, - // }, - // { - // Name: to.Ptr("W. Mongolia Standard Time"), - // Type: to.Ptr("Microsoft.Sql/locations/timeZones"), - // ID: to.Ptr("/subscriptions/37d5e605-6142-4d79-b564-28b6dbfeec0f/providers/Microsoft.Sql/locations/onebox/timeZones/W. Mongolia Standard Time"), - // Properties: &armsql.TimeZoneProperties{ - // DisplayName: to.Ptr("(UTC+07:00) Hovd"), - // TimeZoneID: to.Ptr("W. Mongolia Standard Time"), - // }, - // }, - // { - // Name: to.Ptr("West Asia Standard Time"), - // Type: to.Ptr("Microsoft.Sql/locations/timeZones"), - // ID: to.Ptr("/subscriptions/37d5e605-6142-4d79-b564-28b6dbfeec0f/providers/Microsoft.Sql/locations/onebox/timeZones/West Asia Standard Time"), - // Properties: &armsql.TimeZoneProperties{ - // DisplayName: to.Ptr("(UTC+05:00) Ashgabat, Tashkent"), - // TimeZoneID: to.Ptr("West Asia Standard Time"), - // }, - // }, - // { - // Name: to.Ptr("West Bank Standard Time"), - // Type: to.Ptr("Microsoft.Sql/locations/timeZones"), - // ID: to.Ptr("/subscriptions/37d5e605-6142-4d79-b564-28b6dbfeec0f/providers/Microsoft.Sql/locations/onebox/timeZones/West Bank Standard Time"), - // Properties: &armsql.TimeZoneProperties{ - // DisplayName: to.Ptr("(UTC+02:00) Gaza, Hebron"), - // TimeZoneID: to.Ptr("West Bank Standard Time"), - // }, - // }, - // { - // Name: to.Ptr("West Pacific Standard Time"), - // Type: to.Ptr("Microsoft.Sql/locations/timeZones"), - // ID: to.Ptr("/subscriptions/37d5e605-6142-4d79-b564-28b6dbfeec0f/providers/Microsoft.Sql/locations/onebox/timeZones/West Pacific Standard Time"), - // Properties: &armsql.TimeZoneProperties{ - // DisplayName: to.Ptr("(UTC+10:00) Guam, Port Moresby"), - // TimeZoneID: to.Ptr("West Pacific Standard Time"), - // }, - // }, - // { - // Name: to.Ptr("Yakutsk Standard Time"), - // Type: to.Ptr("Microsoft.Sql/locations/timeZones"), - // ID: to.Ptr("/subscriptions/37d5e605-6142-4d79-b564-28b6dbfeec0f/providers/Microsoft.Sql/locations/onebox/timeZones/Yakutsk Standard Time"), - // Properties: &armsql.TimeZoneProperties{ - // DisplayName: to.Ptr("(UTC+09:00) Yakutsk"), - // TimeZoneID: to.Ptr("Yakutsk Standard Time"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceTimeZoneGet.json -func ExampleTimeZonesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewTimeZonesClient().Get(ctx, "canadaeast", "Haiti Standard Time", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.TimeZone = armsql.TimeZone{ - // Name: to.Ptr("Haiti Standard Time"), - // Type: to.Ptr("Microsoft.Sql/locations/timeZones"), - // ID: to.Ptr("/subscriptions/37d5e605-6142-4d79-b564-28b6dbfeec0f/providers/Microsoft.Sql/locations/onebox/timeZones/Haiti Standard Time"), - // Properties: &armsql.TimeZoneProperties{ - // DisplayName: to.Ptr("(UTC-05:00) Haiti"), - // TimeZoneID: to.Ptr("Haiti Standard Time"), - // }, - // } -} diff --git a/sdk/resourcemanager/sql/armsql/transparentdataencryptions_client.go b/sdk/resourcemanager/sql/armsql/transparentdataencryptions_client.go index ec6c69a8a0f9..2c88378e862d 100644 --- a/sdk/resourcemanager/sql/armsql/transparentdataencryptions_client.go +++ b/sdk/resourcemanager/sql/armsql/transparentdataencryptions_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armsql @@ -44,35 +43,56 @@ func NewTransparentDataEncryptionsClient(subscriptionID string, credential azcor return client, nil } -// CreateOrUpdate - Updates a logical database's transparent data encryption configuration. +// BeginCreateOrUpdate - Updates a logical database's transparent data encryption configuration. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-02-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. // - databaseName - The name of the logical database for which the security alert policy is defined. // - tdeName - The name of the transparent data encryption configuration. // - parameters - The database transparent data encryption. -// - options - TransparentDataEncryptionsClientCreateOrUpdateOptions contains the optional parameters for the TransparentDataEncryptionsClient.CreateOrUpdate +// - options - TransparentDataEncryptionsClientBeginCreateOrUpdateOptions contains the optional parameters for the TransparentDataEncryptionsClient.BeginCreateOrUpdate // method. -func (client *TransparentDataEncryptionsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, databaseName string, tdeName TransparentDataEncryptionName, parameters LogicalDatabaseTransparentDataEncryption, options *TransparentDataEncryptionsClientCreateOrUpdateOptions) (TransparentDataEncryptionsClientCreateOrUpdateResponse, error) { +func (client *TransparentDataEncryptionsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, databaseName string, tdeName TransparentDataEncryptionName, parameters LogicalDatabaseTransparentDataEncryption, options *TransparentDataEncryptionsClientBeginCreateOrUpdateOptions) (*runtime.Poller[TransparentDataEncryptionsClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, serverName, databaseName, tdeName, parameters, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[TransparentDataEncryptionsClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[TransparentDataEncryptionsClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// CreateOrUpdate - Updates a logical database's transparent data encryption configuration. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-11-01-preview +func (client *TransparentDataEncryptionsClient) createOrUpdate(ctx context.Context, resourceGroupName string, serverName string, databaseName string, tdeName TransparentDataEncryptionName, parameters LogicalDatabaseTransparentDataEncryption, options *TransparentDataEncryptionsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, serverName, databaseName, tdeName, parameters, options) if err != nil { - return TransparentDataEncryptionsClientCreateOrUpdateResponse{}, err + return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { - return TransparentDataEncryptionsClientCreateOrUpdateResponse{}, err + return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { - return TransparentDataEncryptionsClientCreateOrUpdateResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return client.createOrUpdateHandleResponse(resp) + return httpResp, nil } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *TransparentDataEncryptionsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, serverName string, databaseName string, tdeName TransparentDataEncryptionName, parameters LogicalDatabaseTransparentDataEncryption, options *TransparentDataEncryptionsClientCreateOrUpdateOptions) (*policy.Request, error) { +func (client *TransparentDataEncryptionsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, serverName string, databaseName string, tdeName TransparentDataEncryptionName, parameters LogicalDatabaseTransparentDataEncryption, options *TransparentDataEncryptionsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/transparentDataEncryption/{tdeName}" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -99,25 +119,19 @@ func (client *TransparentDataEncryptionsClient) createOrUpdateCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-02-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) -} - -// createOrUpdateHandleResponse handles the CreateOrUpdate response. -func (client *TransparentDataEncryptionsClient) createOrUpdateHandleResponse(resp *http.Response) (TransparentDataEncryptionsClientCreateOrUpdateResponse, error) { - result := TransparentDataEncryptionsClientCreateOrUpdateResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.LogicalDatabaseTransparentDataEncryption); err != nil { - return TransparentDataEncryptionsClientCreateOrUpdateResponse{}, err + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err } - return result, nil + return req, nil } // Get - Gets a logical database's transparent data encryption. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-02-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -126,18 +140,21 @@ func (client *TransparentDataEncryptionsClient) createOrUpdateHandleResponse(res // - options - TransparentDataEncryptionsClientGetOptions contains the optional parameters for the TransparentDataEncryptionsClient.Get // method. func (client *TransparentDataEncryptionsClient) Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string, tdeName TransparentDataEncryptionName, options *TransparentDataEncryptionsClientGetOptions) (TransparentDataEncryptionsClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, serverName, databaseName, tdeName, options) if err != nil { return TransparentDataEncryptionsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return TransparentDataEncryptionsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return TransparentDataEncryptionsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return TransparentDataEncryptionsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -168,7 +185,7 @@ func (client *TransparentDataEncryptionsClient) getCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-02-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -185,7 +202,7 @@ func (client *TransparentDataEncryptionsClient) getHandleResponse(resp *http.Res // NewListByDatabasePager - Gets a list of the logical database's transparent data encryption. // -// Generated from API version 2021-02-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -244,7 +261,7 @@ func (client *TransparentDataEncryptionsClient) listByDatabaseCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-02-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/sql/armsql/transparentdataencryptions_client_example_test.go b/sdk/resourcemanager/sql/armsql/transparentdataencryptions_client_example_test.go deleted file mode 100644 index 30d0d0e4f410..000000000000 --- a/sdk/resourcemanager/sql/armsql/transparentdataencryptions_client_example_test.go +++ /dev/null @@ -1,115 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsql_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sql/armsql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/TransparentDataEncryptionGet.json -func ExampleTransparentDataEncryptionsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewTransparentDataEncryptionsClient().Get(ctx, "security-tde-resourcegroup", "securitytde", "testdb", armsql.TransparentDataEncryptionNameCurrent, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.LogicalDatabaseTransparentDataEncryption = armsql.LogicalDatabaseTransparentDataEncryption{ - // Name: to.Ptr("current"), - // Type: to.Ptr("Microsoft.Sql/servers/databases/transparentDataEncryption"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/security-tde-resourcegroup/providers/Microsoft.Sql/servers/securitytde/databases/testdb"), - // Properties: &armsql.TransparentDataEncryptionProperties{ - // State: to.Ptr(armsql.TransparentDataEncryptionStateEnabled), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/TransparentDataEncryptionUpdate.json -func ExampleTransparentDataEncryptionsClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewTransparentDataEncryptionsClient().CreateOrUpdate(ctx, "securitytde-42-rg", "securitytde-42", "testdb", armsql.TransparentDataEncryptionNameCurrent, armsql.LogicalDatabaseTransparentDataEncryption{ - Properties: &armsql.TransparentDataEncryptionProperties{ - State: to.Ptr(armsql.TransparentDataEncryptionStateEnabled), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.LogicalDatabaseTransparentDataEncryption = armsql.LogicalDatabaseTransparentDataEncryption{ - // Name: to.Ptr("current"), - // Type: to.Ptr("Microsoft.Sql/servers/databases/transparentDataEncryption"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/securitytde-42-rg/providers/Microsoft.Sql/servers/securitytde-42/databases/testdb/transparentDataEncryption"), - // Properties: &armsql.TransparentDataEncryptionProperties{ - // State: to.Ptr(armsql.TransparentDataEncryptionStateEnabled), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/TransparentDataEncryptionList.json -func ExampleTransparentDataEncryptionsClient_NewListByDatabasePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewTransparentDataEncryptionsClient().NewListByDatabasePager("security-tde-resourcegroup", "securitytde", "testdb", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.LogicalDatabaseTransparentDataEncryptionListResult = armsql.LogicalDatabaseTransparentDataEncryptionListResult{ - // Value: []*armsql.LogicalDatabaseTransparentDataEncryption{ - // { - // Name: to.Ptr("current"), - // Type: to.Ptr("Microsoft.Sql/servers/databases/transparentDataEncryption"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/security-tde-resourcegroup/providers/Microsoft.Sql/servers/securitytde/databases/testdb"), - // Properties: &armsql.TransparentDataEncryptionProperties{ - // State: to.Ptr(armsql.TransparentDataEncryptionStateEnabled), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/sql/armsql/usages_client.go b/sdk/resourcemanager/sql/armsql/usages_client.go index d21892171248..9e54d2938400 100644 --- a/sdk/resourcemanager/sql/armsql/usages_client.go +++ b/sdk/resourcemanager/sql/armsql/usages_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armsql @@ -47,7 +46,7 @@ func NewUsagesClient(subscriptionID string, credential azcore.TokenCredential, o // NewListByInstancePoolPager - Gets all instance pool usage metrics // -// Generated from API version 2021-02-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - instancePoolName - The name of the instance pool to be retrieved. @@ -104,7 +103,7 @@ func (client *UsagesClient) listByInstancePoolCreateRequest(ctx context.Context, if options != nil && options.ExpandChildren != nil { reqQP.Set("expandChildren", strconv.FormatBool(*options.ExpandChildren)) } - reqQP.Set("api-version", "2021-02-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/sql/armsql/usages_client_example_test.go b/sdk/resourcemanager/sql/armsql/usages_client_example_test.go deleted file mode 100644 index 09525ae64eb8..000000000000 --- a/sdk/resourcemanager/sql/armsql/usages_client_example_test.go +++ /dev/null @@ -1,207 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsql_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sql/armsql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/ListInstancePoolUsageExpanded.json -func ExampleUsagesClient_NewListByInstancePoolPager_listInstancePoolUsagesExpandedWithChildren() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewUsagesClient().NewListByInstancePoolPager("group1", "testIP", &armsql.UsagesClientListByInstancePoolOptions{ExpandChildren: to.Ptr(true)}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.UsageListResult = armsql.UsageListResult{ - // Value: []*armsql.Usage{ - // { - // Name: &armsql.Name{ - // LocalizedValue: to.Ptr("VCore utilization"), - // Value: to.Ptr("VCore utilization"), - // }, - // Type: to.Ptr("Microsoft.Sql/instancePools/usages"), - // CurrentValue: to.Ptr[int32](12), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/instancePools/testIP/usages/vcore_utilization"), - // Limit: to.Ptr[int32](16), - // RequestedLimit: to.Ptr[int32](40), - // Unit: to.Ptr("VCores"), - // }, - // { - // Name: &armsql.Name{ - // LocalizedValue: to.Ptr("Storage utilization"), - // Value: to.Ptr("Storage utilization"), - // }, - // Type: to.Ptr("Microsoft.Sql/instancePools/usages"), - // CurrentValue: to.Ptr[int32](384), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/instancePools/testIP/usages/storage_utilization"), - // Limit: to.Ptr[int32](8196), - // Unit: to.Ptr("VCores"), - // }, - // { - // Name: &armsql.Name{ - // LocalizedValue: to.Ptr("Database utilization"), - // Value: to.Ptr("Database utilization"), - // }, - // Type: to.Ptr("Microsoft.Sql/instancePools/usages"), - // CurrentValue: to.Ptr[int32](5), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/instancePools/testIP/usages/database_utilization"), - // Limit: to.Ptr[int32](100), - // Unit: to.Ptr("Number Of Databases"), - // }, - // { - // Name: &armsql.Name{ - // LocalizedValue: to.Ptr("VCore utilization"), - // Value: to.Ptr("VCore utilization"), - // }, - // Type: to.Ptr("Microsoft.Sql/instancePools/managedInstances/usages"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/instancePools/testIP/managedInstances/managedInstance1/usages/vcore_utilization"), - // Limit: to.Ptr[int32](4), - // Unit: to.Ptr("VCores"), - // }, - // { - // Name: &armsql.Name{ - // LocalizedValue: to.Ptr("VCore utilization"), - // Value: to.Ptr("VCore utilization"), - // }, - // Type: to.Ptr("Microsoft.Sql/instancePools/managedInstances/usages"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/instancePools/testIP/managedInstances/managedInstance2/usages/vcore_utilization"), - // Limit: to.Ptr[int32](4), - // RequestedLimit: to.Ptr[int32](8), - // Unit: to.Ptr("VCores"), - // }, - // { - // Name: &armsql.Name{ - // LocalizedValue: to.Ptr("Storage utilization"), - // Value: to.Ptr("Storage utilization"), - // }, - // Type: to.Ptr("Microsoft.Sql/instancePools/managedInstances/usages"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/instancePools/testIP/managedInstances/managedInstance1/usages/storage_utilization"), - // Limit: to.Ptr[int32](128), - // Unit: to.Ptr("Gigabytes"), - // }, - // { - // Name: &armsql.Name{ - // LocalizedValue: to.Ptr("VCore utilization"), - // Value: to.Ptr("VCore utilization"), - // }, - // Type: to.Ptr("Microsoft.Sql/instancePools/managedInstances/usages"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/instancePools/testIP/managedInstances/managedInstance2/usages/storage_utilization"), - // Limit: to.Ptr[int32](128), - // RequestedLimit: to.Ptr[int32](256), - // Unit: to.Ptr("Gigabytes"), - // }, - // { - // Name: &armsql.Name{ - // LocalizedValue: to.Ptr("Database utilization"), - // Value: to.Ptr("Database utilization"), - // }, - // Type: to.Ptr("Microsoft.Sql/instancePools/managedInstances/usages"), - // CurrentValue: to.Ptr[int32](2), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/instancePools/testIP/managedInstances/managedInstance1/usages/database_utilization"), - // Limit: to.Ptr[int32](100), - // Unit: to.Ptr("Number Of Databases"), - // }, - // { - // Name: &armsql.Name{ - // LocalizedValue: to.Ptr("Database utilization"), - // Value: to.Ptr("Database utilization"), - // }, - // Type: to.Ptr("Microsoft.Sql/instancePools/managedInstances/usages"), - // CurrentValue: to.Ptr[int32](3), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/instancePools/testIP/managedInstances/managedInstance2/usages/database_utilization"), - // Limit: to.Ptr[int32](100), - // Unit: to.Ptr("Number Of Databases"), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/ListInstancePoolUsage.json -func ExampleUsagesClient_NewListByInstancePoolPager_listInstancePoolUsages() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewUsagesClient().NewListByInstancePoolPager("group1", "testIP", &armsql.UsagesClientListByInstancePoolOptions{ExpandChildren: nil}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.UsageListResult = armsql.UsageListResult{ - // Value: []*armsql.Usage{ - // { - // Name: &armsql.Name{ - // LocalizedValue: to.Ptr("VCore utilization"), - // Value: to.Ptr("VCore utilization"), - // }, - // Type: to.Ptr("Microsoft.Sql/instancePools/usages"), - // CurrentValue: to.Ptr[int32](12), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/instancePools/testIP/usages/vcore_utilization"), - // Limit: to.Ptr[int32](16), - // RequestedLimit: to.Ptr[int32](40), - // Unit: to.Ptr("VCores"), - // }, - // { - // Name: &armsql.Name{ - // LocalizedValue: to.Ptr("Storage utilization"), - // Value: to.Ptr("Storage utilization"), - // }, - // Type: to.Ptr("Microsoft.Sql/instancePools/usages"), - // CurrentValue: to.Ptr[int32](384), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/instancePools/testIP/usages/storage_utilization"), - // Limit: to.Ptr[int32](8196), - // Unit: to.Ptr("VCores"), - // }, - // { - // Name: &armsql.Name{ - // LocalizedValue: to.Ptr("Database utilization"), - // Value: to.Ptr("Database utilization"), - // }, - // Type: to.Ptr("Microsoft.Sql/instancePools/usages"), - // CurrentValue: to.Ptr[int32](5), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/instancePools/testIP/usages/database_utilization"), - // Limit: to.Ptr[int32](100), - // Unit: to.Ptr("Number Of Databases"), - // }}, - // } - } -} diff --git a/sdk/resourcemanager/sql/armsql/virtualclusters_client.go b/sdk/resourcemanager/sql/armsql/virtualclusters_client.go index 15a736d32e53..e86628935d32 100644 --- a/sdk/resourcemanager/sql/armsql/virtualclusters_client.go +++ b/sdk/resourcemanager/sql/armsql/virtualclusters_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armsql @@ -47,7 +46,7 @@ func NewVirtualClustersClient(subscriptionID string, credential azcore.TokenCred // BeginDelete - Deletes a virtual cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - virtualClusterName - The name of the virtual cluster. @@ -59,7 +58,8 @@ func (client *VirtualClustersClient) BeginDelete(ctx context.Context, resourceGr if err != nil { return nil, err } - return runtime.NewPoller[VirtualClustersClientDeleteResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[VirtualClustersClientDeleteResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[VirtualClustersClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -68,20 +68,22 @@ func (client *VirtualClustersClient) BeginDelete(ctx context.Context, resourceGr // Delete - Deletes a virtual cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview func (client *VirtualClustersClient) deleteOperation(ctx context.Context, resourceGroupName string, virtualClusterName string, options *VirtualClustersClientBeginDeleteOptions) (*http.Response, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, virtualClusterName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteCreateRequest creates the Delete request. @@ -104,7 +106,7 @@ func (client *VirtualClustersClient) deleteCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -112,24 +114,27 @@ func (client *VirtualClustersClient) deleteCreateRequest(ctx context.Context, re // Get - Gets a virtual cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - virtualClusterName - The name of the virtual cluster. // - options - VirtualClustersClientGetOptions contains the optional parameters for the VirtualClustersClient.Get method. func (client *VirtualClustersClient) Get(ctx context.Context, resourceGroupName string, virtualClusterName string, options *VirtualClustersClientGetOptions) (VirtualClustersClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, virtualClusterName, options) if err != nil { return VirtualClustersClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return VirtualClustersClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return VirtualClustersClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return VirtualClustersClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -152,7 +157,7 @@ func (client *VirtualClustersClient) getCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -169,7 +174,7 @@ func (client *VirtualClustersClient) getHandleResponse(resp *http.Response) (Vir // NewListPager - Gets a list of all virtualClusters in the subscription. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - options - VirtualClustersClientListOptions contains the optional parameters for the VirtualClustersClient.NewListPager // method. func (client *VirtualClustersClient) NewListPager(options *VirtualClustersClientListOptions) *runtime.Pager[VirtualClustersClientListResponse] { @@ -212,7 +217,7 @@ func (client *VirtualClustersClient) listCreateRequest(ctx context.Context, opti return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -229,7 +234,7 @@ func (client *VirtualClustersClient) listHandleResponse(resp *http.Response) (Vi // NewListByResourceGroupPager - Gets a list of virtual clusters in a resource group. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - options - VirtualClustersClientListByResourceGroupOptions contains the optional parameters for the VirtualClustersClient.NewListByResourceGroupPager @@ -278,7 +283,7 @@ func (client *VirtualClustersClient) listByResourceGroupCreateRequest(ctx contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -293,10 +298,10 @@ func (client *VirtualClustersClient) listByResourceGroupHandleResponse(resp *htt return result, nil } -// BeginUpdate - Updates a virtual cluster. +// BeginUpdate - Updates an existing virtual cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - virtualClusterName - The name of the virtual cluster. @@ -309,29 +314,32 @@ func (client *VirtualClustersClient) BeginUpdate(ctx context.Context, resourceGr if err != nil { return nil, err } - return runtime.NewPoller[VirtualClustersClientUpdateResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[VirtualClustersClientUpdateResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[VirtualClustersClientUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } } -// Update - Updates a virtual cluster. +// Update - Updates an existing virtual cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview func (client *VirtualClustersClient) update(ctx context.Context, resourceGroupName string, virtualClusterName string, parameters VirtualClusterUpdate, options *VirtualClustersClientBeginUpdateOptions) (*http.Response, error) { + var err error req, err := client.updateCreateRequest(ctx, resourceGroupName, virtualClusterName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // updateCreateRequest creates the Update request. @@ -354,38 +362,60 @@ func (client *VirtualClustersClient) updateCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } -// UpdateDNSServers - Synchronizes the DNS server settings used by the managed instances inside the given virtual cluster. +// BeginUpdateDNSServers - Synchronizes the DNS server settings used by the managed instances inside the given virtual cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - virtualClusterName - The name of the virtual cluster. -// - options - VirtualClustersClientUpdateDNSServersOptions contains the optional parameters for the VirtualClustersClient.UpdateDNSServers +// - options - VirtualClustersClientBeginUpdateDNSServersOptions contains the optional parameters for the VirtualClustersClient.BeginUpdateDNSServers // method. -func (client *VirtualClustersClient) UpdateDNSServers(ctx context.Context, resourceGroupName string, virtualClusterName string, options *VirtualClustersClientUpdateDNSServersOptions) (VirtualClustersClientUpdateDNSServersResponse, error) { +func (client *VirtualClustersClient) BeginUpdateDNSServers(ctx context.Context, resourceGroupName string, virtualClusterName string, options *VirtualClustersClientBeginUpdateDNSServersOptions) (*runtime.Poller[VirtualClustersClientUpdateDNSServersResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.updateDNSServers(ctx, resourceGroupName, virtualClusterName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller[VirtualClustersClientUpdateDNSServersResponse](resp, client.internal.Pipeline(), nil) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[VirtualClustersClientUpdateDNSServersResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// UpdateDNSServers - Synchronizes the DNS server settings used by the managed instances inside the given virtual cluster. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-11-01-preview +func (client *VirtualClustersClient) updateDNSServers(ctx context.Context, resourceGroupName string, virtualClusterName string, options *VirtualClustersClientBeginUpdateDNSServersOptions) (*http.Response, error) { + var err error req, err := client.updateDNSServersCreateRequest(ctx, resourceGroupName, virtualClusterName, options) if err != nil { - return VirtualClustersClientUpdateDNSServersResponse{}, err + return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { - return VirtualClustersClientUpdateDNSServersResponse{}, err + return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return VirtualClustersClientUpdateDNSServersResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return client.updateDNSServersHandleResponse(resp) + return httpResp, nil } // updateDNSServersCreateRequest creates the UpdateDNSServers request. -func (client *VirtualClustersClient) updateDNSServersCreateRequest(ctx context.Context, resourceGroupName string, virtualClusterName string, options *VirtualClustersClientUpdateDNSServersOptions) (*policy.Request, error) { +func (client *VirtualClustersClient) updateDNSServersCreateRequest(ctx context.Context, resourceGroupName string, virtualClusterName string, options *VirtualClustersClientBeginUpdateDNSServersOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/virtualClusters/{virtualClusterName}/updateManagedInstanceDnsServers" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -404,17 +434,8 @@ func (client *VirtualClustersClient) updateDNSServersCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } - -// updateDNSServersHandleResponse handles the UpdateDNSServers response. -func (client *VirtualClustersClient) updateDNSServersHandleResponse(resp *http.Response) (VirtualClustersClientUpdateDNSServersResponse, error) { - result := VirtualClustersClientUpdateDNSServersResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.UpdateManagedInstanceDNSServersOperation); err != nil { - return VirtualClustersClientUpdateDNSServersResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/sql/armsql/virtualclusters_client_example_test.go b/sdk/resourcemanager/sql/armsql/virtualclusters_client_example_test.go deleted file mode 100644 index d705f6c41faf..000000000000 --- a/sdk/resourcemanager/sql/armsql/virtualclusters_client_example_test.go +++ /dev/null @@ -1,253 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsql_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sql/armsql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/UpdateManagedInstanceDnsServers.json -func ExampleVirtualClustersClient_UpdateDNSServers() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualClustersClient().UpdateDNSServers(ctx, "sqlcrudtest-7398", "sqlcrudtest-4645", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.UpdateManagedInstanceDNSServersOperation = armsql.UpdateManagedInstanceDNSServersOperation{ - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/test-rg/providers/Microsoft.Sql/virtualClusters/test-virtualcluster/updateManagedInstanceDnsServers"), - // Properties: &armsql.DNSRefreshConfigurationProperties{ - // Status: to.Ptr(armsql.DNSRefreshConfigurationPropertiesStatusSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/VirtualClusterList.json -func ExampleVirtualClustersClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVirtualClustersClient().NewListPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.VirtualClusterListResult = armsql.VirtualClusterListResult{ - // Value: []*armsql.VirtualCluster{ - // { - // Name: to.Ptr("vc-subnet1-f769ed71-b3ad-491a-a9d5-26eeceaa6be2"), - // Type: to.Ptr("Microsoft.Sql/virtualClusters"), - // ID: to.Ptr("/subscriptions/20d7082a-0fc7-4468-82bd-542694d5042b/resourceGroups/testrg/providers/Microsoft.Sql/virtualClusters/vc-subnet1-f769ed71-b3ad-491a-a9d5-26eeceaa6be2"), - // Location: to.Ptr("onebox"), - // Properties: &armsql.VirtualClusterProperties{ - // ChildResources: []*string{ - // to.Ptr("/subscriptions/20D7082A-0FC7-4468-82BD-542694D5042B/resourceGroups/testrg/providers/Microsoft.Sql/managedInstances/testinstance1"), - // to.Ptr("/subscriptions/20D7082A-0FC7-4468-82BD-542694D5042B/resourceGroups/testrg/providers/Microsoft.Sql/managedInstances/testinstance2")}, - // Family: to.Ptr("Gen4"), - // MaintenanceConfigurationID: to.Ptr("/subscriptions/ab0e51c0-83c0-4380-8ae9-025516df392f/resourceGroups/Federation/providers/Microsoft.Maintenance/maintenanceConfigurations/MiPolicy1"), - // SubnetID: to.Ptr("/subscriptions/20D7082A-0FC7-4468-82BD-542694D5042B/resourceGroups/testrg/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1"), - // }, - // }, - // { - // Name: to.Ptr("vc-subnet1-14b795bd-9c8f-46ec-adb8-2b8eff56ac16"), - // Type: to.Ptr("Microsoft.Sql/virtualClusters"), - // ID: to.Ptr("/subscriptions/20d7082a-0fc7-4468-82bd-542694d5042b/resourceGroups/testrg/providers/Microsoft.Sql/virtualClusters/vc-subnet2-14b795bd-9c8f-46ec-adb8-2b8eff56ac16"), - // Location: to.Ptr("onebox"), - // Properties: &armsql.VirtualClusterProperties{ - // ChildResources: []*string{ - // to.Ptr("/subscriptions/20D7082A-0FC7-4468-82BD-542694D5042B/resourceGroups/testrg/providers/Microsoft.Sql/managedInstances/testinstance3"), - // to.Ptr("/subscriptions/20D7082A-0FC7-4468-82BD-542694D5042B/resourceGroups/testrg/providers/Microsoft.Sql/managedInstances/testinstance4")}, - // Family: to.Ptr("Gen5"), - // MaintenanceConfigurationID: to.Ptr("/subscriptions/ab0e51c0-83c0-4380-8ae9-025516df392f/resourceGroups/Federation/providers/Microsoft.Maintenance/maintenanceConfigurations/MiPolicy1"), - // SubnetID: to.Ptr("/subscriptions/20D7082A-0FC7-4468-82BD-542694D5042B/resourceGroups/testrg/providers/Microsoft.Network/virtualNetworks/vnet2/subnets/subnet2"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/VirtualClusterListByResourceGroup.json -func ExampleVirtualClustersClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVirtualClustersClient().NewListByResourceGroupPager("testrg", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.VirtualClusterListResult = armsql.VirtualClusterListResult{ - // Value: []*armsql.VirtualCluster{ - // { - // Name: to.Ptr("vc-subnet1-f769ed71-b3ad-491a-a9d5-26eeceaa6be2"), - // Type: to.Ptr("Microsoft.Sql/virtualClusters"), - // ID: to.Ptr("/subscriptions/20d7082a-0fc7-4468-82bd-542694d5042b/resourceGroups/testrg/providers/Microsoft.Sql/virtualClusters/vc-subnet1-f769ed71-b3ad-491a-a9d5-26eeceaa6be2"), - // Location: to.Ptr("onebox"), - // Properties: &armsql.VirtualClusterProperties{ - // ChildResources: []*string{ - // to.Ptr("/subscriptions/20D7082A-0FC7-4468-82BD-542694D5042B/resourceGroups/testrg/providers/Microsoft.Sql/managedInstances/testinstance1"), - // to.Ptr("/subscriptions/20D7082A-0FC7-4468-82BD-542694D5042B/resourceGroups/testrg/providers/Microsoft.Sql/managedInstances/testinstance2")}, - // Family: to.Ptr("Gen4"), - // MaintenanceConfigurationID: to.Ptr("/subscriptions/ab0e51c0-83c0-4380-8ae9-025516df392f/resourceGroups/Federation/providers/Microsoft.Maintenance/maintenanceConfigurations/MiPolicy1"), - // SubnetID: to.Ptr("/subscriptions/20D7082A-0FC7-4468-82BD-542694D5042B/resourceGroups/testrg/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1"), - // }, - // }, - // { - // Name: to.Ptr("vc-subnet1-14b795bd-9c8f-46ec-adb8-2b8eff56ac16"), - // Type: to.Ptr("Microsoft.Sql/virtualClusters"), - // ID: to.Ptr("/subscriptions/20d7082a-0fc7-4468-82bd-542694d5042b/resourceGroups/testrg/providers/Microsoft.Sql/virtualClusters/vc-subnet2-14b795bd-9c8f-46ec-adb8-2b8eff56ac16"), - // Location: to.Ptr("onebox"), - // Properties: &armsql.VirtualClusterProperties{ - // ChildResources: []*string{ - // to.Ptr("/subscriptions/20D7082A-0FC7-4468-82BD-542694D5042B/resourceGroups/testrg/providers/Microsoft.Sql/managedInstances/testinstance3"), - // to.Ptr("/subscriptions/20D7082A-0FC7-4468-82BD-542694D5042B/resourceGroups/testrg/providers/Microsoft.Sql/managedInstances/testinstance4")}, - // Family: to.Ptr("Gen4"), - // MaintenanceConfigurationID: to.Ptr("/subscriptions/ab0e51c0-83c0-4380-8ae9-025516df392f/resourceGroups/Federation/providers/Microsoft.Maintenance/maintenanceConfigurations/MiPolicy1"), - // SubnetID: to.Ptr("/subscriptions/20D7082A-0FC7-4468-82BD-542694D5042B/resourceGroups/testrg/providers/Microsoft.Network/virtualNetworks/vnet2/subnets/subnet2"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/VirtualClusterGet.json -func ExampleVirtualClustersClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualClustersClient().Get(ctx, "testrg", "vc-subnet1-f769ed71-b3ad-491a-a9d5-26eeceaa6be2", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualCluster = armsql.VirtualCluster{ - // Name: to.Ptr("vc-subnet1-f769ed71-b3ad-491a-a9d5-26eeceaa6be2"), - // Type: to.Ptr("Microsoft.Sql/virtualClusters"), - // ID: to.Ptr("/subscriptions/20d7082a-0fc7-4468-82bd-542694d5042b/resourceGroups/testrg/providers/Microsoft.Sql/virtualClusters/vc-subnet1-f769ed71-b3ad-491a-a9d5-26eeceaa6be2"), - // Location: to.Ptr("onebox"), - // Properties: &armsql.VirtualClusterProperties{ - // ChildResources: []*string{ - // to.Ptr("/subscriptions/20D7082A-0FC7-4468-82BD-542694D5042B/resourceGroups/testrg/providers/Microsoft.Sql/managedInstances/testinstance1"), - // to.Ptr("/subscriptions/20D7082A-0FC7-4468-82BD-542694D5042B/resourceGroups/testrg/providers/Microsoft.Sql/managedInstances/testinstance2")}, - // Family: to.Ptr("Gen4"), - // MaintenanceConfigurationID: to.Ptr("/subscriptions/ab0e51c0-83c0-4380-8ae9-025516df392f/resourceGroups/Federation/providers/Microsoft.Maintenance/maintenanceConfigurations/MiPolicy1"), - // SubnetID: to.Ptr("/subscriptions/20D7082A-0FC7-4468-82BD-542694D5042B/resourceGroups/testrg/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/VirtualClusterDelete.json -func ExampleVirtualClustersClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualClustersClient().BeginDelete(ctx, "testrg", "vc-subnet1-f769ed71-b3ad-491a-a9d5-26eeceaa6be2", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/VirtualClusterUpdate.json -func ExampleVirtualClustersClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualClustersClient().BeginUpdate(ctx, "testrg", "vc-subnet1-f769ed71-b3ad-491a-a9d5-26eeceaa6be2", armsql.VirtualClusterUpdate{ - Properties: &armsql.VirtualClusterProperties{ - MaintenanceConfigurationID: to.Ptr("/subscriptions/ab0e51c0-83c0-4380-8ae9-025516df392f/resourceGroups/Federation/providers/Microsoft.Maintenance/maintenanceConfigurations/MiPolicy1"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualCluster = armsql.VirtualCluster{ - // Name: to.Ptr("vc-subnet1-f769ed71-b3ad-491a-a9d5-26eeceaa6be2"), - // Type: to.Ptr("Microsoft.Sql/virtualClusters"), - // ID: to.Ptr("/subscriptions/20d7082a-0fc7-4468-82bd-542694d5042b/resourceGroups/testrg/providers/Microsoft.Sql/virtualClusters/vc-subnet1-f769ed71-b3ad-491a-a9d5-26eeceaa6be2"), - // Location: to.Ptr("onebox"), - // Properties: &armsql.VirtualClusterProperties{ - // ChildResources: []*string{ - // to.Ptr("/subscriptions/20D7082A-0FC7-4468-82BD-542694D5042B/resourceGroups/testrg/providers/Microsoft.Sql/managedInstances/testinstance1"), - // to.Ptr("/subscriptions/20D7082A-0FC7-4468-82BD-542694D5042B/resourceGroups/testrg/providers/Microsoft.Sql/managedInstances/testinstance2")}, - // MaintenanceConfigurationID: to.Ptr("/subscriptions/ab0e51c0-83c0-4380-8ae9-025516df392f/resourceGroups/Federation/providers/Microsoft.Maintenance/maintenanceConfigurations/MiPolicy1"), - // SubnetID: to.Ptr("/subscriptions/20D7082A-0FC7-4468-82BD-542694D5042B/resourceGroups/testrg/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1"), - // }, - // } -} diff --git a/sdk/resourcemanager/sql/armsql/virtualnetworkrules_client.go b/sdk/resourcemanager/sql/armsql/virtualnetworkrules_client.go index a7844877f6cd..1420cb7c76e4 100644 --- a/sdk/resourcemanager/sql/armsql/virtualnetworkrules_client.go +++ b/sdk/resourcemanager/sql/armsql/virtualnetworkrules_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armsql @@ -47,7 +46,7 @@ func NewVirtualNetworkRulesClient(subscriptionID string, credential azcore.Token // BeginCreateOrUpdate - Creates or updates an existing virtual network rule. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -61,7 +60,8 @@ func (client *VirtualNetworkRulesClient) BeginCreateOrUpdate(ctx context.Context if err != nil { return nil, err } - return runtime.NewPoller[VirtualNetworkRulesClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[VirtualNetworkRulesClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[VirtualNetworkRulesClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -70,20 +70,22 @@ func (client *VirtualNetworkRulesClient) BeginCreateOrUpdate(ctx context.Context // CreateOrUpdate - Creates or updates an existing virtual network rule. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview func (client *VirtualNetworkRulesClient) createOrUpdate(ctx context.Context, resourceGroupName string, serverName string, virtualNetworkRuleName string, parameters VirtualNetworkRule, options *VirtualNetworkRulesClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, serverName, virtualNetworkRuleName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createOrUpdateCreateRequest creates the CreateOrUpdate request. @@ -110,16 +112,19 @@ func (client *VirtualNetworkRulesClient) createOrUpdateCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // BeginDelete - Deletes the virtual network rule with the given name. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -132,7 +137,8 @@ func (client *VirtualNetworkRulesClient) BeginDelete(ctx context.Context, resour if err != nil { return nil, err } - return runtime.NewPoller[VirtualNetworkRulesClientDeleteResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[VirtualNetworkRulesClientDeleteResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[VirtualNetworkRulesClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -141,20 +147,22 @@ func (client *VirtualNetworkRulesClient) BeginDelete(ctx context.Context, resour // Delete - Deletes the virtual network rule with the given name. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview func (client *VirtualNetworkRulesClient) deleteOperation(ctx context.Context, resourceGroupName string, serverName string, virtualNetworkRuleName string, options *VirtualNetworkRulesClientBeginDeleteOptions) (*http.Response, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, serverName, virtualNetworkRuleName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteCreateRequest creates the Delete request. @@ -181,7 +189,7 @@ func (client *VirtualNetworkRulesClient) deleteCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -189,25 +197,28 @@ func (client *VirtualNetworkRulesClient) deleteCreateRequest(ctx context.Context // Get - Gets a virtual network rule. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. // - virtualNetworkRuleName - The name of the virtual network rule. // - options - VirtualNetworkRulesClientGetOptions contains the optional parameters for the VirtualNetworkRulesClient.Get method. func (client *VirtualNetworkRulesClient) Get(ctx context.Context, resourceGroupName string, serverName string, virtualNetworkRuleName string, options *VirtualNetworkRulesClientGetOptions) (VirtualNetworkRulesClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, serverName, virtualNetworkRuleName, options) if err != nil { return VirtualNetworkRulesClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return VirtualNetworkRulesClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return VirtualNetworkRulesClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return VirtualNetworkRulesClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -234,7 +245,7 @@ func (client *VirtualNetworkRulesClient) getCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -251,7 +262,7 @@ func (client *VirtualNetworkRulesClient) getHandleResponse(resp *http.Response) // NewListByServerPager - Gets a list of virtual network rules in a server. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -305,7 +316,7 @@ func (client *VirtualNetworkRulesClient) listByServerCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/sql/armsql/virtualnetworkrules_client_example_test.go b/sdk/resourcemanager/sql/armsql/virtualnetworkrules_client_example_test.go deleted file mode 100644 index 907e03da6805..000000000000 --- a/sdk/resourcemanager/sql/armsql/virtualnetworkrules_client_example_test.go +++ /dev/null @@ -1,156 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsql_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sql/armsql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/VirtualNetworkRulesGet.json -func ExampleVirtualNetworkRulesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualNetworkRulesClient().Get(ctx, "Default", "vnet-test-svr", "vnet-firewall-rule", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualNetworkRule = armsql.VirtualNetworkRule{ - // Name: to.Ptr("vnet-firewall-rule"), - // Type: to.Ptr("Microsoft.Sql/servers/virtualNetworkRules"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/servers/vnet-test-svr/virtualNetworkRules/vnet-firewall-rule"), - // Properties: &armsql.VirtualNetworkRuleProperties{ - // IgnoreMissingVnetServiceEndpoint: to.Ptr(false), - // State: to.Ptr(armsql.VirtualNetworkRuleStateReady), - // VirtualNetworkSubnetID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Network/virtualNetworks/testvnet/subnets/testsubnet"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/VirtualNetworkRulesCreateOrUpdate.json -func ExampleVirtualNetworkRulesClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualNetworkRulesClient().BeginCreateOrUpdate(ctx, "Default", "vnet-test-svr", "vnet-firewall-rule", armsql.VirtualNetworkRule{ - Properties: &armsql.VirtualNetworkRuleProperties{ - IgnoreMissingVnetServiceEndpoint: to.Ptr(false), - VirtualNetworkSubnetID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Network/virtualNetworks/testvnet/subnets/testsubnet"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualNetworkRule = armsql.VirtualNetworkRule{ - // Name: to.Ptr("vnet-firewall-rule"), - // Type: to.Ptr("Microsoft.Sql/servers/virtualNetworkRules"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/servers/vnet-test-svr/virtualNetworkRules/vnet-firewall-rule"), - // Properties: &armsql.VirtualNetworkRuleProperties{ - // IgnoreMissingVnetServiceEndpoint: to.Ptr(false), - // VirtualNetworkSubnetID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Network/virtualNetworks/testvnet/subnets/testsubnet"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/VirtualNetworkRulesDelete.json -func ExampleVirtualNetworkRulesClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualNetworkRulesClient().BeginDelete(ctx, "Default", "vnet-test-svr", "vnet-firewall-rule", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/VirtualNetworkRulesList.json -func ExampleVirtualNetworkRulesClient_NewListByServerPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVirtualNetworkRulesClient().NewListByServerPager("Default", "vnet-test-svr", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.VirtualNetworkRuleListResult = armsql.VirtualNetworkRuleListResult{ - // Value: []*armsql.VirtualNetworkRule{ - // { - // Name: to.Ptr("vnet-firewall-rule"), - // Type: to.Ptr("Microsoft.Sql/servers/virtualNetworkRules"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/servers/vnet-test-svr/virtualNetworkRules/vnet-firewall-rule"), - // Properties: &armsql.VirtualNetworkRuleProperties{ - // IgnoreMissingVnetServiceEndpoint: to.Ptr(false), - // State: to.Ptr(armsql.VirtualNetworkRuleStateReady), - // VirtualNetworkSubnetID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Network/virtualNetworks/testvnet/subnets/testsubnet"), - // }, - // }, - // { - // Name: to.Ptr("vnet-firewall-rule"), - // Type: to.Ptr("Microsoft.Sql/servers/virtualNetworkRules"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/servers/vnet-test-svr/virtualNetworkRules/vnet-firewall-rule"), - // Properties: &armsql.VirtualNetworkRuleProperties{ - // IgnoreMissingVnetServiceEndpoint: to.Ptr(false), - // State: to.Ptr(armsql.VirtualNetworkRuleStateReady), - // VirtualNetworkSubnetID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Network/virtualNetworks/testvnet/subnets/testsubnet"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/sql/armsql/vulnerabilityassessmentbaseline_client.go b/sdk/resourcemanager/sql/armsql/vulnerabilityassessmentbaseline_client.go new file mode 100644 index 000000000000..267cec117d8d --- /dev/null +++ b/sdk/resourcemanager/sql/armsql/vulnerabilityassessmentbaseline_client.go @@ -0,0 +1,193 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armsql + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// VulnerabilityAssessmentBaselineClient contains the methods for the SQLVulnerabilityAssessmentBaseline group. +// Don't use this type directly, use NewVulnerabilityAssessmentBaselineClient() instead. +type VulnerabilityAssessmentBaselineClient struct { + internal *arm.Client + subscriptionID string +} + +// NewVulnerabilityAssessmentBaselineClient creates a new instance of VulnerabilityAssessmentBaselineClient with the specified values. +// - subscriptionID - The subscription ID that identifies an Azure subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewVulnerabilityAssessmentBaselineClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*VulnerabilityAssessmentBaselineClient, error) { + cl, err := arm.NewClient(moduleName+".VulnerabilityAssessmentBaselineClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &VulnerabilityAssessmentBaselineClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Get - Gets a list of database's sql vulnerability assessment rule baselines. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-11-01-preview +// - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure +// Resource Manager API or the portal. +// - serverName - The name of the server. +// - vulnerabilityAssessmentName - The name of the vulnerability assessment. +// - options - VulnerabilityAssessmentBaselineClientGetOptions contains the optional parameters for the VulnerabilityAssessmentBaselineClient.Get +// method. +func (client *VulnerabilityAssessmentBaselineClient) Get(ctx context.Context, resourceGroupName string, serverName string, vulnerabilityAssessmentName VulnerabilityAssessmentName, baselineName BaselineName, options *VulnerabilityAssessmentBaselineClientGetOptions) (VulnerabilityAssessmentBaselineClientGetResponse, error) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, serverName, vulnerabilityAssessmentName, baselineName, options) + if err != nil { + return VulnerabilityAssessmentBaselineClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return VulnerabilityAssessmentBaselineClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return VulnerabilityAssessmentBaselineClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *VulnerabilityAssessmentBaselineClient) getCreateRequest(ctx context.Context, resourceGroupName string, serverName string, vulnerabilityAssessmentName VulnerabilityAssessmentName, baselineName BaselineName, options *VulnerabilityAssessmentBaselineClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/sqlVulnerabilityAssessments/{vulnerabilityAssessmentName}/baselines/{baselineName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serverName == "" { + return nil, errors.New("parameter serverName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serverName}", url.PathEscape(serverName)) + if vulnerabilityAssessmentName == "" { + return nil, errors.New("parameter vulnerabilityAssessmentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vulnerabilityAssessmentName}", url.PathEscape(string(vulnerabilityAssessmentName))) + if baselineName == "" { + return nil, errors.New("parameter baselineName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{baselineName}", url.PathEscape(string(baselineName))) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("systemDatabaseName", "master") + reqQP.Set("api-version", "2022-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *VulnerabilityAssessmentBaselineClient) getHandleResponse(resp *http.Response) (VulnerabilityAssessmentBaselineClientGetResponse, error) { + result := VulnerabilityAssessmentBaselineClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DatabaseSQLVulnerabilityAssessmentBaselineSet); err != nil { + return VulnerabilityAssessmentBaselineClientGetResponse{}, err + } + return result, nil +} + +// NewListBySQLVulnerabilityAssessmentPager - Gets a list of database's sql vulnerability assessment rule baselines. +// +// Generated from API version 2022-11-01-preview +// - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure +// Resource Manager API or the portal. +// - serverName - The name of the server. +// - vulnerabilityAssessmentName - The name of the vulnerability assessment. +// - options - VulnerabilityAssessmentBaselineClientListBySQLVulnerabilityAssessmentOptions contains the optional parameters +// for the VulnerabilityAssessmentBaselineClient.NewListBySQLVulnerabilityAssessmentPager method. +func (client *VulnerabilityAssessmentBaselineClient) NewListBySQLVulnerabilityAssessmentPager(resourceGroupName string, serverName string, vulnerabilityAssessmentName VulnerabilityAssessmentName, options *VulnerabilityAssessmentBaselineClientListBySQLVulnerabilityAssessmentOptions) *runtime.Pager[VulnerabilityAssessmentBaselineClientListBySQLVulnerabilityAssessmentResponse] { + return runtime.NewPager(runtime.PagingHandler[VulnerabilityAssessmentBaselineClientListBySQLVulnerabilityAssessmentResponse]{ + More: func(page VulnerabilityAssessmentBaselineClientListBySQLVulnerabilityAssessmentResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *VulnerabilityAssessmentBaselineClientListBySQLVulnerabilityAssessmentResponse) (VulnerabilityAssessmentBaselineClientListBySQLVulnerabilityAssessmentResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listBySQLVulnerabilityAssessmentCreateRequest(ctx, resourceGroupName, serverName, vulnerabilityAssessmentName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return VulnerabilityAssessmentBaselineClientListBySQLVulnerabilityAssessmentResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return VulnerabilityAssessmentBaselineClientListBySQLVulnerabilityAssessmentResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VulnerabilityAssessmentBaselineClientListBySQLVulnerabilityAssessmentResponse{}, runtime.NewResponseError(resp) + } + return client.listBySQLVulnerabilityAssessmentHandleResponse(resp) + }, + }) +} + +// listBySQLVulnerabilityAssessmentCreateRequest creates the ListBySQLVulnerabilityAssessment request. +func (client *VulnerabilityAssessmentBaselineClient) listBySQLVulnerabilityAssessmentCreateRequest(ctx context.Context, resourceGroupName string, serverName string, vulnerabilityAssessmentName VulnerabilityAssessmentName, options *VulnerabilityAssessmentBaselineClientListBySQLVulnerabilityAssessmentOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/sqlVulnerabilityAssessments/{vulnerabilityAssessmentName}/baselines" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serverName == "" { + return nil, errors.New("parameter serverName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serverName}", url.PathEscape(serverName)) + if vulnerabilityAssessmentName == "" { + return nil, errors.New("parameter vulnerabilityAssessmentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vulnerabilityAssessmentName}", url.PathEscape(string(vulnerabilityAssessmentName))) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("systemDatabaseName", "master") + reqQP.Set("api-version", "2022-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listBySQLVulnerabilityAssessmentHandleResponse handles the ListBySQLVulnerabilityAssessment response. +func (client *VulnerabilityAssessmentBaselineClient) listBySQLVulnerabilityAssessmentHandleResponse(resp *http.Response) (VulnerabilityAssessmentBaselineClientListBySQLVulnerabilityAssessmentResponse, error) { + result := VulnerabilityAssessmentBaselineClientListBySQLVulnerabilityAssessmentResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DatabaseSQLVulnerabilityAssessmentBaselineSetListResult); err != nil { + return VulnerabilityAssessmentBaselineClientListBySQLVulnerabilityAssessmentResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/sql/armsql/vulnerabilityassessmentbaselines_client.go b/sdk/resourcemanager/sql/armsql/vulnerabilityassessmentbaselines_client.go new file mode 100644 index 000000000000..6aa52ff7cac5 --- /dev/null +++ b/sdk/resourcemanager/sql/armsql/vulnerabilityassessmentbaselines_client.go @@ -0,0 +1,120 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armsql + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// VulnerabilityAssessmentBaselinesClient contains the methods for the SQLVulnerabilityAssessmentBaselines group. +// Don't use this type directly, use NewVulnerabilityAssessmentBaselinesClient() instead. +type VulnerabilityAssessmentBaselinesClient struct { + internal *arm.Client + subscriptionID string +} + +// NewVulnerabilityAssessmentBaselinesClient creates a new instance of VulnerabilityAssessmentBaselinesClient with the specified values. +// - subscriptionID - The subscription ID that identifies an Azure subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewVulnerabilityAssessmentBaselinesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*VulnerabilityAssessmentBaselinesClient, error) { + cl, err := arm.NewClient(moduleName+".VulnerabilityAssessmentBaselinesClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &VulnerabilityAssessmentBaselinesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// CreateOrUpdate - Add a database's vulnerability assessment rule baseline list. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-11-01-preview +// - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure +// Resource Manager API or the portal. +// - serverName - The name of the server. +// - vulnerabilityAssessmentName - The name of the vulnerability assessment. +// - parameters - The requested rule baseline resource. +// - options - VulnerabilityAssessmentBaselinesClientCreateOrUpdateOptions contains the optional parameters for the VulnerabilityAssessmentBaselinesClient.CreateOrUpdate +// method. +func (client *VulnerabilityAssessmentBaselinesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, vulnerabilityAssessmentName VulnerabilityAssessmentName, baselineName BaselineName, parameters DatabaseSQLVulnerabilityAssessmentRuleBaselineListInput, options *VulnerabilityAssessmentBaselinesClientCreateOrUpdateOptions) (VulnerabilityAssessmentBaselinesClientCreateOrUpdateResponse, error) { + var err error + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, serverName, vulnerabilityAssessmentName, baselineName, parameters, options) + if err != nil { + return VulnerabilityAssessmentBaselinesClientCreateOrUpdateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return VulnerabilityAssessmentBaselinesClientCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return VulnerabilityAssessmentBaselinesClientCreateOrUpdateResponse{}, err + } + resp, err := client.createOrUpdateHandleResponse(httpResp) + return resp, err +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *VulnerabilityAssessmentBaselinesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, serverName string, vulnerabilityAssessmentName VulnerabilityAssessmentName, baselineName BaselineName, parameters DatabaseSQLVulnerabilityAssessmentRuleBaselineListInput, options *VulnerabilityAssessmentBaselinesClientCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/sqlVulnerabilityAssessments/{vulnerabilityAssessmentName}/baselines/{baselineName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serverName == "" { + return nil, errors.New("parameter serverName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serverName}", url.PathEscape(serverName)) + if vulnerabilityAssessmentName == "" { + return nil, errors.New("parameter vulnerabilityAssessmentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vulnerabilityAssessmentName}", url.PathEscape(string(vulnerabilityAssessmentName))) + if baselineName == "" { + return nil, errors.New("parameter baselineName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{baselineName}", url.PathEscape(string(baselineName))) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("systemDatabaseName", "master") + reqQP.Set("api-version", "2022-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// createOrUpdateHandleResponse handles the CreateOrUpdate response. +func (client *VulnerabilityAssessmentBaselinesClient) createOrUpdateHandleResponse(resp *http.Response) (VulnerabilityAssessmentBaselinesClientCreateOrUpdateResponse, error) { + result := VulnerabilityAssessmentBaselinesClientCreateOrUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DatabaseSQLVulnerabilityAssessmentBaselineSet); err != nil { + return VulnerabilityAssessmentBaselinesClientCreateOrUpdateResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/sql/armsql/vulnerabilityassessmentexecutescan_client.go b/sdk/resourcemanager/sql/armsql/vulnerabilityassessmentexecutescan_client.go new file mode 100644 index 000000000000..b8f40f3b7cce --- /dev/null +++ b/sdk/resourcemanager/sql/armsql/vulnerabilityassessmentexecutescan_client.go @@ -0,0 +1,118 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armsql + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// VulnerabilityAssessmentExecuteScanClient contains the methods for the SQLVulnerabilityAssessmentExecuteScan group. +// Don't use this type directly, use NewVulnerabilityAssessmentExecuteScanClient() instead. +type VulnerabilityAssessmentExecuteScanClient struct { + internal *arm.Client + subscriptionID string +} + +// NewVulnerabilityAssessmentExecuteScanClient creates a new instance of VulnerabilityAssessmentExecuteScanClient with the specified values. +// - subscriptionID - The subscription ID that identifies an Azure subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewVulnerabilityAssessmentExecuteScanClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*VulnerabilityAssessmentExecuteScanClient, error) { + cl, err := arm.NewClient(moduleName+".VulnerabilityAssessmentExecuteScanClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &VulnerabilityAssessmentExecuteScanClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginExecute - Executes a Vulnerability Assessment database scan. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-11-01-preview +// - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure +// Resource Manager API or the portal. +// - serverName - The name of the server. +// - vulnerabilityAssessmentName - The name of the vulnerability assessment. +// - options - VulnerabilityAssessmentExecuteScanClientBeginExecuteOptions contains the optional parameters for the VulnerabilityAssessmentExecuteScanClient.BeginExecute +// method. +func (client *VulnerabilityAssessmentExecuteScanClient) BeginExecute(ctx context.Context, resourceGroupName string, serverName string, vulnerabilityAssessmentName VulnerabilityAssessmentName, options *VulnerabilityAssessmentExecuteScanClientBeginExecuteOptions) (*runtime.Poller[VulnerabilityAssessmentExecuteScanClientExecuteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.execute(ctx, resourceGroupName, serverName, vulnerabilityAssessmentName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller[VulnerabilityAssessmentExecuteScanClientExecuteResponse](resp, client.internal.Pipeline(), nil) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[VulnerabilityAssessmentExecuteScanClientExecuteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Execute - Executes a Vulnerability Assessment database scan. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-11-01-preview +func (client *VulnerabilityAssessmentExecuteScanClient) execute(ctx context.Context, resourceGroupName string, serverName string, vulnerabilityAssessmentName VulnerabilityAssessmentName, options *VulnerabilityAssessmentExecuteScanClientBeginExecuteOptions) (*http.Response, error) { + var err error + req, err := client.executeCreateRequest(ctx, resourceGroupName, serverName, vulnerabilityAssessmentName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// executeCreateRequest creates the Execute request. +func (client *VulnerabilityAssessmentExecuteScanClient) executeCreateRequest(ctx context.Context, resourceGroupName string, serverName string, vulnerabilityAssessmentName VulnerabilityAssessmentName, options *VulnerabilityAssessmentExecuteScanClientBeginExecuteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/sqlVulnerabilityAssessments/{vulnerabilityAssessmentName}/initiateScan" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serverName == "" { + return nil, errors.New("parameter serverName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serverName}", url.PathEscape(serverName)) + if vulnerabilityAssessmentName == "" { + return nil, errors.New("parameter vulnerabilityAssessmentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vulnerabilityAssessmentName}", url.PathEscape(string(vulnerabilityAssessmentName))) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("systemDatabaseName", "master") + reqQP.Set("api-version", "2022-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + return req, nil +} diff --git a/sdk/resourcemanager/sql/armsql/vulnerabilityassessmentrulebaseline_client.go b/sdk/resourcemanager/sql/armsql/vulnerabilityassessmentrulebaseline_client.go new file mode 100644 index 000000000000..cd26f7135f66 --- /dev/null +++ b/sdk/resourcemanager/sql/armsql/vulnerabilityassessmentrulebaseline_client.go @@ -0,0 +1,283 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armsql + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// VulnerabilityAssessmentRuleBaselineClient contains the methods for the SQLVulnerabilityAssessmentRuleBaseline group. +// Don't use this type directly, use NewVulnerabilityAssessmentRuleBaselineClient() instead. +type VulnerabilityAssessmentRuleBaselineClient struct { + internal *arm.Client + subscriptionID string +} + +// NewVulnerabilityAssessmentRuleBaselineClient creates a new instance of VulnerabilityAssessmentRuleBaselineClient with the specified values. +// - subscriptionID - The subscription ID that identifies an Azure subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewVulnerabilityAssessmentRuleBaselineClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*VulnerabilityAssessmentRuleBaselineClient, error) { + cl, err := arm.NewClient(moduleName+".VulnerabilityAssessmentRuleBaselineClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &VulnerabilityAssessmentRuleBaselineClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// CreateOrUpdate - Creates or updates a database's vulnerability assessment rule baseline. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-11-01-preview +// - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure +// Resource Manager API or the portal. +// - serverName - The name of the server. +// - vulnerabilityAssessmentName - The name of the vulnerability assessment. +// - ruleID - The vulnerability assessment rule ID. +// - parameters - The requested rule baseline resource. +// - options - VulnerabilityAssessmentRuleBaselineClientCreateOrUpdateOptions contains the optional parameters for the VulnerabilityAssessmentRuleBaselineClient.CreateOrUpdate +// method. +func (client *VulnerabilityAssessmentRuleBaselineClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, vulnerabilityAssessmentName VulnerabilityAssessmentName, baselineName BaselineName, ruleID string, parameters DatabaseSQLVulnerabilityAssessmentRuleBaselineInput, options *VulnerabilityAssessmentRuleBaselineClientCreateOrUpdateOptions) (VulnerabilityAssessmentRuleBaselineClientCreateOrUpdateResponse, error) { + var err error + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, serverName, vulnerabilityAssessmentName, baselineName, ruleID, parameters, options) + if err != nil { + return VulnerabilityAssessmentRuleBaselineClientCreateOrUpdateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return VulnerabilityAssessmentRuleBaselineClientCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return VulnerabilityAssessmentRuleBaselineClientCreateOrUpdateResponse{}, err + } + resp, err := client.createOrUpdateHandleResponse(httpResp) + return resp, err +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *VulnerabilityAssessmentRuleBaselineClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, serverName string, vulnerabilityAssessmentName VulnerabilityAssessmentName, baselineName BaselineName, ruleID string, parameters DatabaseSQLVulnerabilityAssessmentRuleBaselineInput, options *VulnerabilityAssessmentRuleBaselineClientCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/sqlVulnerabilityAssessments/{vulnerabilityAssessmentName}/baselines/{baselineName}/rules/{ruleId}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serverName == "" { + return nil, errors.New("parameter serverName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serverName}", url.PathEscape(serverName)) + if vulnerabilityAssessmentName == "" { + return nil, errors.New("parameter vulnerabilityAssessmentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vulnerabilityAssessmentName}", url.PathEscape(string(vulnerabilityAssessmentName))) + if baselineName == "" { + return nil, errors.New("parameter baselineName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{baselineName}", url.PathEscape(string(baselineName))) + if ruleID == "" { + return nil, errors.New("parameter ruleID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{ruleId}", url.PathEscape(ruleID)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("systemDatabaseName", "master") + reqQP.Set("api-version", "2022-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// createOrUpdateHandleResponse handles the CreateOrUpdate response. +func (client *VulnerabilityAssessmentRuleBaselineClient) createOrUpdateHandleResponse(resp *http.Response) (VulnerabilityAssessmentRuleBaselineClientCreateOrUpdateResponse, error) { + result := VulnerabilityAssessmentRuleBaselineClientCreateOrUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DatabaseSQLVulnerabilityAssessmentRuleBaseline); err != nil { + return VulnerabilityAssessmentRuleBaselineClientCreateOrUpdateResponse{}, err + } + return result, nil +} + +// Get - Gets a system database's sql vulnerability assessment rule baseline. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-11-01-preview +// - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure +// Resource Manager API or the portal. +// - serverName - The name of the server. +// - vulnerabilityAssessmentName - The name of the vulnerability assessment. +// - ruleID - The vulnerability assessment rule ID. +// - options - VulnerabilityAssessmentRuleBaselineClientGetOptions contains the optional parameters for the VulnerabilityAssessmentRuleBaselineClient.Get +// method. +func (client *VulnerabilityAssessmentRuleBaselineClient) Get(ctx context.Context, resourceGroupName string, serverName string, vulnerabilityAssessmentName VulnerabilityAssessmentName, baselineName BaselineName, ruleID string, options *VulnerabilityAssessmentRuleBaselineClientGetOptions) (VulnerabilityAssessmentRuleBaselineClientGetResponse, error) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, serverName, vulnerabilityAssessmentName, baselineName, ruleID, options) + if err != nil { + return VulnerabilityAssessmentRuleBaselineClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return VulnerabilityAssessmentRuleBaselineClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return VulnerabilityAssessmentRuleBaselineClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *VulnerabilityAssessmentRuleBaselineClient) getCreateRequest(ctx context.Context, resourceGroupName string, serverName string, vulnerabilityAssessmentName VulnerabilityAssessmentName, baselineName BaselineName, ruleID string, options *VulnerabilityAssessmentRuleBaselineClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/sqlVulnerabilityAssessments/{vulnerabilityAssessmentName}/baselines/{baselineName}/rules/{ruleId}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serverName == "" { + return nil, errors.New("parameter serverName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serverName}", url.PathEscape(serverName)) + if vulnerabilityAssessmentName == "" { + return nil, errors.New("parameter vulnerabilityAssessmentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vulnerabilityAssessmentName}", url.PathEscape(string(vulnerabilityAssessmentName))) + if baselineName == "" { + return nil, errors.New("parameter baselineName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{baselineName}", url.PathEscape(string(baselineName))) + if ruleID == "" { + return nil, errors.New("parameter ruleID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{ruleId}", url.PathEscape(ruleID)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("systemDatabaseName", "master") + reqQP.Set("api-version", "2022-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *VulnerabilityAssessmentRuleBaselineClient) getHandleResponse(resp *http.Response) (VulnerabilityAssessmentRuleBaselineClientGetResponse, error) { + result := VulnerabilityAssessmentRuleBaselineClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DatabaseSQLVulnerabilityAssessmentRuleBaseline); err != nil { + return VulnerabilityAssessmentRuleBaselineClientGetResponse{}, err + } + return result, nil +} + +// NewListByBaselinePager - Gets a system database's sql vulnerability assessment rule baseline. +// +// Generated from API version 2022-11-01-preview +// - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure +// Resource Manager API or the portal. +// - serverName - The name of the server. +// - vulnerabilityAssessmentName - The name of the vulnerability assessment. +// - options - VulnerabilityAssessmentRuleBaselineClientListByBaselineOptions contains the optional parameters for the VulnerabilityAssessmentRuleBaselineClient.NewListByBaselinePager +// method. +func (client *VulnerabilityAssessmentRuleBaselineClient) NewListByBaselinePager(resourceGroupName string, serverName string, vulnerabilityAssessmentName VulnerabilityAssessmentName, baselineName BaselineName, options *VulnerabilityAssessmentRuleBaselineClientListByBaselineOptions) *runtime.Pager[VulnerabilityAssessmentRuleBaselineClientListByBaselineResponse] { + return runtime.NewPager(runtime.PagingHandler[VulnerabilityAssessmentRuleBaselineClientListByBaselineResponse]{ + More: func(page VulnerabilityAssessmentRuleBaselineClientListByBaselineResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *VulnerabilityAssessmentRuleBaselineClientListByBaselineResponse) (VulnerabilityAssessmentRuleBaselineClientListByBaselineResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByBaselineCreateRequest(ctx, resourceGroupName, serverName, vulnerabilityAssessmentName, baselineName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return VulnerabilityAssessmentRuleBaselineClientListByBaselineResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return VulnerabilityAssessmentRuleBaselineClientListByBaselineResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VulnerabilityAssessmentRuleBaselineClientListByBaselineResponse{}, runtime.NewResponseError(resp) + } + return client.listByBaselineHandleResponse(resp) + }, + }) +} + +// listByBaselineCreateRequest creates the ListByBaseline request. +func (client *VulnerabilityAssessmentRuleBaselineClient) listByBaselineCreateRequest(ctx context.Context, resourceGroupName string, serverName string, vulnerabilityAssessmentName VulnerabilityAssessmentName, baselineName BaselineName, options *VulnerabilityAssessmentRuleBaselineClientListByBaselineOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/sqlVulnerabilityAssessments/{vulnerabilityAssessmentName}/baselines/{baselineName}/rules" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serverName == "" { + return nil, errors.New("parameter serverName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serverName}", url.PathEscape(serverName)) + if vulnerabilityAssessmentName == "" { + return nil, errors.New("parameter vulnerabilityAssessmentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vulnerabilityAssessmentName}", url.PathEscape(string(vulnerabilityAssessmentName))) + if baselineName == "" { + return nil, errors.New("parameter baselineName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{baselineName}", url.PathEscape(string(baselineName))) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("systemDatabaseName", "master") + reqQP.Set("api-version", "2022-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByBaselineHandleResponse handles the ListByBaseline response. +func (client *VulnerabilityAssessmentRuleBaselineClient) listByBaselineHandleResponse(resp *http.Response) (VulnerabilityAssessmentRuleBaselineClientListByBaselineResponse, error) { + result := VulnerabilityAssessmentRuleBaselineClientListByBaselineResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DatabaseSQLVulnerabilityAssessmentRuleBaselineListResult); err != nil { + return VulnerabilityAssessmentRuleBaselineClientListByBaselineResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/sql/armsql/vulnerabilityassessmentrulebaselines_client.go b/sdk/resourcemanager/sql/armsql/vulnerabilityassessmentrulebaselines_client.go new file mode 100644 index 000000000000..5df71ea6b1e8 --- /dev/null +++ b/sdk/resourcemanager/sql/armsql/vulnerabilityassessmentrulebaselines_client.go @@ -0,0 +1,110 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armsql + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// VulnerabilityAssessmentRuleBaselinesClient contains the methods for the SQLVulnerabilityAssessmentRuleBaselines group. +// Don't use this type directly, use NewVulnerabilityAssessmentRuleBaselinesClient() instead. +type VulnerabilityAssessmentRuleBaselinesClient struct { + internal *arm.Client + subscriptionID string +} + +// NewVulnerabilityAssessmentRuleBaselinesClient creates a new instance of VulnerabilityAssessmentRuleBaselinesClient with the specified values. +// - subscriptionID - The subscription ID that identifies an Azure subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewVulnerabilityAssessmentRuleBaselinesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*VulnerabilityAssessmentRuleBaselinesClient, error) { + cl, err := arm.NewClient(moduleName+".VulnerabilityAssessmentRuleBaselinesClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &VulnerabilityAssessmentRuleBaselinesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Delete - Removes the database's vulnerability assessment rule baseline. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-11-01-preview +// - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure +// Resource Manager API or the portal. +// - serverName - The name of the server. +// - vulnerabilityAssessmentName - The name of the vulnerability assessment. +// - ruleID - The vulnerability assessment rule ID. +// - options - VulnerabilityAssessmentRuleBaselinesClientDeleteOptions contains the optional parameters for the VulnerabilityAssessmentRuleBaselinesClient.Delete +// method. +func (client *VulnerabilityAssessmentRuleBaselinesClient) Delete(ctx context.Context, resourceGroupName string, serverName string, vulnerabilityAssessmentName VulnerabilityAssessmentName, baselineName BaselineName, ruleID string, options *VulnerabilityAssessmentRuleBaselinesClientDeleteOptions) (VulnerabilityAssessmentRuleBaselinesClientDeleteResponse, error) { + var err error + req, err := client.deleteCreateRequest(ctx, resourceGroupName, serverName, vulnerabilityAssessmentName, baselineName, ruleID, options) + if err != nil { + return VulnerabilityAssessmentRuleBaselinesClientDeleteResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return VulnerabilityAssessmentRuleBaselinesClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return VulnerabilityAssessmentRuleBaselinesClientDeleteResponse{}, err + } + return VulnerabilityAssessmentRuleBaselinesClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *VulnerabilityAssessmentRuleBaselinesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, serverName string, vulnerabilityAssessmentName VulnerabilityAssessmentName, baselineName BaselineName, ruleID string, options *VulnerabilityAssessmentRuleBaselinesClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/sqlVulnerabilityAssessments/{vulnerabilityAssessmentName}/baselines/{baselineName}/rules/{ruleId}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serverName == "" { + return nil, errors.New("parameter serverName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serverName}", url.PathEscape(serverName)) + if vulnerabilityAssessmentName == "" { + return nil, errors.New("parameter vulnerabilityAssessmentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vulnerabilityAssessmentName}", url.PathEscape(string(vulnerabilityAssessmentName))) + if baselineName == "" { + return nil, errors.New("parameter baselineName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{baselineName}", url.PathEscape(string(baselineName))) + if ruleID == "" { + return nil, errors.New("parameter ruleID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{ruleId}", url.PathEscape(ruleID)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("systemDatabaseName", "master") + reqQP.Set("api-version", "2022-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + return req, nil +} diff --git a/sdk/resourcemanager/sql/armsql/vulnerabilityassessments_client.go b/sdk/resourcemanager/sql/armsql/vulnerabilityassessments_client.go new file mode 100644 index 000000000000..3921f6455ac4 --- /dev/null +++ b/sdk/resourcemanager/sql/armsql/vulnerabilityassessments_client.go @@ -0,0 +1,100 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armsql + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// VulnerabilityAssessmentsClient contains the methods for the SQLVulnerabilityAssessments group. +// Don't use this type directly, use NewVulnerabilityAssessmentsClient() instead. +type VulnerabilityAssessmentsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewVulnerabilityAssessmentsClient creates a new instance of VulnerabilityAssessmentsClient with the specified values. +// - subscriptionID - The subscription ID that identifies an Azure subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewVulnerabilityAssessmentsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*VulnerabilityAssessmentsClient, error) { + cl, err := arm.NewClient(moduleName+".VulnerabilityAssessmentsClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &VulnerabilityAssessmentsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Delete - Removes SQL Vulnerability Assessment. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-11-01-preview +// - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure +// Resource Manager API or the portal. +// - serverName - The name of the server. +// - vulnerabilityAssessmentName - The name of the SQL Vulnerability Assessment. +// - options - VulnerabilityAssessmentsClientDeleteOptions contains the optional parameters for the VulnerabilityAssessmentsClient.Delete +// method. +func (client *VulnerabilityAssessmentsClient) Delete(ctx context.Context, resourceGroupName string, serverName string, vulnerabilityAssessmentName VulnerabilityAssessmentName, options *VulnerabilityAssessmentsClientDeleteOptions) (VulnerabilityAssessmentsClientDeleteResponse, error) { + var err error + req, err := client.deleteCreateRequest(ctx, resourceGroupName, serverName, vulnerabilityAssessmentName, options) + if err != nil { + return VulnerabilityAssessmentsClientDeleteResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return VulnerabilityAssessmentsClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return VulnerabilityAssessmentsClientDeleteResponse{}, err + } + return VulnerabilityAssessmentsClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *VulnerabilityAssessmentsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, serverName string, vulnerabilityAssessmentName VulnerabilityAssessmentName, options *VulnerabilityAssessmentsClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/sqlVulnerabilityAssessments/{vulnerabilityAssessmentName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serverName == "" { + return nil, errors.New("parameter serverName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serverName}", url.PathEscape(serverName)) + if vulnerabilityAssessmentName == "" { + return nil, errors.New("parameter vulnerabilityAssessmentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vulnerabilityAssessmentName}", url.PathEscape(string(vulnerabilityAssessmentName))) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + return req, nil +} diff --git a/sdk/resourcemanager/sql/armsql/vulnerabilityassessmentscanresult_client.go b/sdk/resourcemanager/sql/armsql/vulnerabilityassessmentscanresult_client.go new file mode 100644 index 000000000000..6add9bba8800 --- /dev/null +++ b/sdk/resourcemanager/sql/armsql/vulnerabilityassessmentscanresult_client.go @@ -0,0 +1,204 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armsql + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// VulnerabilityAssessmentScanResultClient contains the methods for the SQLVulnerabilityAssessmentScanResult group. +// Don't use this type directly, use NewVulnerabilityAssessmentScanResultClient() instead. +type VulnerabilityAssessmentScanResultClient struct { + internal *arm.Client + subscriptionID string +} + +// NewVulnerabilityAssessmentScanResultClient creates a new instance of VulnerabilityAssessmentScanResultClient with the specified values. +// - subscriptionID - The subscription ID that identifies an Azure subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewVulnerabilityAssessmentScanResultClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*VulnerabilityAssessmentScanResultClient, error) { + cl, err := arm.NewClient(moduleName+".VulnerabilityAssessmentScanResultClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &VulnerabilityAssessmentScanResultClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Get - Gets a vulnerability assessment scan record of a database. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-11-01-preview +// - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure +// Resource Manager API or the portal. +// - serverName - The name of the server. +// - vulnerabilityAssessmentName - The name of the SQL Vulnerability Assessment. +// - scanID - The scan id of the SQL Vulnerability Assessment scan to retrieve result from. +// - scanResultID - The scan result id of the specific result to retrieve. +// - options - VulnerabilityAssessmentScanResultClientGetOptions contains the optional parameters for the VulnerabilityAssessmentScanResultClient.Get +// method. +func (client *VulnerabilityAssessmentScanResultClient) Get(ctx context.Context, resourceGroupName string, serverName string, vulnerabilityAssessmentName SQLVulnerabilityAssessmentName, scanID string, scanResultID string, options *VulnerabilityAssessmentScanResultClientGetOptions) (VulnerabilityAssessmentScanResultClientGetResponse, error) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, serverName, vulnerabilityAssessmentName, scanID, scanResultID, options) + if err != nil { + return VulnerabilityAssessmentScanResultClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return VulnerabilityAssessmentScanResultClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return VulnerabilityAssessmentScanResultClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *VulnerabilityAssessmentScanResultClient) getCreateRequest(ctx context.Context, resourceGroupName string, serverName string, vulnerabilityAssessmentName SQLVulnerabilityAssessmentName, scanID string, scanResultID string, options *VulnerabilityAssessmentScanResultClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/sqlVulnerabilityAssessments/{vulnerabilityAssessmentName}/scans/{scanId}/scanResults/{scanResultId}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serverName == "" { + return nil, errors.New("parameter serverName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serverName}", url.PathEscape(serverName)) + if vulnerabilityAssessmentName == "" { + return nil, errors.New("parameter vulnerabilityAssessmentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vulnerabilityAssessmentName}", url.PathEscape(string(vulnerabilityAssessmentName))) + if scanID == "" { + return nil, errors.New("parameter scanID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{scanId}", url.PathEscape(scanID)) + if scanResultID == "" { + return nil, errors.New("parameter scanResultID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{scanResultId}", url.PathEscape(scanResultID)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("systemDatabaseName", "master") + reqQP.Set("api-version", "2022-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *VulnerabilityAssessmentScanResultClient) getHandleResponse(resp *http.Response) (VulnerabilityAssessmentScanResultClientGetResponse, error) { + result := VulnerabilityAssessmentScanResultClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.VulnerabilityAssessmentScanResults); err != nil { + return VulnerabilityAssessmentScanResultClientGetResponse{}, err + } + return result, nil +} + +// NewListByScanPager - Gets a vulnerability assessment scan record of a database. +// +// Generated from API version 2022-11-01-preview +// - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure +// Resource Manager API or the portal. +// - serverName - The name of the server. +// - vulnerabilityAssessmentName - The name of the SQL Vulnerability Assessment. +// - scanID - The scan id of the SQL Vulnerability Assessment scan to retrieve result from. +// - options - VulnerabilityAssessmentScanResultClientListByScanOptions contains the optional parameters for the VulnerabilityAssessmentScanResultClient.NewListByScanPager +// method. +func (client *VulnerabilityAssessmentScanResultClient) NewListByScanPager(resourceGroupName string, serverName string, vulnerabilityAssessmentName SQLVulnerabilityAssessmentName, scanID string, options *VulnerabilityAssessmentScanResultClientListByScanOptions) *runtime.Pager[VulnerabilityAssessmentScanResultClientListByScanResponse] { + return runtime.NewPager(runtime.PagingHandler[VulnerabilityAssessmentScanResultClientListByScanResponse]{ + More: func(page VulnerabilityAssessmentScanResultClientListByScanResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *VulnerabilityAssessmentScanResultClientListByScanResponse) (VulnerabilityAssessmentScanResultClientListByScanResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByScanCreateRequest(ctx, resourceGroupName, serverName, vulnerabilityAssessmentName, scanID, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return VulnerabilityAssessmentScanResultClientListByScanResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return VulnerabilityAssessmentScanResultClientListByScanResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VulnerabilityAssessmentScanResultClientListByScanResponse{}, runtime.NewResponseError(resp) + } + return client.listByScanHandleResponse(resp) + }, + }) +} + +// listByScanCreateRequest creates the ListByScan request. +func (client *VulnerabilityAssessmentScanResultClient) listByScanCreateRequest(ctx context.Context, resourceGroupName string, serverName string, vulnerabilityAssessmentName SQLVulnerabilityAssessmentName, scanID string, options *VulnerabilityAssessmentScanResultClientListByScanOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/sqlVulnerabilityAssessments/{vulnerabilityAssessmentName}/scans/{scanId}/scanResults" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serverName == "" { + return nil, errors.New("parameter serverName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serverName}", url.PathEscape(serverName)) + if vulnerabilityAssessmentName == "" { + return nil, errors.New("parameter vulnerabilityAssessmentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vulnerabilityAssessmentName}", url.PathEscape(string(vulnerabilityAssessmentName))) + if scanID == "" { + return nil, errors.New("parameter scanID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{scanId}", url.PathEscape(scanID)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("systemDatabaseName", "master") + reqQP.Set("api-version", "2022-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByScanHandleResponse handles the ListByScan response. +func (client *VulnerabilityAssessmentScanResultClient) listByScanHandleResponse(resp *http.Response) (VulnerabilityAssessmentScanResultClientListByScanResponse, error) { + result := VulnerabilityAssessmentScanResultClientListByScanResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.VulnerabilityAssessmentScanListResult); err != nil { + return VulnerabilityAssessmentScanResultClientListByScanResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/sql/armsql/vulnerabilityassessmentscans_client.go b/sdk/resourcemanager/sql/armsql/vulnerabilityassessmentscans_client.go new file mode 100644 index 000000000000..430d670851f3 --- /dev/null +++ b/sdk/resourcemanager/sql/armsql/vulnerabilityassessmentscans_client.go @@ -0,0 +1,193 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armsql + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// VulnerabilityAssessmentScansClient contains the methods for the SQLVulnerabilityAssessmentScans group. +// Don't use this type directly, use NewVulnerabilityAssessmentScansClient() instead. +type VulnerabilityAssessmentScansClient struct { + internal *arm.Client + subscriptionID string +} + +// NewVulnerabilityAssessmentScansClient creates a new instance of VulnerabilityAssessmentScansClient with the specified values. +// - subscriptionID - The subscription ID that identifies an Azure subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewVulnerabilityAssessmentScansClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*VulnerabilityAssessmentScansClient, error) { + cl, err := arm.NewClient(moduleName+".VulnerabilityAssessmentScansClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &VulnerabilityAssessmentScansClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Get - Get a system database vulnerability assessment scan record. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-11-01-preview +// - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure +// Resource Manager API or the portal. +// - serverName - The name of the server. +// - vulnerabilityAssessmentName - The name of the vulnerability assessment. +// - options - VulnerabilityAssessmentScansClientGetOptions contains the optional parameters for the VulnerabilityAssessmentScansClient.Get +// method. +func (client *VulnerabilityAssessmentScansClient) Get(ctx context.Context, resourceGroupName string, serverName string, vulnerabilityAssessmentName VulnerabilityAssessmentName, scanID string, options *VulnerabilityAssessmentScansClientGetOptions) (VulnerabilityAssessmentScansClientGetResponse, error) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, serverName, vulnerabilityAssessmentName, scanID, options) + if err != nil { + return VulnerabilityAssessmentScansClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return VulnerabilityAssessmentScansClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return VulnerabilityAssessmentScansClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *VulnerabilityAssessmentScansClient) getCreateRequest(ctx context.Context, resourceGroupName string, serverName string, vulnerabilityAssessmentName VulnerabilityAssessmentName, scanID string, options *VulnerabilityAssessmentScansClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/sqlVulnerabilityAssessments/{vulnerabilityAssessmentName}/scans/{scanId}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serverName == "" { + return nil, errors.New("parameter serverName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serverName}", url.PathEscape(serverName)) + if vulnerabilityAssessmentName == "" { + return nil, errors.New("parameter vulnerabilityAssessmentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vulnerabilityAssessmentName}", url.PathEscape(string(vulnerabilityAssessmentName))) + if scanID == "" { + return nil, errors.New("parameter scanID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{scanId}", url.PathEscape(scanID)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("systemDatabaseName", "master") + reqQP.Set("api-version", "2022-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *VulnerabilityAssessmentScansClient) getHandleResponse(resp *http.Response) (VulnerabilityAssessmentScansClientGetResponse, error) { + result := VulnerabilityAssessmentScansClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.VulnerabilityAssessmentScanRecordForSQL); err != nil { + return VulnerabilityAssessmentScansClientGetResponse{}, err + } + return result, nil +} + +// NewListBySQLVulnerabilityAssessmentsPager - Lists the vulnerability assessment scans of a database. +// +// Generated from API version 2022-11-01-preview +// - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure +// Resource Manager API or the portal. +// - serverName - The name of the server. +// - vulnerabilityAssessmentName - The name of the vulnerability assessment. +// - options - VulnerabilityAssessmentScansClientListBySQLVulnerabilityAssessmentsOptions contains the optional parameters for +// the VulnerabilityAssessmentScansClient.NewListBySQLVulnerabilityAssessmentsPager method. +func (client *VulnerabilityAssessmentScansClient) NewListBySQLVulnerabilityAssessmentsPager(resourceGroupName string, serverName string, vulnerabilityAssessmentName VulnerabilityAssessmentName, options *VulnerabilityAssessmentScansClientListBySQLVulnerabilityAssessmentsOptions) *runtime.Pager[VulnerabilityAssessmentScansClientListBySQLVulnerabilityAssessmentsResponse] { + return runtime.NewPager(runtime.PagingHandler[VulnerabilityAssessmentScansClientListBySQLVulnerabilityAssessmentsResponse]{ + More: func(page VulnerabilityAssessmentScansClientListBySQLVulnerabilityAssessmentsResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *VulnerabilityAssessmentScansClientListBySQLVulnerabilityAssessmentsResponse) (VulnerabilityAssessmentScansClientListBySQLVulnerabilityAssessmentsResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listBySQLVulnerabilityAssessmentsCreateRequest(ctx, resourceGroupName, serverName, vulnerabilityAssessmentName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return VulnerabilityAssessmentScansClientListBySQLVulnerabilityAssessmentsResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return VulnerabilityAssessmentScansClientListBySQLVulnerabilityAssessmentsResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VulnerabilityAssessmentScansClientListBySQLVulnerabilityAssessmentsResponse{}, runtime.NewResponseError(resp) + } + return client.listBySQLVulnerabilityAssessmentsHandleResponse(resp) + }, + }) +} + +// listBySQLVulnerabilityAssessmentsCreateRequest creates the ListBySQLVulnerabilityAssessments request. +func (client *VulnerabilityAssessmentScansClient) listBySQLVulnerabilityAssessmentsCreateRequest(ctx context.Context, resourceGroupName string, serverName string, vulnerabilityAssessmentName VulnerabilityAssessmentName, options *VulnerabilityAssessmentScansClientListBySQLVulnerabilityAssessmentsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/sqlVulnerabilityAssessments/{vulnerabilityAssessmentName}/scans" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serverName == "" { + return nil, errors.New("parameter serverName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serverName}", url.PathEscape(serverName)) + if vulnerabilityAssessmentName == "" { + return nil, errors.New("parameter vulnerabilityAssessmentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vulnerabilityAssessmentName}", url.PathEscape(string(vulnerabilityAssessmentName))) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("systemDatabaseName", "master") + reqQP.Set("api-version", "2022-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listBySQLVulnerabilityAssessmentsHandleResponse handles the ListBySQLVulnerabilityAssessments response. +func (client *VulnerabilityAssessmentScansClient) listBySQLVulnerabilityAssessmentsHandleResponse(resp *http.Response) (VulnerabilityAssessmentScansClientListBySQLVulnerabilityAssessmentsResponse, error) { + result := VulnerabilityAssessmentScansClientListBySQLVulnerabilityAssessmentsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.VulnerabilityAssessmentScanRecordForSQLListResult); err != nil { + return VulnerabilityAssessmentScansClientListBySQLVulnerabilityAssessmentsResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/sql/armsql/vulnerabilityassessmentssettings_client.go b/sdk/resourcemanager/sql/armsql/vulnerabilityassessmentssettings_client.go new file mode 100644 index 000000000000..f8690e0c51ad --- /dev/null +++ b/sdk/resourcemanager/sql/armsql/vulnerabilityassessmentssettings_client.go @@ -0,0 +1,253 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armsql + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// VulnerabilityAssessmentsSettingsClient contains the methods for the SQLVulnerabilityAssessmentsSettings group. +// Don't use this type directly, use NewVulnerabilityAssessmentsSettingsClient() instead. +type VulnerabilityAssessmentsSettingsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewVulnerabilityAssessmentsSettingsClient creates a new instance of VulnerabilityAssessmentsSettingsClient with the specified values. +// - subscriptionID - The subscription ID that identifies an Azure subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewVulnerabilityAssessmentsSettingsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*VulnerabilityAssessmentsSettingsClient, error) { + cl, err := arm.NewClient(moduleName+".VulnerabilityAssessmentsSettingsClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &VulnerabilityAssessmentsSettingsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// CreateOrUpdate - Creates or updates SQL Vulnerability Assessment policy. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-11-01-preview +// - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure +// Resource Manager API or the portal. +// - serverName - The name of the server. +// - vulnerabilityAssessmentName - The name of the SQL Vulnerability Assessment. +// - parameters - The requested resource. +// - options - VulnerabilityAssessmentsSettingsClientCreateOrUpdateOptions contains the optional parameters for the VulnerabilityAssessmentsSettingsClient.CreateOrUpdate +// method. +func (client *VulnerabilityAssessmentsSettingsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, vulnerabilityAssessmentName VulnerabilityAssessmentName, parameters VulnerabilityAssessment, options *VulnerabilityAssessmentsSettingsClientCreateOrUpdateOptions) (VulnerabilityAssessmentsSettingsClientCreateOrUpdateResponse, error) { + var err error + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, serverName, vulnerabilityAssessmentName, parameters, options) + if err != nil { + return VulnerabilityAssessmentsSettingsClientCreateOrUpdateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return VulnerabilityAssessmentsSettingsClientCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return VulnerabilityAssessmentsSettingsClientCreateOrUpdateResponse{}, err + } + resp, err := client.createOrUpdateHandleResponse(httpResp) + return resp, err +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *VulnerabilityAssessmentsSettingsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, serverName string, vulnerabilityAssessmentName VulnerabilityAssessmentName, parameters VulnerabilityAssessment, options *VulnerabilityAssessmentsSettingsClientCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/sqlVulnerabilityAssessments/{vulnerabilityAssessmentName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serverName == "" { + return nil, errors.New("parameter serverName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serverName}", url.PathEscape(serverName)) + if vulnerabilityAssessmentName == "" { + return nil, errors.New("parameter vulnerabilityAssessmentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vulnerabilityAssessmentName}", url.PathEscape(string(vulnerabilityAssessmentName))) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// createOrUpdateHandleResponse handles the CreateOrUpdate response. +func (client *VulnerabilityAssessmentsSettingsClient) createOrUpdateHandleResponse(resp *http.Response) (VulnerabilityAssessmentsSettingsClientCreateOrUpdateResponse, error) { + result := VulnerabilityAssessmentsSettingsClientCreateOrUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.VulnerabilityAssessment); err != nil { + return VulnerabilityAssessmentsSettingsClientCreateOrUpdateResponse{}, err + } + return result, nil +} + +// Get - Gets SQL Vulnerability Assessment policy. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-11-01-preview +// - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure +// Resource Manager API or the portal. +// - serverName - The name of the server. +// - vulnerabilityAssessmentName - The name of the SQL Vulnerability Assessment. +// - options - VulnerabilityAssessmentsSettingsClientGetOptions contains the optional parameters for the VulnerabilityAssessmentsSettingsClient.Get +// method. +func (client *VulnerabilityAssessmentsSettingsClient) Get(ctx context.Context, resourceGroupName string, serverName string, vulnerabilityAssessmentName SQLVulnerabilityAssessmentName, options *VulnerabilityAssessmentsSettingsClientGetOptions) (VulnerabilityAssessmentsSettingsClientGetResponse, error) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, serverName, vulnerabilityAssessmentName, options) + if err != nil { + return VulnerabilityAssessmentsSettingsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return VulnerabilityAssessmentsSettingsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return VulnerabilityAssessmentsSettingsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *VulnerabilityAssessmentsSettingsClient) getCreateRequest(ctx context.Context, resourceGroupName string, serverName string, vulnerabilityAssessmentName SQLVulnerabilityAssessmentName, options *VulnerabilityAssessmentsSettingsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/sqlVulnerabilityAssessments/{vulnerabilityAssessmentName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serverName == "" { + return nil, errors.New("parameter serverName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serverName}", url.PathEscape(serverName)) + if vulnerabilityAssessmentName == "" { + return nil, errors.New("parameter vulnerabilityAssessmentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vulnerabilityAssessmentName}", url.PathEscape(string(vulnerabilityAssessmentName))) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *VulnerabilityAssessmentsSettingsClient) getHandleResponse(resp *http.Response) (VulnerabilityAssessmentsSettingsClientGetResponse, error) { + result := VulnerabilityAssessmentsSettingsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.VulnerabilityAssessment); err != nil { + return VulnerabilityAssessmentsSettingsClientGetResponse{}, err + } + return result, nil +} + +// NewListByServerPager - Lists SQL Vulnerability Assessment policies associated with a server. +// +// Generated from API version 2022-11-01-preview +// - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure +// Resource Manager API or the portal. +// - serverName - The name of the server. +// - options - VulnerabilityAssessmentsSettingsClientListByServerOptions contains the optional parameters for the VulnerabilityAssessmentsSettingsClient.NewListByServerPager +// method. +func (client *VulnerabilityAssessmentsSettingsClient) NewListByServerPager(resourceGroupName string, serverName string, options *VulnerabilityAssessmentsSettingsClientListByServerOptions) *runtime.Pager[VulnerabilityAssessmentsSettingsClientListByServerResponse] { + return runtime.NewPager(runtime.PagingHandler[VulnerabilityAssessmentsSettingsClientListByServerResponse]{ + More: func(page VulnerabilityAssessmentsSettingsClientListByServerResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *VulnerabilityAssessmentsSettingsClientListByServerResponse) (VulnerabilityAssessmentsSettingsClientListByServerResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByServerCreateRequest(ctx, resourceGroupName, serverName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return VulnerabilityAssessmentsSettingsClientListByServerResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return VulnerabilityAssessmentsSettingsClientListByServerResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VulnerabilityAssessmentsSettingsClientListByServerResponse{}, runtime.NewResponseError(resp) + } + return client.listByServerHandleResponse(resp) + }, + }) +} + +// listByServerCreateRequest creates the ListByServer request. +func (client *VulnerabilityAssessmentsSettingsClient) listByServerCreateRequest(ctx context.Context, resourceGroupName string, serverName string, options *VulnerabilityAssessmentsSettingsClientListByServerOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/sqlVulnerabilityAssessments" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serverName == "" { + return nil, errors.New("parameter serverName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serverName}", url.PathEscape(serverName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByServerHandleResponse handles the ListByServer response. +func (client *VulnerabilityAssessmentsSettingsClient) listByServerHandleResponse(resp *http.Response) (VulnerabilityAssessmentsSettingsClientListByServerResponse, error) { + result := VulnerabilityAssessmentsSettingsClientListByServerResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.VulnerabilityAssessmentListResult); err != nil { + return VulnerabilityAssessmentsSettingsClientListByServerResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/sql/armsql/workloadclassifiers_client.go b/sdk/resourcemanager/sql/armsql/workloadclassifiers_client.go index 49b503a20e29..8169bfbf28eb 100644 --- a/sdk/resourcemanager/sql/armsql/workloadclassifiers_client.go +++ b/sdk/resourcemanager/sql/armsql/workloadclassifiers_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armsql @@ -47,7 +46,7 @@ func NewWorkloadClassifiersClient(subscriptionID string, credential azcore.Token // BeginCreateOrUpdate - Creates or updates a workload classifier. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -63,7 +62,8 @@ func (client *WorkloadClassifiersClient) BeginCreateOrUpdate(ctx context.Context if err != nil { return nil, err } - return runtime.NewPoller[WorkloadClassifiersClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[WorkloadClassifiersClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[WorkloadClassifiersClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -72,20 +72,22 @@ func (client *WorkloadClassifiersClient) BeginCreateOrUpdate(ctx context.Context // CreateOrUpdate - Creates or updates a workload classifier. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview func (client *WorkloadClassifiersClient) createOrUpdate(ctx context.Context, resourceGroupName string, serverName string, databaseName string, workloadGroupName string, workloadClassifierName string, parameters WorkloadClassifier, options *WorkloadClassifiersClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, serverName, databaseName, workloadGroupName, workloadClassifierName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createOrUpdateCreateRequest creates the CreateOrUpdate request. @@ -120,16 +122,19 @@ func (client *WorkloadClassifiersClient) createOrUpdateCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // BeginDelete - Deletes a workload classifier. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -144,7 +149,8 @@ func (client *WorkloadClassifiersClient) BeginDelete(ctx context.Context, resour if err != nil { return nil, err } - return runtime.NewPoller[WorkloadClassifiersClientDeleteResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[WorkloadClassifiersClientDeleteResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[WorkloadClassifiersClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -153,20 +159,22 @@ func (client *WorkloadClassifiersClient) BeginDelete(ctx context.Context, resour // Delete - Deletes a workload classifier. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview func (client *WorkloadClassifiersClient) deleteOperation(ctx context.Context, resourceGroupName string, serverName string, databaseName string, workloadGroupName string, workloadClassifierName string, options *WorkloadClassifiersClientBeginDeleteOptions) (*http.Response, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, serverName, databaseName, workloadGroupName, workloadClassifierName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteCreateRequest creates the Delete request. @@ -201,7 +209,7 @@ func (client *WorkloadClassifiersClient) deleteCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -209,7 +217,7 @@ func (client *WorkloadClassifiersClient) deleteCreateRequest(ctx context.Context // Get - Gets a workload classifier // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -218,18 +226,21 @@ func (client *WorkloadClassifiersClient) deleteCreateRequest(ctx context.Context // - workloadClassifierName - The name of the workload classifier. // - options - WorkloadClassifiersClientGetOptions contains the optional parameters for the WorkloadClassifiersClient.Get method. func (client *WorkloadClassifiersClient) Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string, workloadGroupName string, workloadClassifierName string, options *WorkloadClassifiersClientGetOptions) (WorkloadClassifiersClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, serverName, databaseName, workloadGroupName, workloadClassifierName, options) if err != nil { return WorkloadClassifiersClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return WorkloadClassifiersClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return WorkloadClassifiersClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return WorkloadClassifiersClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -264,7 +275,7 @@ func (client *WorkloadClassifiersClient) getCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -281,7 +292,7 @@ func (client *WorkloadClassifiersClient) getHandleResponse(resp *http.Response) // NewListByWorkloadGroupPager - Gets the list of workload classifiers for a workload group // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -345,7 +356,7 @@ func (client *WorkloadClassifiersClient) listByWorkloadGroupCreateRequest(ctx co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/sql/armsql/workloadclassifiers_client_example_test.go b/sdk/resourcemanager/sql/armsql/workloadclassifiers_client_example_test.go deleted file mode 100644 index b11fdde58158..000000000000 --- a/sdk/resourcemanager/sql/armsql/workloadclassifiers_client_example_test.go +++ /dev/null @@ -1,227 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsql_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sql/armsql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/GetWorkloadClassifier.json -func ExampleWorkloadClassifiersClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewWorkloadClassifiersClient().Get(ctx, "Default-SQL-SouthEastAsia", "testsvr", "testdb", "wlm_workloadgroup", "wlm_classifier", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.WorkloadClassifier = armsql.WorkloadClassifier{ - // Name: to.Ptr("wlm_classifier"), - // Type: to.Ptr("Microsoft.Sql/servers/databases/workloadGroups/workloadClassifiers"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/servers/testsvr/databases/testdb/workloadGroups/wlm_workloadgroup/workloadClassifiers/wlm_classifier"), - // Properties: &armsql.WorkloadClassifierProperties{ - // Context: to.Ptr("test_context"), - // EndTime: to.Ptr("14:00"), - // Importance: to.Ptr("high"), - // Label: to.Ptr("test_label"), - // MemberName: to.Ptr("dbo"), - // StartTime: to.Ptr("12:00"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/CreateOrUpdateWorkloadClassifierMax.json -func ExampleWorkloadClassifiersClient_BeginCreateOrUpdate_createAWorkloadGroupWithAllPropertiesSpecified() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewWorkloadClassifiersClient().BeginCreateOrUpdate(ctx, "Default-SQL-SouthEastAsia", "testsvr", "testdb", "wlm_workloadgroup", "wlm_workloadclassifier", armsql.WorkloadClassifier{ - Properties: &armsql.WorkloadClassifierProperties{ - Context: to.Ptr("test_context"), - EndTime: to.Ptr("14:00"), - Importance: to.Ptr("high"), - Label: to.Ptr("test_label"), - MemberName: to.Ptr("dbo"), - StartTime: to.Ptr("12:00"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.WorkloadClassifier = armsql.WorkloadClassifier{ - // Name: to.Ptr("wlm_workloadclassifier"), - // Type: to.Ptr("Microsoft.Sql/servers/databases/workloadGroups/workloadClassifiers"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/servers/testsvr/databases/testdb/workloadGroups/wlm_workloadgroup/workloadClassifiers/wlm_workloadclassifier"), - // Properties: &armsql.WorkloadClassifierProperties{ - // Context: to.Ptr("test_context"), - // EndTime: to.Ptr("14:00"), - // Importance: to.Ptr("high"), - // Label: to.Ptr("test_label"), - // MemberName: to.Ptr("dbo"), - // StartTime: to.Ptr("12:00"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/CreateOrUpdateWorkloadClassifierMin.json -func ExampleWorkloadClassifiersClient_BeginCreateOrUpdate_createAWorkloadGroupWithTheRequiredPropertiesSpecified() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewWorkloadClassifiersClient().BeginCreateOrUpdate(ctx, "Default-SQL-SouthEastAsia", "testsvr", "testdb", "wlm_workloadgroup", "wlm_workloadclassifier", armsql.WorkloadClassifier{ - Properties: &armsql.WorkloadClassifierProperties{ - MemberName: to.Ptr("dbo"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.WorkloadClassifier = armsql.WorkloadClassifier{ - // Name: to.Ptr("wlm_workloadclassifier"), - // Type: to.Ptr("Microsoft.Sql/servers/databases/workloadGroups/workloadClassifiers"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/servers/testsvr/databases/testdb/workloadGroups/wlm_workloadgroup/workloadClassifiers/wlm_workloadclassifier"), - // Properties: &armsql.WorkloadClassifierProperties{ - // Context: to.Ptr(""), - // EndTime: to.Ptr(""), - // Importance: to.Ptr(""), - // Label: to.Ptr(""), - // MemberName: to.Ptr("dbo"), - // StartTime: to.Ptr(""), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DeleteWorkloadClassifier.json -func ExampleWorkloadClassifiersClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewWorkloadClassifiersClient().BeginDelete(ctx, "Default-SQL-SouthEastAsia", "testsvr", "testdb", "wlm_workloadgroup", "wlm_workloadclassifier", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/GetWorkloadClassifierList.json -func ExampleWorkloadClassifiersClient_NewListByWorkloadGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewWorkloadClassifiersClient().NewListByWorkloadGroupPager("Default-SQL-SouthEastAsia", "testsvr", "testdb", "wlm_workloadgroup", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.WorkloadClassifierListResult = armsql.WorkloadClassifierListResult{ - // Value: []*armsql.WorkloadClassifier{ - // { - // Name: to.Ptr("classifier3"), - // Type: to.Ptr("Microsoft.Sql/servers/databases/workloadGroups/workloadClassifiers"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/servers/testsvr/databases/testdb/workloadGroups/wlm_workloadgroup/workloadClassifiers/classifier3"), - // Properties: &armsql.WorkloadClassifierProperties{ - // Context: to.Ptr(""), - // EndTime: to.Ptr(""), - // Importance: to.Ptr("high"), - // Label: to.Ptr(""), - // MemberName: to.Ptr("dbo"), - // StartTime: to.Ptr(""), - // }, - // }, - // { - // Name: to.Ptr("classifier1"), - // Type: to.Ptr("Microsoft.Sql/servers/databases/workloadGroups/workloadClassifiers"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/servers/testsvr/databases/testdb/workloadGroups/wlm_workloadgroup/workloadClassifiers/classifier1"), - // Properties: &armsql.WorkloadClassifierProperties{ - // Context: to.Ptr("test_context"), - // EndTime: to.Ptr("14:00"), - // Importance: to.Ptr("high"), - // Label: to.Ptr("test_label"), - // MemberName: to.Ptr("dbo"), - // StartTime: to.Ptr("12:00"), - // }, - // }, - // { - // Name: to.Ptr("classifier2"), - // Type: to.Ptr("Microsoft.Sql/servers/databases/workloadGroups/workloadClassifiers"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/servers/testsvr/databases/testdb/workloadGroups/wlm_workloadgroup/workloadClassifiers/classifier2"), - // Properties: &armsql.WorkloadClassifierProperties{ - // Context: to.Ptr(""), - // EndTime: to.Ptr("17:00"), - // Importance: to.Ptr("high"), - // Label: to.Ptr(""), - // MemberName: to.Ptr("dbo"), - // StartTime: to.Ptr("11:00"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/sql/armsql/workloadgroups_client.go b/sdk/resourcemanager/sql/armsql/workloadgroups_client.go index acda65e91237..e9416f15b3d2 100644 --- a/sdk/resourcemanager/sql/armsql/workloadgroups_client.go +++ b/sdk/resourcemanager/sql/armsql/workloadgroups_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armsql @@ -47,7 +46,7 @@ func NewWorkloadGroupsClient(subscriptionID string, credential azcore.TokenCrede // BeginCreateOrUpdate - Creates or updates a workload group. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -62,7 +61,8 @@ func (client *WorkloadGroupsClient) BeginCreateOrUpdate(ctx context.Context, res if err != nil { return nil, err } - return runtime.NewPoller[WorkloadGroupsClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[WorkloadGroupsClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[WorkloadGroupsClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -71,20 +71,22 @@ func (client *WorkloadGroupsClient) BeginCreateOrUpdate(ctx context.Context, res // CreateOrUpdate - Creates or updates a workload group. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview func (client *WorkloadGroupsClient) createOrUpdate(ctx context.Context, resourceGroupName string, serverName string, databaseName string, workloadGroupName string, parameters WorkloadGroup, options *WorkloadGroupsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, serverName, databaseName, workloadGroupName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createOrUpdateCreateRequest creates the CreateOrUpdate request. @@ -115,16 +117,19 @@ func (client *WorkloadGroupsClient) createOrUpdateCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // BeginDelete - Deletes a workload group. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -138,7 +143,8 @@ func (client *WorkloadGroupsClient) BeginDelete(ctx context.Context, resourceGro if err != nil { return nil, err } - return runtime.NewPoller[WorkloadGroupsClientDeleteResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[WorkloadGroupsClientDeleteResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[WorkloadGroupsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -147,20 +153,22 @@ func (client *WorkloadGroupsClient) BeginDelete(ctx context.Context, resourceGro // Delete - Deletes a workload group. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview func (client *WorkloadGroupsClient) deleteOperation(ctx context.Context, resourceGroupName string, serverName string, databaseName string, workloadGroupName string, options *WorkloadGroupsClientBeginDeleteOptions) (*http.Response, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, serverName, databaseName, workloadGroupName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteCreateRequest creates the Delete request. @@ -191,7 +199,7 @@ func (client *WorkloadGroupsClient) deleteCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -199,7 +207,7 @@ func (client *WorkloadGroupsClient) deleteCreateRequest(ctx context.Context, res // Get - Gets a workload group // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -207,18 +215,21 @@ func (client *WorkloadGroupsClient) deleteCreateRequest(ctx context.Context, res // - workloadGroupName - The name of the workload group. // - options - WorkloadGroupsClientGetOptions contains the optional parameters for the WorkloadGroupsClient.Get method. func (client *WorkloadGroupsClient) Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string, workloadGroupName string, options *WorkloadGroupsClientGetOptions) (WorkloadGroupsClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, serverName, databaseName, workloadGroupName, options) if err != nil { return WorkloadGroupsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return WorkloadGroupsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return WorkloadGroupsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return WorkloadGroupsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -249,7 +260,7 @@ func (client *WorkloadGroupsClient) getCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -266,7 +277,7 @@ func (client *WorkloadGroupsClient) getHandleResponse(resp *http.Response) (Work // NewListByDatabasePager - Gets the list of workload groups // -// Generated from API version 2020-11-01-preview +// Generated from API version 2022-11-01-preview // - resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure // Resource Manager API or the portal. // - serverName - The name of the server. @@ -325,7 +336,7 @@ func (client *WorkloadGroupsClient) listByDatabaseCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-11-01-preview") + reqQP.Set("api-version", "2022-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/sql/armsql/workloadgroups_client_example_test.go b/sdk/resourcemanager/sql/armsql/workloadgroups_client_example_test.go deleted file mode 100644 index 1714a2e5dc4c..000000000000 --- a/sdk/resourcemanager/sql/armsql/workloadgroups_client_example_test.go +++ /dev/null @@ -1,229 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsql_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sql/armsql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/GetWorkloadGroup.json -func ExampleWorkloadGroupsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewWorkloadGroupsClient().Get(ctx, "Default-SQL-SouthEastAsia", "testsvr", "testdb", "smallrc", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.WorkloadGroup = armsql.WorkloadGroup{ - // Name: to.Ptr("smallrc"), - // Type: to.Ptr("Microsoft.Sql/servers/databases/workloadGroups"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/servers/testsvr/databases/testdb/workloadGroups/smallrc"), - // Properties: &armsql.WorkloadGroupProperties{ - // Importance: to.Ptr("normal"), - // MaxResourcePercent: to.Ptr[int32](100), - // MaxResourcePercentPerRequest: to.Ptr[float64](3), - // MinResourcePercent: to.Ptr[int32](0), - // MinResourcePercentPerRequest: to.Ptr[float64](3), - // QueryExecutionTimeout: to.Ptr[int32](0), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/CreateOrUpdateWorkloadGroupMax.json -func ExampleWorkloadGroupsClient_BeginCreateOrUpdate_createAWorkloadGroupWithAllPropertiesSpecified() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewWorkloadGroupsClient().BeginCreateOrUpdate(ctx, "Default-SQL-SouthEastAsia", "testsvr", "testdb", "smallrc", armsql.WorkloadGroup{ - Properties: &armsql.WorkloadGroupProperties{ - Importance: to.Ptr("normal"), - MaxResourcePercent: to.Ptr[int32](100), - MaxResourcePercentPerRequest: to.Ptr[float64](3), - MinResourcePercent: to.Ptr[int32](0), - MinResourcePercentPerRequest: to.Ptr[float64](3), - QueryExecutionTimeout: to.Ptr[int32](0), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.WorkloadGroup = armsql.WorkloadGroup{ - // Name: to.Ptr("smallrc"), - // Type: to.Ptr("Microsoft.Sql/servers/databases/workloadGroups"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/servers/testsvr/databases/testdb/workloadGroups/smallrc"), - // Properties: &armsql.WorkloadGroupProperties{ - // Importance: to.Ptr("normal"), - // MaxResourcePercent: to.Ptr[int32](100), - // MaxResourcePercentPerRequest: to.Ptr[float64](3), - // MinResourcePercent: to.Ptr[int32](0), - // MinResourcePercentPerRequest: to.Ptr[float64](3), - // QueryExecutionTimeout: to.Ptr[int32](0), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/CreateOrUpdateWorkloadGroupMin.json -func ExampleWorkloadGroupsClient_BeginCreateOrUpdate_createAWorkloadGroupWithTheRequiredPropertiesSpecified() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewWorkloadGroupsClient().BeginCreateOrUpdate(ctx, "Default-SQL-SouthEastAsia", "testsvr", "testdb", "smallrc", armsql.WorkloadGroup{ - Properties: &armsql.WorkloadGroupProperties{ - MaxResourcePercent: to.Ptr[int32](100), - MinResourcePercent: to.Ptr[int32](0), - MinResourcePercentPerRequest: to.Ptr[float64](3), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.WorkloadGroup = armsql.WorkloadGroup{ - // Name: to.Ptr("smallrc"), - // Type: to.Ptr("Microsoft.Sql/servers/databases/workloadGroups"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/servers/testsvr/databases/testdb/workloadGroups/smallrc"), - // Properties: &armsql.WorkloadGroupProperties{ - // Importance: to.Ptr("normal"), - // MaxResourcePercent: to.Ptr[int32](100), - // MaxResourcePercentPerRequest: to.Ptr[float64](3), - // MinResourcePercent: to.Ptr[int32](0), - // MinResourcePercentPerRequest: to.Ptr[float64](3), - // QueryExecutionTimeout: to.Ptr[int32](0), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DeleteWorkloadGroup.json -func ExampleWorkloadGroupsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewWorkloadGroupsClient().BeginDelete(ctx, "Default-SQL-SouthEastAsia", "testsvr", "testdb", "wlm_workloadgroup", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/08894fa8d66cb44dc62a73f7a09530f905985fa3/specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/GetWorkloadGroupList.json -func ExampleWorkloadGroupsClient_NewListByDatabasePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewWorkloadGroupsClient().NewListByDatabasePager("Default-SQL-SouthEastAsia", "testsvr", "testdb", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.WorkloadGroupListResult = armsql.WorkloadGroupListResult{ - // Value: []*armsql.WorkloadGroup{ - // { - // Name: to.Ptr("smallrc"), - // Type: to.Ptr("Microsoft.Sql/servers/databases/workloadGroups"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/servers/testsvr/databases/testdb/workloadGroups/smallrc"), - // Properties: &armsql.WorkloadGroupProperties{ - // Importance: to.Ptr("normal"), - // MaxResourcePercent: to.Ptr[int32](100), - // MaxResourcePercentPerRequest: to.Ptr[float64](5), - // MinResourcePercent: to.Ptr[int32](0), - // MinResourcePercentPerRequest: to.Ptr[float64](5), - // QueryExecutionTimeout: to.Ptr[int32](0), - // }, - // }, - // { - // Name: to.Ptr("mediumrc"), - // Type: to.Ptr("Microsoft.Sql/servers/databases/workloadGroups"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/servers/testsvr/databases/testdb/workloadGroups/mediumrc"), - // Properties: &armsql.WorkloadGroupProperties{ - // Importance: to.Ptr("normal"), - // MaxResourcePercent: to.Ptr[int32](100), - // MaxResourcePercentPerRequest: to.Ptr[float64](10), - // MinResourcePercent: to.Ptr[int32](0), - // MinResourcePercentPerRequest: to.Ptr[float64](10), - // QueryExecutionTimeout: to.Ptr[int32](0), - // }, - // }, - // { - // Name: to.Ptr("largerc"), - // Type: to.Ptr("Microsoft.Sql/servers/databases/workloadGroups"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/servers/testsvr/databases/testdb/workloadGroups/largerc"), - // Properties: &armsql.WorkloadGroupProperties{ - // Importance: to.Ptr("high"), - // MaxResourcePercent: to.Ptr[int32](100), - // MaxResourcePercentPerRequest: to.Ptr[float64](20), - // MinResourcePercent: to.Ptr[int32](0), - // MinResourcePercentPerRequest: to.Ptr[float64](20), - // QueryExecutionTimeout: to.Ptr[int32](0), - // }, - // }}, - // } - } -}